|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2015-03-23 06:57 UTC] laruence@php.net
-Status: Open
+Status: Feedback
[2015-03-23 06:57 UTC] laruence@php.net
[2015-04-05 04:22 UTC] php-bugs at lists dot php dot net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 20:00:01 2025 UTC |
Description: ------------ Let's assume the file foo.txt with read only permissions or 744 chmod and the owner of the PHP-FPM process is not the same as foo.txt, if you try to write something in it with the function file_put_contents you'll get a "503 service unavailable" response from apache plus a ambigous warning in the error log: 22-Mar-2015 17:47:27 Europe/Paris] PHP Warning: file_put_contents(foo.txt): °¶»áÈ in /var/www/xxx/api/Library/Log.php on line 121 While using respectively fopen(), fwrite(), and fclose() on the same file with the same conditions and appropriate controls will produce nothing. My PHP version is 5.6.4 Test script: --------------- <?php //foo.txt has 444 chmod or PHP-FPM user doesn't have the appropriate write permissions on the file //This makes PHP-FPM crash file_put_contents('foo.txt', 'Whatever', FILE_APPEND);//Makes PHP-FPM crash //While this doesn't $fpLog = @fopen($path, 'ba+'); if ($fpLog) { @fwrite($fp, $content); @fclose($fpLog); }