summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRemi Collet <remi@php.net>2014-11-22 10:31:26 +0100
committerRemi Collet <remi@php.net>2014-11-22 10:31:26 +0100
commit48fa36500670cc666edbf1e2902c16d16a72e375 (patch)
tree581ce355672cff3605897b81beb0bfd9a620b51b
parent134827dbd56d625de575760bc79db6c006946863 (diff)
parent6b974874abe55622ed0d7610386467e6f348dc40 (diff)
downloadphp-git-48fa36500670cc666edbf1e2902c16d16a72e375.tar.gz
Merge branch 'PHP-5.6'
* PHP-5.6: NEWS minor typo in test add test for global / pool prefix and bug #68478 Fixed Bug #68478 acess_log don't use prefix
-rw-r--r--sapi/fpm/fpm/fpm_conf.c6
-rw-r--r--sapi/fpm/fpm/fpm_log.c2
-rw-r--r--sapi/fpm/php-fpm.conf.in1
-rw-r--r--sapi/fpm/tests/017.phpt2
-rw-r--r--sapi/fpm/tests/019.phpt80
-rw-r--r--sapi/fpm/tests/020.phpt76
6 files changed, 163 insertions, 4 deletions
diff --git a/sapi/fpm/fpm/fpm_conf.c b/sapi/fpm/fpm/fpm_conf.c
index c4651730d2..d4e46853ff 100644
--- a/sapi/fpm/fpm/fpm_conf.c
+++ b/sapi/fpm/fpm/fpm_conf.c
@@ -1200,15 +1200,15 @@ static int fpm_conf_post_process(int force_daemon TSRMLS_DC) /* {{{ */
return -1;
}
- if (0 > fpm_log_open(0)) {
+ if (0 > fpm_event_pre_init(fpm_global_config.events_mechanism)) {
return -1;
}
- if (0 > fpm_event_pre_init(fpm_global_config.events_mechanism)) {
+ if (0 > fpm_conf_process_all_pools()) {
return -1;
}
- if (0 > fpm_conf_process_all_pools()) {
+ if (0 > fpm_log_open(0)) {
return -1;
}
diff --git a/sapi/fpm/fpm/fpm_log.c b/sapi/fpm/fpm/fpm_log.c
index c71281b0b9..b0bf32ac16 100644
--- a/sapi/fpm/fpm/fpm_log.c
+++ b/sapi/fpm/fpm/fpm_log.c
@@ -46,6 +46,8 @@ int fpm_log_open(int reopen) /* {{{ */
if (0 > fd) {
zlog(ZLOG_SYSERROR, "failed to open access log (%s)", wp->config->access_log);
return -1;
+ } else {
+ zlog(ZLOG_DEBUG, "open access log (%s)", wp->config->access_log);
}
if (reopen) {
diff --git a/sapi/fpm/php-fpm.conf.in b/sapi/fpm/php-fpm.conf.in
index bcdfe56a10..b2d8a22536 100644
--- a/sapi/fpm/php-fpm.conf.in
+++ b/sapi/fpm/php-fpm.conf.in
@@ -131,6 +131,7 @@
; Per pool prefix
; It only applies on the following directives:
+; - 'access.log'
; - 'slowlog'
; - 'listen' (unixsocket)
; - 'chroot'
diff --git a/sapi/fpm/tests/017.phpt b/sapi/fpm/tests/017.phpt
index ea0738a1c7..b3de089a70 100644
--- a/sapi/fpm/tests/017.phpt
+++ b/sapi/fpm/tests/017.phpt
@@ -61,7 +61,7 @@ Done
--CLEAN--
<?php
$logfile = __DIR__.'/php-fpm.log.tmp';
- $srcfile = __DIR__.'/php-fpm.log.tmp';
+ $srcfile = __DIR__.'/php-fpm.tmp.php';
@unlink($logfile);
@unlink($srcfile);
?> \ No newline at end of file
diff --git a/sapi/fpm/tests/019.phpt b/sapi/fpm/tests/019.phpt
new file mode 100644
index 0000000000..cdf8126244
--- /dev/null
+++ b/sapi/fpm/tests/019.phpt
@@ -0,0 +1,80 @@
+--TEST--
+FPM: Test global prefix
+--SKIPIF--
+<?php include "skipif.inc"; ?>
+--FILE--
+<?php
+
+include "include.inc";
+
+$logfile = 'php-fpm.log.tmp';
+$accfile = 'php-fpm.acc.tmp';
+$slwfile = 'php-fpm.slw.tmp';
+$pidfile = 'php-fpm.pid.tmp';
+$port = 9000+PHP_INT_SIZE;
+
+$cfg = <<<EOT
+[global]
+error_log = $logfile
+pid = $pidfile
+[test]
+listen = 127.0.0.1:$port
+access.log = $accfile
+slowlog = $slwfile;
+request_slowlog_timeout = 1
+ping.path = /ping
+ping.response = pong
+pm = dynamic
+pm.max_children = 5
+pm.start_servers = 2
+pm.min_spare_servers = 1
+pm.max_spare_servers = 3
+catch_workers_output = yes
+EOT;
+
+$fpm = run_fpm($cfg, $tail, '--prefix '.__DIR__);
+if (is_resource($fpm)) {
+ fpm_display_log($tail, 2);
+ try {
+ run_request('127.0.0.1', $port);
+ echo "Ping ok\n";
+ } catch (Exception $e) {
+ echo "Ping error\n";
+ }
+ printf("File %s %s\n", $logfile, (file_exists(__DIR__.'/'.$logfile) ? "exists" : "missing"));
+ printf("File %s %s\n", $accfile, (file_exists(__DIR__.'/'.$accfile) ? "exists" : "missing"));
+ printf("File %s %s\n", $slwfile, (file_exists(__DIR__.'/'.$slwfile) ? "exists" : "missing"));
+ printf("File %s %s\n", $pidfile, (file_exists(__DIR__.'/'.$pidfile) ? "exists" : "missing"));
+
+ proc_terminate($fpm);
+ echo stream_get_contents($tail);
+ fclose($tail);
+ proc_close($fpm);
+ printf("File %s %s\n", $pidfile, (file_exists(__DIR__.'/'.$pidfile) ? "still exists" : "removed"));
+ readfile(__DIR__.'/'.$accfile);
+}
+
+?>
+--EXPECTF--
+[%s] NOTICE: fpm is running, pid %d
+[%s] NOTICE: ready to handle connections
+Ping ok
+File php-fpm.log.tmp exists
+File php-fpm.acc.tmp exists
+File php-fpm.slw.tmp exists
+File php-fpm.pid.tmp exists
+[%s] NOTICE: Terminating ...
+[%s] NOTICE: exiting, bye-bye!
+File php-fpm.pid.tmp removed
+127.0.0.1 - %s "GET /ping" 200
+--CLEAN--
+<?php
+ $logfile = __DIR__.'/php-fpm.log.tmp';
+ $accfile = __DIR__.'/php-fpm.acc.tmp';
+ $slwfile = __DIR__.'/php-fpm.slw.tmp';
+ $pidfile = __DIR__.'/php-fpm.pid.tmp';
+ @unlink($logfile);
+ @unlink($accfile);
+ @unlink($slwfile);
+ @unlink($pidfile);
+?>
diff --git a/sapi/fpm/tests/020.phpt b/sapi/fpm/tests/020.phpt
new file mode 100644
index 0000000000..d45eeccff8
--- /dev/null
+++ b/sapi/fpm/tests/020.phpt
@@ -0,0 +1,76 @@
+--TEST--
+FPM: Test pool prefix
+--SKIPIF--
+<?php include "skipif.inc"; ?>
+--FILE--
+<?php
+
+include "include.inc";
+
+$prefix = __DIR__;
+$logfile = __DIR__.'/php-fpm.log.tmp';
+$accfile = 'php-fpm.acc.tmp';
+$slwfile = 'php-fpm.slw.tmp';
+$pidfile = __DIR__.'/php-fpm.pid.tmp';
+$port = 9000+PHP_INT_SIZE;
+$cfg = <<<EOT
+
+[global]
+error_log = $logfile
+pid = $pidfile
+[test]
+prefix = $prefix;
+listen = 127.0.0.1:$port
+access.log = $accfile
+slowlog = $slwfile;
+request_slowlog_timeout = 1
+ping.path = /ping
+ping.response = pong
+pm = dynamic
+pm.max_children = 5
+pm.start_servers = 2
+pm.min_spare_servers = 1
+pm.max_spare_servers = 3
+catch_workers_output = yes
+EOT;
+
+$fpm = run_fpm($cfg, $tail);
+if (is_resource($fpm)) {
+ fpm_display_log($tail, 2);
+ try {
+ run_request('127.0.0.1', $port);
+ echo "Ping ok\n";
+ } catch (Exception $e) {
+ echo "Ping error\n";
+ }
+ printf("File %s %s\n", $accfile, (file_exists(__DIR__.'/'.$accfile) ? "exists" : "missing"));
+ printf("File %s %s\n", $slwfile, (file_exists(__DIR__.'/'.$slwfile) ? "exists" : "missing"));
+
+ proc_terminate($fpm);
+ echo stream_get_contents($tail);
+ fclose($tail);
+ proc_close($fpm);
+ readfile(__DIR__.'/'.$accfile);
+}
+
+?>
+--EXPECTF--
+[%s] NOTICE: fpm is running, pid %d
+[%s] NOTICE: ready to handle connections
+Ping ok
+File php-fpm.acc.tmp exists
+File php-fpm.slw.tmp exists
+[%s] NOTICE: Terminating ...
+[%s] NOTICE: exiting, bye-bye!
+127.0.0.1 - %s "GET /ping" 200
+--CLEAN--
+<?php
+ $logfile = __DIR__.'/php-fpm.log.tmp';
+ $accfile = __DIR__.'/php-fpm.acc.tmp';
+ $slwfile = __DIR__.'/php-fpm.slw.tmp';
+ $pidfile = __DIR__.'/php-fpm.pid.tmp';
+ @unlink($logfile);
+ @unlink($accfile);
+ @unlink($slwfile);
+ @unlink($pidfile);
+?>