Author |
|
gijs
Joined: 27 Apr 2012 Posts: 189 Location: The Netherlands
|
Posted: Wed 30 Jul '14 20:20 Post subject: Problem with PHP/FCGID |
|
|
I've updated to Apache 2.4.10 from 2.4.9 and all of a sudden my pages don't load anymore.
Previously I had this issue rarely and closing the PHP-cgi.exe processes fixed it.
But since the update the issue happens almost constantly.
This is how my config looks:
Code: | <IfModule mod_fcgid.c>
# Where to look for the php.ini file?
FcgidInitialEnv SystemRoot "C:/Windows"
FcgidInitialEnv SystemDrive "C:"
FcgidInitialEnv TEMP "C:/WINDOWS/Temp"
FcgidInitialEnv TMP "C:/WINDOWS/Temp"
FcgidInitialEnv windir "C:/WINDOWS"
# Set PHP_FCGI_MAX_REQUESTS to greater than or equal to FcgidMaxRequestsPerProcess
# to prevent php-cgi process from exiting before all requests completed
FcgidInitialEnv PHP_FCGI_MAX_REQUESTS 1500
# Maximum requests a process should handle before it is terminated
FcgidMaxRequestsPerProcess 0
# Maximum number of PHP processes
FcgidMaxProcesses 300
FcgidMaxRequestInMem 268435456
FcgidOutputBufferSize 268435456
FcgidProcessLifeTime 43200
FcgidMinProcessesPerClass 300
FcgidMaxRequestLen 1073741824
FcgidProcessLifeTime 10800
FcgidZombieScanInterval 20
FcgidTimeScore 3
# Number of seconds of idle time before a php-cgi process is terminated
FcgidIdleTimeout 0
FcgidIOTimeout 40
FcgidConnectTimeout 16
<Files ~ "\.php$">
Options Indexes FollowSymLinks ExecCGI
AddHandler fcgid-script .php
FcgidWrapper "C:/Progra~2/php/php-cgi.exe" .php
</Files>
</IfModule> |
|
|
Back to top |
|
gijs
Joined: 27 Apr 2012 Posts: 189 Location: The Netherlands
|
Posted: Thu 31 Jul '14 13:18 Post subject: |
|
|
I don't see any errors in the errors logs.. |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7371 Location: Germany, Next to Hamburg
|
Posted: Fri 01 Aug '14 14:26 Post subject: Re: Problem with PHP/FCGID |
|
|
gijs wrote: | all of a sudden my pages don't load anymore.
|
Does static stuff load? Just PHP pages? Blank pages? Can you see the source code in the browser? |
|
Back to top |
|
gijs
Joined: 27 Apr 2012 Posts: 189 Location: The Netherlands
|
Posted: Fri 01 Aug '14 20:01 Post subject: |
|
|
The PHP pages show as blank, static stuff loads fine. |
|
Back to top |
|
gijs
Joined: 27 Apr 2012 Posts: 189 Location: The Netherlands
|
Posted: Sat 02 Aug '14 15:36 Post subject: |
|
|
Actually that was wrong, the page takes forever to load and when it finally loads it gives a 500 server error. |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7371 Location: Germany, Next to Hamburg
|
Posted: Tue 05 Aug '14 12:34 Post subject: |
|
|
Windows event log? PHP error log? |
|
Back to top |
|
gijs
Joined: 27 Apr 2012 Posts: 189 Location: The Netherlands
|
Posted: Tue 05 Aug '14 14:31 Post subject: |
|
|
I got the following error in the Windows eventlog:
Code: | Faulting application name: httpd.exe, version: 2.4.10.0, time stamp: 0x53c7aae5
Faulting module name: unknown, version: 0.0.0.0, time stamp: 0x00000000
Exception code: 0xc0000005
Fault offset: 0x00000056d6ab0f5c
Faulting process id: 0x2728
Faulting application start time: 0x01cfae590a969cc2
Faulting application path: C:\Program Files\Apache Software Foundation\Apache24\bin\httpd.exe
Faulting module path: unknown
Report Id: 497bed0c-1a4c-11e4-80c1-e83935f0c04c
Faulting package full name:
Faulting package-relative application ID: |
|
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7371 Location: Germany, Next to Hamburg
|
Posted: Tue 05 Aug '14 15:03 Post subject: |
|
|
So apache is crashing even using mod_fcgid. I had those problems one some on my windows servers. using the thread safe version solved it for me.
The other thing is enabling display_startup_errors = On to see if a PHP extension is faulty.
Also use
log_errors = On
error_log = C:\Users\james\work\php_errors.log |
|
Back to top |
|
gijs
Joined: 27 Apr 2012 Posts: 189 Location: The Netherlands
|
Posted: Tue 05 Aug '14 15:38 Post subject: |
|
|
Strange it happens on both of my Windows Server 2012 R2 servers..
I didn't change anything to PHP, I only updated Apache from 2.4.9. to 2.4.10..
Update: now I get: Error displaying the error page: Application Instantiation Error: The MySQL adapter mysqli is not available
Although it is enabled in PHP..
Update 2: forgot to put " " around the path for the log file.
Now it gets stuck on loading again.
No PHP error log is created.[/quote]
Last edited by gijs on Tue 05 Aug '14 15:52; edited 1 time in total |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7371 Location: Germany, Next to Hamburg
|
Posted: Tue 05 Aug '14 15:52 Post subject: |
|
|
please try a small test script on the command line with php-cgi.exe until you know how to fix that.
I noticed that you don't use FcgidInitialEnv PHPRC
Are you sure PHP reads the correct ini? |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7371 Location: Germany, Next to Hamburg
|
Posted: Tue 05 Aug '14 15:57 Post subject: |
|
|
gijs wrote: |
Update 2: forgot to put " " around the path for the log file.
Now it gets stuck on loading again.
No PHP error log is created. | [/quote]
Quotes are only needed if you have white space in the path |
|
Back to top |
|
gijs
Joined: 27 Apr 2012 Posts: 189 Location: The Netherlands
|
Posted: Tue 05 Aug '14 16:00 Post subject: |
|
|
its still not loading / it keeps waiting for a reply from the server...
I've added the value FcgidInitialEnv PHPRC as you said but it doesn't make a difference.
The PHP error log is not being created when I try to load my website..
Event log is still coming up with:
Faulting application name: httpd.exe, version: 2.4.10.0, time stamp: 0x53c7aae5
Faulting module name: unknown, version: 0.0.0.0, time stamp: 0x00000000
Exception code: 0xc0000005
Fault offset: 0x0000008d39a20ddc
Faulting process id: 0x2700
Faulting application start time: 0x01cfb0b5dcfa7c5a
Faulting application path: C:\Program Files\Apache Software Foundation\Apache24\bin\httpd.exe
Faulting module path: unknown
Report Id: 3c2c695d-1ca9-11e4-80c1-e83935f0c04c
Faulting package full name:
Faulting package-relative application ID: |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7371 Location: Germany, Next to Hamburg
|
Posted: Tue 05 Aug '14 16:05 Post subject: |
|
|
Which PHP version do you use?
by the way: my working vhost config with 2.4.10 and PHP 5.5.14 TS http://pastebin.com/z7i6EsbF |
|
Back to top |
|
gijs
Joined: 27 Apr 2012 Posts: 189 Location: The Netherlands
|
Posted: Tue 05 Aug '14 16:10 Post subject: |
|
|
I'm using PHP 5.5.15 NTS vc11
I just noticed that after removing:
SecRuleEngine On
SecDefaultAction "deny,phase:2,status:403"
<IfModule security2_module>
SecDataDir C:/WINDOWS/Temp
Include conf/crs/modsecurity_crs_10_setup.conf
Include conf/crs/activated_rules/*.conf
</IfModule>
Everything is working fine.
So I guess mod security needs to be updated to work with the new Apache version.
Last edited by gijs on Tue 05 Aug '14 16:12; edited 1 time in total |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7371 Location: Germany, Next to Hamburg
|
Posted: Tue 05 Aug '14 16:12 Post subject: |
|
|
Please try the thread safe version. |
|
Back to top |
|
gijs
Joined: 27 Apr 2012 Posts: 189 Location: The Netherlands
|
Posted: Tue 05 Aug '14 16:16 Post subject: |
|
|
After disabling mod security its working fine.
But it seems to ignore this part of my .htaccess:
<Files ~ "\.php$">
Options Indexes FollowSymLinks ExecCGI
AddHandler fcgid-script .php
FcgidWrapper "C:/Progra~2/PHP54/php-cgi.exe" .php
</Files>
Which I have in a subdirectory of my website so that it uses PHP 5.4 instead of 5.5.
Update: the issue with PHP was caused by the FcgidInitialEnv PHPRC
I removed that and everything is working fine now, just need to resolve the problem with mod security. |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7371 Location: Germany, Next to Hamburg
|
Posted: Tue 05 Aug '14 20:59 Post subject: |
|
|
gijs wrote: |
Update: the issue with PHP was caused by the FcgidInitialEnv PHPRC
I removed that and everything is working fine now, just need to resolve the problem with mod security. |
I wonder! Cause in your original config that was missing! |
|
Back to top |
|
gijs
Joined: 27 Apr 2012 Posts: 189 Location: The Netherlands
|
Posted: Tue 05 Aug '14 23:38 Post subject: |
|
|
James Blond wrote: | gijs wrote: |
Update: the issue with PHP was caused by the FcgidInitialEnv PHPRC
I removed that and everything is working fine now, just need to resolve the problem with mod security. |
I wonder! Cause in your original config that was missing! |
Yes, once its added it loads the same PHP ini for both. So it didn't load the correct modules for the directory with the different PHP version and ini. |
|
Back to top |
|