fat Tue, 15 Nov 2011 22:29:59 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=319281
Log: - FR #60199 (enhance FPM error log when the primary script can't be open) Bug: https://bugs.php.net/60199 (Feedback) php-fpm does not log an error for "too many open files" Changed paths: U php/php-src/branches/PHP_5_3/NEWS U php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_main.c U php/php-src/branches/PHP_5_4/NEWS U php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fpm_main.c U php/php-src/trunk/sapi/fpm/fpm/fpm_main.c Modified: php/php-src/branches/PHP_5_3/NEWS =================================================================== --- php/php-src/branches/PHP_5_3/NEWS 2011-11-15 22:27:59 UTC (rev 319280) +++ php/php-src/branches/PHP_5_3/NEWS 2011-11-15 22:29:59 UTC (rev 319281) @@ -10,6 +10,7 @@ - PHP-FPM SAPI: . Fixed bug #60179 (php_flag and php_value does not work properly). (fat) + . enhance error log when the primary script can't be open. FR #60199. (fat) - Intl: . Fixed bug #60192 (SegFault when Collator not constructed Modified: php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_main.c =================================================================== --- php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_main.c 2011-11-15 22:27:59 UTC (rev 319280) +++ php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_main.c 2011-11-15 22:29:59 UTC (rev 319281) @@ -1787,6 +1787,7 @@ SG(server_context) = (void *) &request; init_request_info(TSRMLS_C); CG(interactive) = 0; + char *primary_script = NULL; fpm_request_info(); @@ -1812,7 +1813,9 @@ /* If path_translated is NULL, terminate here with a 404 */ if (!SG(request_info).path_translated) { zend_try { + zlog(ZLOG_DEBUG, "Primary script unknown"); SG(sapi_headers).http_response_code = 404; + PUTS("File not found.\n"); } zend_catch { } zend_end_try(); goto fastcgi_request_done; @@ -1824,9 +1827,16 @@ goto fastcgi_request_done; } + /* + * have to duplicate SG(request_info).path_translated to be able to log errrors + * php_fopen_primary_script seems to delete SG(request_info).path_translated on failure + */ + primary_script = estrdup(SG(request_info).path_translated); + /* path_translated exists, we can continue ! */ if (php_fopen_primary_script(&file_handle TSRMLS_CC) == FAILURE) { zend_try { + zlog(ZLOG_ERROR, "Unable to open primary script: %s (%s)", primary_script, strerror(errno)); if (errno == EACCES) { SG(sapi_headers).http_response_code = 403; PUTS("Access denied.\n"); @@ -1848,6 +1858,10 @@ php_execute_script(&file_handle TSRMLS_CC); fastcgi_request_done: + if (primary_script) { + efree(primary_script); + } + if (request_body_fd != -1) { close(request_body_fd); } Modified: php/php-src/branches/PHP_5_4/NEWS =================================================================== --- php/php-src/branches/PHP_5_4/NEWS 2011-11-15 22:27:59 UTC (rev 319280) +++ php/php-src/branches/PHP_5_4/NEWS 2011-11-15 22:29:59 UTC (rev 319281) @@ -32,6 +32,10 @@ resource). (Laruence) . Fixed bug #55759 (memory leak when using built-in server). (Laruence) +- Improved PHP-FPM SAPI: + . enhance error log when the primary script can't be open. FR #60199. (fat) + + 11 Nov 2011, PHP 5.4.0 RC1 - General improvements: . Changed silent conversion of array to string to produce a notice. (Patrick) Modified: php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fpm_main.c =================================================================== --- php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fpm_main.c 2011-11-15 22:27:59 UTC (rev 319280) +++ php/php-src/branches/PHP_5_4/sapi/fpm/fpm/fpm_main.c 2011-11-15 22:29:59 UTC (rev 319281) @@ -1785,6 +1785,7 @@ SG(server_context) = (void *) &request; init_request_info(TSRMLS_C); CG(interactive) = 0; + char *primary_script = NULL; fpm_request_info(); @@ -1810,7 +1811,9 @@ /* If path_translated is NULL, terminate here with a 404 */ if (!SG(request_info).path_translated) { zend_try { + zlog(ZLOG_DEBUG, "Primary script unknown"); SG(sapi_headers).http_response_code = 404; + PUTS("File not found.\n"); } zend_catch { } zend_end_try(); goto fastcgi_request_done; @@ -1822,9 +1825,16 @@ goto fastcgi_request_done; } + /* + * have to duplicate SG(request_info).path_translated to be able to log errrors + * php_fopen_primary_script seems to delete SG(request_info).path_translated on failure + */ + primary_script = estrdup(SG(request_info).path_translated); + /* path_translated exists, we can continue ! */ if (php_fopen_primary_script(&file_handle TSRMLS_CC) == FAILURE) { zend_try { + zlog(ZLOG_ERROR, "Unable to open primary script: %s (%s)", primary_script, strerror(errno)); if (errno == EACCES) { SG(sapi_headers).http_response_code = 403; PUTS("Access denied.\n"); @@ -1846,6 +1856,10 @@ php_execute_script(&file_handle TSRMLS_CC); fastcgi_request_done: + if (primary_script) { + efree(primary_script); + } + if (request_body_fd != -1) { close(request_body_fd); } Modified: php/php-src/trunk/sapi/fpm/fpm/fpm_main.c =================================================================== --- php/php-src/trunk/sapi/fpm/fpm/fpm_main.c 2011-11-15 22:27:59 UTC (rev 319280) +++ php/php-src/trunk/sapi/fpm/fpm/fpm_main.c 2011-11-15 22:29:59 UTC (rev 319281) @@ -1785,6 +1785,7 @@ SG(server_context) = (void *) &request; init_request_info(TSRMLS_C); CG(interactive) = 0; + char *primary_script = NULL; fpm_request_info(); @@ -1810,7 +1811,9 @@ /* If path_translated is NULL, terminate here with a 404 */ if (!SG(request_info).path_translated) { zend_try { + zlog(ZLOG_DEBUG, "Primary script unknown"); SG(sapi_headers).http_response_code = 404; + PUTS("File not found.\n"); } zend_catch { } zend_end_try(); goto fastcgi_request_done; @@ -1822,9 +1825,16 @@ goto fastcgi_request_done; } + /* + * have to duplicate SG(request_info).path_translated to be able to log errrors + * php_fopen_primary_script seems to delete SG(request_info).path_translated on failure + */ + primary_script = estrdup(SG(request_info).path_translated); + /* path_translated exists, we can continue ! */ if (php_fopen_primary_script(&file_handle TSRMLS_CC) == FAILURE) { zend_try { + zlog(ZLOG_ERROR, "Unable to open primary script: %s (%s)", primary_script, strerror(errno)); if (errno == EACCES) { SG(sapi_headers).http_response_code = 403; PUTS("Access denied.\n"); @@ -1846,6 +1856,10 @@ php_execute_script(&file_handle TSRMLS_CC); fastcgi_request_done: + if (primary_script) { + efree(primary_script); + } + if (request_body_fd != -1) { close(request_body_fd); }
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php