Forum Moderators: coopster
>cat mkdir.php
<?
if(mkdir('/var/www/vhosts/mysite.com/test/abc'))
echo "TRUE";
else
echo "FALSE";
?>
As you can see in my source code, I want to create a directory in /var/www/vhosts/mysite.com/test/ directory. The mode of test directory is 777. But I always receive FALSE. I tried to create a dir in httpdocs/a_tmp_777_dir and it works. Why I couldn't create dir outside the httpdocs directory?
If your server is running php in safe mode, then you can only alter directories that you own.
The doc for mkdir() says:
Note: When safe mode is enabled, PHP checks whether the directory in which you are about to operate has the same UID (owner) as the script that is being executed.
<?
if(mkdir('test/abc')) {
echo "TRUE";
} else {
echo "FALSE";
}
?>
Also, make sure that 'test' exists.