logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: Need help debugging PHP process termination / 500 errors
Author
JayEn84



Joined: 24 Sep 2014
Posts: 3
Location: Germany, Frankfurt

PostPosted: Thu 25 Sep '14 16:37    Post subject: Need help debugging PHP process termination / 500 errors Reply with quote

Hello Apache Lounge community,

I recently switched from XAMPP to a self-setup WAMP installation using Apache Lounge's 2.4.9 package in order to improve performance, to have more tweaking possibilities and to solve some problems that I was not able to solve in XAMPP (e.g. creating large PDF files using TCPDF) on my local Windows 7 development PC.
PHP is running as FCGI module, which I thought was a good idea to achieve good performance, but I am afraid I have messed up the configuration a bit. This is also why I post this into the third-party modules forum, but I am not 100% sure about the root of this problem.

What happens is that sometimes, PHP script requests do not seem to terminate(?), but I do neither know why, nor do I know what is happening. It probably has something to do with scripts that process kind of a larger amount of data.

For example, I had problems importing SQL queries into PHPMyAdmin using the file upload or using the direct SQL query textarea. What happened was that PHP was working for a short time (e.g. 2 seconds), but after that, the browser was still showing the "loading" animation. Finally, a 500 error was returned to the browser when the FcgidIOTimeout limit was hit, which is set to 60 seconds, although PHP's max_execution_time was set to 30 seconds.
Fortunately, I was able to fix this problem after setting PHP's post_max_size to 0, but I only found out about this by chance, because I did not know what the problem could be since the log files did not tell me anything.

Now, I still have got the same problem when trying to create some PDF files with wkhtmltopdf (http://wkhtmltopdf.org/) along with the PHP wrapper phpwkhtmltopdf (https://github.com/mikehaertl/phpwkhtmltopdf). While most PDF are being created flawlessly within about two seconds, some PDF files (e.g. those with nested tables or really long tables) also only return a 500 error when the FcgidIOTimeout limit is hit, although my PC only seems to work for 2-3 seconds and the PHP execution limit is still set to 30 seconds.

As far as I can tell, I had this issue with more scripts I currently cannot think of, and I am sure that the wkhtmltopdf tool is not the problem, because the same scripts using the same wkhtmltopdf version on our live server do not return errors.

My FCGI module settings are the following:

Code:

LoadModule fcgid_module modules/mod_fcgid.so

<IfModule fcgid_module>
FcgidInitialEnv PHPRC "c:/dev/prog/php"
FcgidInitialEnv PHP_FCGI_MAX_REQUESTS 5000000000
FcgidInitialEnv PHP_FCGI_CHILDREN 0
AddHandler fcgid-script .php
FcgidWrapper "c:/dev/prog/php/php-cgi.exe" .php
AddHandler fcgid-script .fcgid
FcgidConnectTimeout 60
MaxRequestLen 1073741824

MaxRequestsPerProcess 4000000000
FcgidMaxRequestsPerProcess 4000000000

ProcessLifeTime 0
FcgidProcessLifeTime 0
FcgidMinProcessesPerClass 0
FcgidMaxProcesses 400
IdleScanInterval 900000000000
IdleTimeout 60
FcgidIOTimeout 60

PHP_Fix_Pathinfo_Enable 1
</IfModule>


You can view my whole Apache configuration over here: http://apaste.info/aec

My PHP.ini can be found here: http://pastebin.com/M2phrK36

Apache's LogLevel is set to debug, but I am not sure if the logs are helpful in my case.

The following is logged when I run one of the scripts returning a 500 error:
Code:

[Thu Sep 25 16:30:57.851301 2014] [fcgid:debug] [pid 3720:tid 364] fcgid_pm_main.c(357): mod_fcgid: gracefully terminated 1 processes
[Thu Sep 25 16:31:03.851644 2014] [fcgid:warn] [pid 3720:tid 364] mod_fcgid: process 1444 graceful kill fail, sending SIGKILL
[Thu Sep 25 16:31:09.851988 2014] [fcgid:info] [pid 3720:tid 364] mod_fcgid: process c:/dev/prog/php/php-cgi.exe(1444) exit(communication error), return code 9


This is the log of an Apache restart:
Code:

[Thu Sep 25 16:34:53.686790 2014] [mpm_winnt:notice] [pid 6716:tid 496] AH00422: Parent: Received shutdown signal -- Shutting down the server.
[Thu Sep 25 16:34:53.687790 2014] [mpm_winnt:debug] [pid 3720:tid 372] child.c(1132): AH00357: Child: Exit event signaled. Child process is ending.
[Thu Sep 25 16:34:53.687790 2014] [mpm_winnt:debug] [pid 3720:tid 948] child.c(731): AH00348: Child: Accept thread exiting.
[Thu Sep 25 16:34:53.687790 2014] [mpm_winnt:debug] [pid 3720:tid 944] child.c(731): AH00348: Child: Accept thread exiting.
[Thu Sep 25 16:34:54.687847 2014] [mpm_winnt:debug] [pid 3720:tid 372] child.c(1189): AH00359: Child: Released the start mutex
[Thu Sep 25 16:34:54.687847 2014] [mpm_winnt:debug] [pid 3720:tid 372] child.c(1201): AH00361: Child: 64 threads blocked on the completion port
[Thu Sep 25 16:34:55.687905 2014] [mpm_winnt:notice] [pid 3720:tid 372] AH00364: Child: All worker threads have exited.
[Thu Sep 25 16:34:55.687905 2014] [mpm_winnt:debug] [pid 3720:tid 372] mpm_winnt.c(1713): AH00454: Child process is exiting
[Thu Sep 25 16:35:04.055383 2014] [fcgid:error] [pid 3720:tid 364] FastCGI process 3764 still did not exit, terminating forcefully
[Thu Sep 25 16:35:05.055440 2014] [fcgid:info] [pid 3720:tid 364] mod_fcgid: process c:/dev/prog/php/php-cgi.exe(3764) exit(shutting down), return code 9
[Thu Sep 25 16:35:05.061441 2014] [mpm_winnt:notice] [pid 6716:tid 496] AH00430: Parent: Child process 3720 exited successfully.
[Thu Sep 25 16:35:05.061441 2014] [core:info] [pid 6716:tid 496] AH00096: removed PID file C:/dev/prog/apache/logs/httpd.pid (pid=6716)
[Thu Sep 25 16:35:06.428519 2014] [mpm_winnt:notice] [pid 6588:tid 496] AH00455: Apache/2.4.9 (Win32) mod_fcgid/2.3.9 configured -- resuming normal operations
[Thu Sep 25 16:35:06.428519 2014] [mpm_winnt:notice] [pid 6588:tid 496] AH00456: Apache Lounge VC11 Server built: Mar 16 2014 12:13:13
[Thu Sep 25 16:35:06.428519 2014] [core:notice] [pid 6588:tid 496] AH00094: Command line: 'c:\\dev\\prog\\apache\\bin\\httpd.exe -d C:/dev/prog/apache'
[Thu Sep 25 16:35:06.429519 2014] [mpm_winnt:notice] [pid 6588:tid 496] AH00418: Parent: Created child process 6152
[Thu Sep 25 16:35:06.429519 2014] [mpm_winnt:debug] [pid 6588:tid 496] mpm_winnt.c(422): AH00402: Parent: Sent the scoreboard to the child
[Thu Sep 25 16:35:06.736537 2014] [mpm_winnt:debug] [pid 6152:tid 376] mpm_winnt.c(1708): AH00453: Child process is running
[Thu Sep 25 16:35:06.736537 2014] [mpm_winnt:debug] [pid 6152:tid 376] mpm_winnt.c(343): AH00391: Child: Retrieved our scoreboard from the parent.
[Thu Sep 25 16:35:06.737537 2014] [mpm_winnt:debug] [pid 6152:tid 376] mpm_winnt.c(458): AH00403: Child: Waiting for data for listening socket 0.0.0.0:80
[Thu Sep 25 16:35:06.737537 2014] [mpm_winnt:debug] [pid 6588:tid 496] mpm_winnt.c(505): AH00408: Parent: Duplicating socket 292 (0.0.0.0:80) and sending it to child process 6152
[Thu Sep 25 16:35:06.737537 2014] [mpm_winnt:debug] [pid 6588:tid 496] mpm_winnt.c(505): AH00408: Parent: Duplicating socket 284 ([::]:80) and sending it to child process 6152
[Thu Sep 25 16:35:06.737537 2014] [mpm_winnt:debug] [pid 6588:tid 496] mpm_winnt.c(524): AH00411: Parent: Sent 2 listeners to child 6152
[Thu Sep 25 16:35:06.738537 2014] [mpm_winnt:debug] [pid 6152:tid 376] mpm_winnt.c(458): AH00403: Child: Waiting for data for listening socket [::]:80
[Thu Sep 25 16:35:06.738537 2014] [mpm_winnt:debug] [pid 6152:tid 376] mpm_winnt.c(483): AH00407: Child: retrieved 2 listeners from parent
[Thu Sep 25 16:35:06.738537 2014] [mpm_winnt:debug] [pid 6152:tid 376] child.c(1009): AH00352: Child: Acquired the start mutex.
[Thu Sep 25 16:35:06.738537 2014] [mpm_winnt:notice] [pid 6152:tid 376] AH00354: Child: Starting 64 worker threads.
[Thu Sep 25 16:35:06.739537 2014] [mpm_winnt:debug] [pid 6152:tid 928] child.c(399): AH00334: Child: Accept thread listening on 0.0.0.0:80 using AcceptFilter data
[Thu Sep 25 16:35:06.739537 2014] [mpm_winnt:debug] [pid 6152:tid 956] child.c(399): AH00334: Child: Accept thread listening on [::]:80 using AcceptFilter data


Any help on this problem is gladly appreciated since I was not able to solve it on my own trying out dozens of different config settings and reading on hundreds of websites...
Thank you very much in advance!
Back to top
JayEn84



Joined: 24 Sep 2014
Posts: 3
Location: Germany, Frankfurt

PostPosted: Mon 29 Sep '14 11:17    Post subject: Reply with quote

Minor update: Using WinCache and the FCGI config as dscribed on http://www.apachelounge.com/viewtopic.php?t=5191 did not help.
Back to top
JayEn84



Joined: 24 Sep 2014
Posts: 3
Location: Germany, Frankfurt

PostPosted: Tue 30 Sep '14 9:30    Post subject: Reply with quote

Another update: Creating long PDF files using TCPDF only returns a 500 error, too. Since TCPDF is based on FPDF, which is a pure PHP library, I think that my Apache/PHP setup is corrupt rather than the wkhtmltopdf implementation. Therefore, I think this forum topic should be moved back to the third party modules.

Admin note: Moved to Apache, mod_fcgid is nowadays part of Apache and not third party
Back to top


Reply to topic   Topic: Need help debugging PHP process termination / 500 errors View previous topic :: View next topic
Post new topic   Forum Index -> Apache