|
Posted by Martin Adams on 07/21/07 13:35
If someone could help me with this issue, it would be much appreciated.
I'm running Fedora Core 5 which had Apache and PHP 5.1.6 installed. I've
got it so it can run a PHP script okay. However, it doesn't have any access
to the file system because it keeps getting a permission denied. I can't
create directories, write to files, etc.
Now, normally this is just because the current user 'apache' doesn't have
write permission to the file system. However, I've not only changed the
recursive directory from my /web root to have 777 full permissions, I've
also changed the file/directory owner and group to be 'apache' - still with
no luck.
Any ideas what might be going on?
Here's my script:
$output = shell_exec('whoami');
echo "<pre>Who Am I: $output</pre>";
$output = shell_exec('groups');
echo "<pre>Groups: $output</pre>";
$output = shell_exec('ls -l');
echo "<pre>Directory Listing:<br>$output</pre>";
$fp = fopen('test.dat', 'w');
fwrite($fp, "this is my data");
fclose($fp);
if(mkdir('temp3'))
{
print('<p>Created temp3</p>');
}
else
{
print('<p>Could not create temp3</p>');
}
$output = shell_exec('ls -l');
echo "<pre>Directory Listing:<br>$output</pre>";
This is the output it generates:
Who Am I: apache
Groups: apache
Directory Listing:total 8
-rwxrwxrwx 1 apache apache 1484 Jul 21 04:31 test.php
Warning: fopen(test.dat) [function.fopen]: failed to open stream: Permission
denied in /web/webbuild/test.php on line 29
Warning: fwrite(): supplied argument is not a valid stream resource in
/web/webbuild/test.php on line 30
Warning: fclose(): supplied argument is not a valid stream resource in
/web/webbuild/test.php on line 31
Warning: mkdir() [function.mkdir]: Permission denied in
/web/webbuild/test.php on line 33
Could not create temp3
Directory Listing:total 8
-rwxrwxrwx 1 apache apache 1484 Jul 21 04:31 test.php
Any ideas why it can't write to the filesystem?
Many thanks in advance.
Martin
php@martin.student-film.com
Navigation:
[Reply to this message]
|