Jump to content

[SOLVED] Allowed to create new files and folders INSTALL ERROR


Recommended Posts

Hi,
Im having the hardest time to install prestashop on my host, the problem is at "Allowed to create new files and folders" item, i dont know what does it tests so i cant ask my host to modify the right config for it to work.

Most ppl say its a permission issue but it is not, i belive its some php setting that is not setup correctly but i cant find wich, so im asking what does it test, is it url_fopen? is it include? i (and the whole load of 100+ posts i found over the internet) just need to know what does Allowed to create new files and folders means in php.ini config file, or wherever the config for this msg is.

Thanks for you time.

Link to comment
Share on other sites

Hi marlbor0,

The function used is located in install/ConfigurationTest.php, we use the php function is_writtable()

can you tell us what is your operating system ? Which version ? Do you install it in your localhost or else ? which directory ?

On Unix, file owner has to be the user who lauch apache (www-data if Debian/Ubuntu based for example), or file perms has to be 777.

On Windows, you have to launch the server you use with administrators rights.

Link to comment
Share on other sites

Hi Michaël,

Thanks alot for your reply, im using a linux host not local, now that you said ownership...that must be it, if my host has safe_mode On that could be it right? Im gona check files ownership in the morning and i will post it here, i think you nailed the problem alot of ppl is facing.

I dont think theres a way to fix that in my host (i think they use some kind of phpsu) but if we sort this problem out, alot of ppl will finaly find out whats wrong with their hosts.

Merci Michaël!!!

Link to comment
Share on other sites

The problem is not solved (yet ;) ).

When I say "file owner" I mean in the system way : for example on a multi-user windows computer, you (username= marlbor0 ) is the owner of every files in your personal directory.

I already used ovh and I know their suphp thing, I don't think that's the problem.

You can make a short script name /www/mytest/test.php and containing something like this :

<?php
function simple_test_dir($dir)
   {
       echo "
testing $dir";
       if (!file_exists($dir))
           return false;
       else echo "
file_exists is true";
       if (!$dh = opendir($dir))
           return false;
       else echo "
opendir is true";

       $dummy = rtrim($dir, '/').'/'.uniqid();
       if (@file_put_contents($dummy, 'test'))
       {
           @unlink($dummy);
           echo "
file_puts_contents works !";

       }
       elseif (!is_writable($dir))
           return false;
       else echo "
is_writtable is true";

       closedir($dh);
       return true;
   }
simple_test_dir(dirname(__FILE__));

simple_test_dir(dirname(__FILE__)."/innexistant_dir");
simple_test_dir(dirname(__FILE__)."/../");




You can also try to upload a file with a form (dont forget to start with <form enctype="multipart/form-data" >

Link to comment
Share on other sites

Michaël good morning,

The result is:

testing /home/vilasoni/public_html
file_exists is true
opendir is true
file_puts_contents works !
testing /home/vilasoni/public_html/innexistant_dir
testing /home/vilasoni/public_html/../
file_exists is true
opendir is true
file_puts_contents works !



The file is located at: www.vilasonia.com.br/test.php

I hacked the file that make the tests for instaling prestashop and got it installed, the front end looks good but the back end gives many warnings and then a fatal: http://www.vilasonia.com.br/136/admin136/

Merci Michaël.

ps: I think the problem is, the file after being uploaded belongs to user X and when prestashop runs its scripts, it runs as user Y.

Link to comment
Share on other sites

I already got this kind of problem, when I made a html page to upload files without ftp : when uploaded, the files had wrong rights (744 instead of 755 or something), that has been solved by adding a button to change chmod in php ... But that shouldn't be necessary ...

Do you use v 1.3.6 ?

The first problem came from getcwd(), which is disabled apparently ... If your php version allows this, you can call __DIR__ or dirname(__FILE__)

The fact is when the code make "include(/../config/config.inc.php)", the string should start with "/home/vilasoni/public_html/136/admin136/" I suppose.

Try to change, in file index.php of your admin directory

define('_PS_ADMIN_DIR_', getcwd());


by

define('_PS_ADMIN_DIR_', dirname(__FILE__));



I think this fix should solve the problem. If not, please tell us the php version you use with ovh. In ovh, you can choose php version by setting a php_value in the .htaccess file (to see in ovh guides)

Link to comment
Share on other sites

Hey Michaël,

That fixed some of the warnings but im still unable to get into admin, im already switching hosts but i feel like all this trouble is worth for the sake of debugging and helping ppl with the same problem.

http://www.vilasonia.com.br/136/admin136/'>http://www.vilasonia.com.br/136/admin136/

Now theres fewer warnings, the problem is "getcwd() has been disabled for security reasons", im out of ideas i use php5 (http://www.vilasonia.com.br/ this have a index.php with phpinfo() ) and my host is ideon brazil so they are likely to use weird methods of config.

Merci beaucoup Michaël! Your help is much apreciated!!!

Link to comment
Share on other sites

You're welcome marlbor0 ;)

I really think the problem cames from getcwd() (see my previous comments) : just replace it by basedir(__FILE__), this should work with php 5.2.9.

in your /admin dir, I still see the warning, so you don't replaced it !

__FILE__ should works, it's a magic word

Warning: getcwd() has been disabled for security reasons in /home/vilasoni/public_html/136/admin136/login.php on line 14



There is no reason it doesn't work... :/

You can also take a look on the following php docs :

magic constant : http://www.php.net/manual/en/language.constants.predefined.php
getcwd : http://www.php.net/manual/en/function.getcwd.php

Link to comment
Share on other sites

Well, maybe you didn't put this new file on your server ..

I see this warning :
Warning: getcwd() has been disabled for security reasons in /home/vilasoni/public_html/136/admin136/login.php on line 14

You can also try to replace the function with the following string :

/home/vilasoni/public_html/136/admin136



But I really diskike this !

Link to comment
Share on other sites

Yay, my bad i was editing index.php only when i had to edit login.php also.
That fixed the problem, pretty good!!!
Im sure this topic will help those in the same situation, your help was really important, thank you very much, i see prestashop with better eyes right now.
Thanks alot Michaël.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...