Bug #69277 [Opn->Fbk]: PHP-FPM crashes on file_put_contents call

From: Date: Mon, 23 Mar 2015 06:57:59 +0000
Subject: Bug #69277 [Opn->Fbk]: PHP-FPM crashes on file_put_contents call
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-191539@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=69277&edit=1 ID: 69277 Updated by: laruence@php.net Reported by: sebastien dot vray at gmail dot com Summary: PHP-FPM crashes on file_put_contents call -Status: Open +Status: Feedback Type: Bug Package: *Directory/Filesystem functions Operating System: Fedora 21 3.18.3-201.fc21.i686 PHP Version: Irrelevant Block user comment: N Private report: N New Comment: Thank you for this bug report. To properly diagnose the problem, we need a backtrace to see what is happening behind the scenes. To find out how to generate a backtrace, please read http://bugs.php.net/bugs-generating-backtrace.php for *NIX and http://bugs.php.net/bugs-generating-backtrace-win32.php for Win32 Once you have generated a backtrace, please submit it to this bug report and change the status back to "Open". Thank you for helping us make PHP better. Previous Comments: ------------------------------------------------------------------------ [2015-03-22 17:42:08] sebastien dot vray at gmail dot com 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); } ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=69277&edit=1

« previous php.bugs (#191539) next »