In error log i found warnings something like that
WARNING: [pool www] server reached pm.max_children setting (10), consider raising it
So I changed it in conf file /etc/php/7.0/fpm/pool.d/www.conf to 52 after some recommended calculations.
After this I restarted apache and I thought that problem was resolved. But right now I see again in error log file same warning with same value 10.
So I have a question - how can I check current pm.max_children? If it is not 52 then I will try to inspect why it is not applying.
It is an old post, surely you have already solved it in the meantime. In any case, maybe the problem was that you also had to restart php-fpm to make the changes effective with something like this:
sudo service php7.0-fpm restart
Related
After increasing number of queue workers via Supervisor and php artisan queue:work, sometimes I get:
WARNING: [pool www] server reached pm.max_children setting (10), consider raising it
Does anyone know if php artisan queue:work caused the warning above?
You can change the value of max_children from here:
/etc/php/8.0/fpm/pool.d/www.conf
Please note the PHP version and OS and change the path to match yours.
But when you say sometimes, it sounds you have slow PHP scripts.
probably a pretty simple question but how do I change the log format for FPM logs? An Entry looks like this for im in stderr:
2017/12/12 10:59:09 [error] 17#17: *6 FastCGI sent in stderr: "PHP message: 2017-12-12 11:59:09 > WARNING > WarningId: 1234 []
The thing I want to remove is the [error] part because in this example I'm logging a warning via monolog.
Since PHP 7.3 you can use
[www]
catch_workers_output = yes
decorate_workers_output = no
in php-fpm.conf (or php-fpm.d/ or pool.d/, depends on your system) to remove some extra decoration
Php fpm doesn't seem to have a config for this error logging format.
You could stop logging errors altogether by changing the logging level setting.
By a quick look into php-fpm sources it seems that it's the php error log format that is used for that.
And you do have control over that. One solution would be writing your own error handler
I try to run a Yii based PHP application in a Docker container using the official php-fpm image.
It's common practice for docker containers to write all log messages to stdout / stderr. So I do the same from my container with a code that basically looks like this:
$fp = #fopen('php://stdout','w');
fwrite($fp, $message);
fclose($fp);
Unfortunately PHP-FPM now prefixes all my log messages with ugly warnings:
[21-Mar-2016 14:10:02] WARNING: [pool www] child 12 said into stdout: "2016-03-21 14:10:02 [x.x.x.x][-][-][trace][yii\base\Application::bootstrap] Bootstrap with yii\debug\Module::bootstrap()"
[21-Mar-2016 14:10:02] WARNING: [pool www] child 12 said into stdout: "2016-03-21 14:10:02 [x.x.x.x][-][-][info][yii\web\Session::open] Session started"
...
Why is this and is there a way to prevent PHP-FPM from doing this?
UPDATE:
I've also opened an issue at the docker-library/php project site.
They already include the catch_workers_output = yes in their configuration. So that's not the solution.
According to these changes the problem should be fixed in PHP 7.3
It is correct. you are running php-fpm and error logs are from php-fpm , not from PHP .
you should expect php-fpm log , not php log. fortunately php-fpm will write every log that received from PHP in end of its logs.
I found many errors like this one
[Wed Nov 06 14:34:01 2013] [warn-phpd] mmap cache can't open C:\www\somefile.php (pid 4484 th 1668)
in my Apache error.log file. I tried to pinpoint the source of the error for some time but with no luck so far.
I find out that PHP Opcache is not the culprit.
error_log did not help. I think that my PHP source codes do not affect the error.
My stack: Apache 2.4.6, Windows, PHP 5.4.20
Did anyone encounter the same error?
Note: The error message I get is not the same as, for example, the error:
Mon Dec 1 21:08:20 2008] [warn-phpd] mmap cache can't open /var/www/vhosts/domain.com/httpdocs/file.php - Permission denied (pid 7831)
where there is a reason why mmap can't open the file.
This is caused by the total number of files that are opened by the server. If this is on a hosting company then they would be able to resolve this for you, if you are on your own system then try these steps:
Edit the apache startup script, \Program Files\Apache Software Foundation\Apache2.2\etc\init.d\httpd (may be different on your system) and add this before anything else:
ulimit -n 20480 #Raise the ulimit to a higher value then you have
Then Restart apache using httpd.exe restart
Hope this points you in a general direction
Disable MMAP. It's not supported on Windows.
It's an efficient method to map files to memory, to work on their content. Similar story with sendfile, an efficient method to send the content of a file as a response.
# https://httpd.apache.org/docs/2.4/en/mod/core.html#enablemmap
EnableMMAP On
EnableSendfile Off
Mon Dec 1 21:08:20 2008] [warn-phpd] mmap cache can't open
/var/www/vhosts/domain.com/httpdocs/file.php - Permission denied (pid
7831)
It seems that mmap doesn't has the rights to open the file, check file's folder rights .
Check file's folder properties .
I am getting a 502 Bad Gateway from Nginx on a line of PHP code that is working fine in other places of my program ($this->provider = new OAuthProvider();), and that have worked fine before. This is the message I get in the Nginx error log for each 502:
recv() failed (104: Connection reset by peer) while reading response header from upstream
In the PHP-FPM log there is a warning for each 502:
[WARNING] [pool www] child 17427 exited on signal 11 SIGSEGV after 142070.657176 seconds from start
After trying a number of changes to the nginx.conf I am stuck and would very much appreciate any pointers of what to do next.
I'm running Nginx 0.7.67 and PHP 5.3.2 on Ubuntu 10.04.
maybe http://pecl.php.net/bugs/bug.php?id=17689 or bug id #18138
Your PHP process crashed with a segfault ("signal 11 SIGSEGV"), which caused Nginx to see "connection reset by peer" (PHP is the "peer" in this case, and Nginx is telling you "Look, he hung up on me before I could get an answer from him").
Check out the PHP Bug database page on how to report a bug someone will want to fix to find out how to get a backtrace of the segfault so you can report it.
i had the same problem with APC. so i removed it and installed eaccelerator instead. no problem so far.
I had similar problems with nginx/lighttpd + php-fcgi(using spawn-fcgi), do you use any opcode cache for php?
What i found quite some time ago is that xcache was causing strange behaviour in php-fcgi, some php-fcgi processes randomly died, i was unable to find any pattern. I would recommend to take a look at apc(or other opcode cache) settings, if you are using any.
Right now im using nginx + php-fpm on freebsd and have no problems.
ZendOptimizer + APC + php-fpm 5.2.14 gives constantly reproducible SIGSEGV even on phpinfo();.
Try to switch suhosin off. Sometimes it crashes Apache.