Edit report at http://bugs.php.net/bug.php?id=53658&edit=1

 ID:                 53658
 User updated by:    pierregobin at free dot fr
 Reported by:        pierregobin at free dot fr
 Summary:            is_writable returns always false
-Status:             Feedback
+Status:             Open
 Type:               Bug
 Package:            Filesystem function related
 Operating System:   Linux 2.6.35
 PHP Version:        5.3SVN-2011-01-05 (SVN)
 Block user comment: N
 Private report:     N

 New Comment:

Hi - 



1) apache is the user as shown by ps aux | grep httpd.



apache    1724  0.0  0.8  33996  4248 ?        S    18:00   0:00
/usr/sbin/httpd

apache    1726  0.0  0.6  32972  3292 ?        S    18:00   0:00
/usr/sbin/httpd



2) when I run php on command line using my own account :

php -f is_writable.php - result is correct;



3) when I run php on command line sudoed by apache - it works also (echo
is_writable).

sudo -u apache php -f is_writable.php

this echos the right result :

is_writable<br>



Seems like httpd is disturbing php...


Previous Comments:
------------------------------------------------------------------------
[2011-01-05 23:44:23] ras...@php.net

Are you absolutely sure your web server is running as user apache?  Do a
"ps -aux 

| grep httpd" or "ps aux | grep apache" and see which user it is running
as.  

is_writable works fine everywhere as far as I know.

------------------------------------------------------------------------
[2011-01-05 22:38:05] pierregobin at free dot fr

Description:
------------
When php script is run via apache is_writable always returns false :



'is_writable()' always returns 'false' whatever :

- the permission write sets or not.

- safe_mode on or off

- the owner of the file being root:root or apache:apache



on the other side, 'is_readable()' returns the correct value (either
'true' when the file is made readable or 'false' when the file is made
unreadable). 



But, when the same script is run by the php command line (under root) -
is_writable returns the correct value.

Test script:
---------------
<?php

if (is_writable("toto")) {

        echo "is_writable<br>";

} else {

        echo "is not writable!!!<br>";

}

?>

Expected result:
----------------
is_writable in case 'toto' is writable

is not writable in case 'toto' is not writable



------------------------------------------------------------------------



-- 
Edit this bug report at http://bugs.php.net/bug.php?id=53658&edit=1

Reply via email to