|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #19702 Internal Server Error on CGIs with mod_php4 enabled
Submitted: 2002-10-01 21:10 UTC Modified: 2002-10-16 09:42 UTC
Avg. Score:4.3 ± 0.9
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: steveneu at visi dot com Assigned:
Status: Closed Package: Apache related
PHP Version: 4.2.3 OS: FreeBSD 4.7
Private report: No CVE-ID: None
 [2002-10-01 21:10 UTC] steveneu at visi dot com
  I am unable to successfully execute any CGIs (PERL or C) while the PHP module is enabled. The CGI simply fails with an internal server error in the browser and premature end of script headers in the http error log. If I disable mod_php everything works fine.
  I am running apache 1.3.26 with mod_ssl (from the ports collection). 
  sidenote: I CAN run CGIs when I enable the fastcgi module but only GETs. POSTs return an internal server error/premature end of script headers. Weird, eh?


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2002-10-02 10:50 UTC]
Check your error_log.
 [2002-10-02 12:26 UTC] steveneu at visi dot com
All I get is:
[Wed Oct  2 12:16:04 2002] [error] [client] Premature end of script headers: /usr/local/share/nagios/cgi-bin//cmd.cgi
 in the http-error.log

If I remove mod_php from the httpd.conf it works fine.
Is there a way to get more info?
 [2002-10-14 14:41 UTC] fran at his dot com
Got the same problem after upgrading to mod_php 4.2.3
perl and shell scripts executed as cgi started giving error 500, despite they have been running fine before.
They were running fine from shell.
Disabling mod_php4 in apache httpd.conf restored the normal behavior.
We had to roll back the upgrade.
Please let us know when this will be fixed
Other info: FreeBSD 4.7, apache 1.3.27
Hope this helps others...
 [2002-10-14 18:50 UTC]
This is very likely a problem with your apache configure.
Try using the stock httpd.conf and add the correct PHP related lines.

 [2002-10-14 22:16 UTC] steveneu at visi dot com
I dunno... unless something changed in the syntax. 
My cgi's definitely worked before upgrading too. I was messing a cgi based monitoring tool (nagios) a few days before the upgrade. It worked and then it didn't. It took me a few days to notice but the only event between the "working" and "non-working" state was the upgrade.
 [2002-10-14 22:54 UTC]
Does any simple cgi scripts the apache
provided exampe printenv script?

 [2002-10-14 23:20 UTC] steveneu at visi dot com
nope, no cgi will work using mod_cgi. perl scripts if run via mod_perl work fine. cgi's via fastCGI kinda work... POSTs fail with an internal server error, GETs work fine
 [2002-10-14 23:57 UTC]
That simple 'printenv' script works (and has always worked) just fine here so I'm pretty sure your configuration is somewhat broken. 

I suggest you try with stock apache httpd.conf and then do a clean install of PHP.

(please add your configure line for PHP here btw)

 [2002-10-15 06:14 UTC] steveneu at visi dot com
Here's what I have in config.nice. I'm compiling from the ports collection so I actually pick the options from a dialog and freebsd's make actually does the "configure, make, make install"

'./configure' \
'--with-apxs=/usr/local/sbin/apxs' \
'--with-config-file-path=/usr/local/etc' \
'--enable-versioning' \
'--with-regex=system' \
'--without-gd' \
'--without-mysql' \
'--with-gd=/usr/local' \
'--enable-gd-native-ttf' \
'--with-freetype-dir=/usr/local' \
'--with-jpeg-dir=/usr/local' \
'--with-png-dir=/usr/local' \
'--with-zlib' \
'--with-mysql=/usr/local' \
'--with-ldap=/usr/local' \
'--enable-ftp' \
'--with-curl=/usr/local' \
'--with-gettext=/usr/local' \
'--with-pspell=/usr/local' \
'--with-mcal=/usr/local' \
'--prefix=/usr/local' \
 [2002-10-16 09:42 UTC] steveneu at visi dot com
I recompiled php4.2.3 manually with the configure options that I previously posted and I was able to run CGIs. There must be a problem with the FreeBSD port. I'll try to contact the port maintainer/ports mailing list and see what they have to say.
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Wed Jul 06 17:05:44 2022 UTC