| Author |  | 
| padre 
 
 
 Joined: 20 Feb 2008
 Posts: 7
 
 
 | 
|  Posted: Wed 20 Feb '08 1:18    Post subject: PHP :: 500 Internal Server Error |   |  
| 
 |  
| Hi guys! 
 I have Apache server on WinXP machine, and I have a very odd problem with it:
 
 My server was running for a couple of years and all works fine but 2 weeks ago Apache starts generate “HTTP/1.0 500 Internal Server Error” on any PHP errors. Pages without php errors are working fine.
 
 PHP works fine by itself. When I’m trying to run any script with errors in console, PHP displays all errors correctly.
 
 But when I’m trying to run it through Apache, it doesn’t display anything and get me following response:
 
  	  | Quote: |  	  | HTTP/1.0 500 Internal Server Error Date: Tue, 19 Feb 2008 23:07:57 GMT
 Server: Apache/2.2.6 (Win32) PHP/5.2.4
 X-Powered-By: PHP/5.2.4
 | 
 
 And nothing else!
 
 I was trying to make it write errors in log file (error_log = "C:\PHP\error.log" in PHP.INI) – the same thing!
 If I run script from console, errors has been written in the log file.  If I run scripts from Apache, nothing has been written at all.
 
 I’ve checked apache log files – nothing useful, only lines like this one:
 
  	  | Quote: |  	  | 127.0.0.30 - - [20/Feb/2008:02:07:57 +0300] "GET / HTTP/1.0" 500 – | 
 
 I was trying to uninstall Apache and PHP, trying to install various combination on Apache, Apache2, Apache2.2, PHP4 and PHP5 – the same thing.
 
 I’ve already  spent a week on this problem
      , have you any ideas? 
 PS. Sorry for my English.
 |  | 
| Back to top |  | 
| James Blond Moderator
 
  
 Joined: 19 Jan 2006
 Posts: 7442
 Location: EU, Germany, Next to Hamburg
 
 | 
|  Posted: Wed 20 Feb '08 10:39    Post subject: |   |  
| 
 |  
| How did you setup PHP in your httpd.conf? Which version of PHP and Apache do you use? |  | 
| Back to top |  | 
| bentogoa 
 
  
 Joined: 09 Feb 2007
 Posts: 66
 Location: GOA
 
 | 
|  Posted: Wed 20 Feb '08 12:35    Post subject: |   |  
| 
 |  
| set the error logging to debug in apache, then check error.log in apache\logs\ folder |  | 
| Back to top |  | 
| padre 
 
 
 Joined: 20 Feb 2008
 Posts: 7
 
 
 | 
|  Posted: Wed 20 Feb '08 13:02    Post subject: |   |  
| 
 |  
|  	  | James Blond wrote: |  	  | How did you setup PHP in your httpd.conf? Which version of PHP and Apache do you use? | 
 
 Apache 2.2.6 and PHP 5.2.4, but I've tryied various combinations of Apache/PHP versions.
 
 This is PHP setup lines from my httpd.conf:
 
  	  | Quote: |  	  | LoadModule php5_module "C:/PHP/php5apache2_2.dll" AddType application/x-httpd-php .php .html
 ScriptAlias /PHP/ "c:/PHP/"
 AddType application/x-httpd-php .php
 Action application/x-httpd-php "/php/php.exe"
 PHPIniDir "C:/PHP/"
 | 
 |  | 
| Back to top |  | 
| padre 
 
 
 Joined: 20 Feb 2008
 Posts: 7
 
 
 | 
|  Posted: Wed 20 Feb '08 13:09    Post subject: |   |  
| 
 |  
|  	  | bentogoa wrote: |  	  | set the error logging to debug in apache, then check error.log in apache\logs\ folder | 
 
 I've tryied to set loglevel to debug, but when I run PHP script with errors, nothing has been written to apache\logs\error.log
 
 This is what I get there, when Apache started:
 
 
  	  | Quote: |  	  | [Wed Feb 20 14:03:34 2008] [notice] Parent: Received shutdown signal -- Shutting down the server. [Wed Feb 20 14:03:34 2008] [notice] Child 2364: Exit event signaled. Child process is ending.
 [Wed Feb 20 14:03:35 2008] [info] Child 2364: Accept thread exiting.
 [Wed Feb 20 14:03:35 2008] [notice] Child 2364: Released the start mutex
 [Wed Feb 20 14:03:35 2008] [info] Child 2364: 250 threads blocked on the completion port
 [Wed Feb 20 14:03:36 2008] [notice] Child 2364: Waiting for 250 worker threads to exit.
 [Wed Feb 20 14:03:36 2008] [notice] Child 2364: All worker threads have exited.
 [Wed Feb 20 14:03:36 2008] [notice] Child 2364: Child process is exiting
 [Wed Feb 20 14:03:36 2008] [notice] Parent: Child process exited successfully.
 [Wed Feb 20 14:03:36 2008] [info] removed PID file C:/Program Files/Apache Software Foundation/Apache2.2/logs/httpd.pid (pid=412)
 [Wed Feb 20 14:03:49 2008] [notice] Apache/2.2.6 (Win32) PHP/5.2.4 configured -- resuming normal operations
 [Wed Feb 20 14:03:49 2008] [notice] Server built: Sep  5 2007 08:58:56
 [Wed Feb 20 14:03:49 2008] [notice] Parent: Created child process 2872
 [Wed Feb 20 14:03:49 2008] [debug] mpm_winnt.c(487): Parent: Sent the scoreboard to the child
 [Wed Feb 20 14:03:51 2008] [notice] Child 2872: Child process is running
 [Wed Feb 20 14:03:51 2008] [info] Parent: Duplicating socket 212 and sending it to child process 2872
 [Wed Feb 20 14:03:51 2008] [debug] mpm_winnt.c(605): Parent: Sent 1 listeners to child 2872
 [Wed Feb 20 14:03:51 2008] [debug] mpm_winnt.c(408): Child 2872: Retrieved our scoreboard from the parent.
 [Wed Feb 20 14:03:51 2008] [debug] mpm_winnt.c(564): Child 2872: retrieved 1 listeners from parent
 [Wed Feb 20 14:03:51 2008] [notice] Child 2872: Acquired the start mutex.
 [Wed Feb 20 14:03:51 2008] [notice] Child 2872: Starting 250 worker threads.
 [Wed Feb 20 14:03:51 2008] [notice] Child 2872: Starting thread to listen on port 80.
 | 
 |  | 
| Back to top |  | 
| James Blond Moderator
 
  
 Joined: 19 Jan 2006
 Posts: 7442
 Location: EU, Germany, Next to Hamburg
 
 | 
|  Posted: Wed 20 Feb '08 13:13    Post subject: |   |  
| 
 |  
| The error is using php.exe! You should use php-cgi.exe Also you added two times the php extension. To the module and the cgi.
 
 You also can setup PHP as F(ast)CGI which is much faster.
 |  | 
| Back to top |  | 
| padre 
 
 
 Joined: 20 Feb 2008
 Posts: 7
 
 
 | 
|  Posted: Wed 20 Feb '08 13:44    Post subject: |   |  
| 
 |  
|  	  | James Blond wrote: |  	  | The error is using php.exe! You should use php-cgi.exe Also you added two times the php extension. To the module and the cgi.
 
 You also can setup PHP as F(ast)CGI which is much faster.
 | 
 
 I've tryied
 
  	  | Quote: |  	  | LoadModule php5_module "C:/PHP/php5apache2_2.dll" AddType application/x-httpd-php .php .html
 Action application/x-httpd-php "/php/php-cgi.exe"
 PHPIniDir "C:/PHP/"
 | 
 
 as well as with fast_cgi
 
 
  	  | Quote: |  	  | LoadModule fastcgi_module modules/mod_fastcgi.dll 
 <IfModule mod_fcgid.c>
 
 IPCCommTimeout 40
 IPCConnectTimeout 10
 MaxProcessCount 8
 OutputBufferSize 64
 ProcessLifeTime 240
 MaxRequestsPerProcess 500
 
 <Directory />
 AddHandler fcgid-script .fcgi
 Options Indexes FollowSymLinks ExecCGI
 FCGIWrapper "C:/PHP/php-cgi.exe" .fcgi
 AllowOverride all
 Order allow,deny
 Allow from all
 Satisfy any
 </Directory>
 
 </IfModule>
 
 LoadModule php5_module "C:/PHP/php5apache2_2.dll"
 AddType application/x-httpd-php .php .html
 #ScriptAlias /PHP/ "c:/PHP/"
 #Action application/x-httpd-php "/php/php-cgi.exe"
 PHPIniDir "C:/PHP/"
 | 
 
 absolutely the same thing
  |  | 
| Back to top |  | 
| bentogoa 
 
  
 Joined: 09 Feb 2007
 Posts: 66
 Location: GOA
 
 | 
|  Posted: Wed 20 Feb '08 19:19    Post subject: |   |  
| 
 |  
| try removing line 	  | Code: |  	  | FCGIWrapper "C:/PHP/php-cgi.exe" .fcgi | 
 |  | 
| Back to top |  | 
| padre 
 
 
 Joined: 20 Feb 2008
 Posts: 7
 
 
 | 
|  Posted: Wed 20 Feb '08 19:38    Post subject: |   |  
| 
 |  
|  	  | bentogoa wrote: |  	  | try removing line 	  | Code: |  	  | FCGIWrapper "C:/PHP/php-cgi.exe" .fcgi | 
 | 
 
 Tryied this. The problem still remains
  |  | 
| Back to top |  | 
| James Blond Moderator
 
  
 Joined: 19 Jan 2006
 Posts: 7442
 Location: EU, Germany, Next to Hamburg
 
 | 
|  Posted: Thu 21 Feb '08 10:34    Post subject: |   |  
| 
 |  
| Without CGI set 
 
  	  | Code: |  	  | PHPIniDir "C:/php"
 LoadModule php5_module "C:/php/php5apache2_2.dll"
 AddType application/x-httpd-php .php
 AddType application/x-httpd-php-source .phps
 
 | 
 |  | 
| Back to top |  | 
| padre 
 
 
 Joined: 20 Feb 2008
 Posts: 7
 
 
 | 
|  Posted: Thu 21 Feb '08 13:49    Post subject: |   |  
| 
 |  
|  	  | James Blond wrote: |  	  | Without CGI set 
 
  	  | Code: |  	  | PHPIniDir "C:/php"
 LoadModule php5_module "C:/php/php5apache2_2.dll"
 AddType application/x-httpd-php .php
 AddType application/x-httpd-php-source .phps
 
 | 
 | 
 
 I've tryied that all - nothings help. Moreover, I've tryied my http.conf on another machine and all works fine.
 
 I think the problem is somewhere deeper in my system. But I have no any ideas where.
 |  | 
| Back to top |  | 
| James Blond Moderator
 
  
 Joined: 19 Jan 2006
 Posts: 7442
 Location: EU, Germany, Next to Hamburg
 
 | 
|  Posted: Thu 21 Feb '08 15:20    Post subject: |   |  
| 
 |  
| If you disable PHP does apache run than? Or is it a different problem? |  | 
| Back to top |  | 
| padre 
 
 
 Joined: 20 Feb 2008
 Posts: 7
 
 
 | 
|  Posted: Thu 21 Feb '08 15:52    Post subject: |   |  
| 
 |  
|  	  | James Blond wrote: |  	  | If you disable PHP does apache run than? Or is it a different problem? | 
 
 Yes.
 
 The problem is I cannot to do any debugging on this server because I cannot see PHP errors at all.
 
 It is still possible to run PHP scripts through command line, but sometime it is not appropriate solution.
 
 PHP scripts work fine but when I try to run script with any error, Apache just generate 500 internal serrver error without any output.
 |  | 
| Back to top |  |