Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have two files, one php file and one log file. The permission has been changed to the following:

-rwxr-x--- 1 www-data www-data  294 2012-06-25 10:17 function.php

-rwxr-x--- 1 www-data www-data    0 2012-06-25 09:53 log.txt

The permission is set to 750.

when I call function.php, I receive the following error message

fopen(log.txt): failed to open stream: Permission denied

This is the line :

$fp = fopen("log.txt","a");

I am very confused. I have php and the file to be written both under www-data now, so why would there be any permission problem?

Please help

share|improve this question
    
System log says...? –  Ignacio Vazquez-Abrams Jun 25 '12 at 2:54
add comment

1 Answer

If you aren't on Windows, you can check if your process is really own by www-data by

$processUser = posix_getpwuid(posix_geteuid());
print $processUser['name'];

Check the directory too ! Are you sure that you are in the right dir ?

echo getcwd();
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.