|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #19378 Parse error in PHP executable as Apache CGI
Submitted: 2002-09-12 13:45 UTC Modified: 2002-12-03 01:06 UTC
Avg. Score:5.0 ± 0.0
Reproduced:3 of 3 (100.0%)
Same Version:3 (100.0%)
Same OS:3 (100.0%)
From: ken at kyler dot com Assigned:
Status: Closed Package: Apache related
PHP Version: 4.2.3 OS: FreeBSD 4.5-STABLE
Private report: No CVE-ID: None
 [2002-09-12 13:45 UTC] ken at kyler dot com
PHP 4.2.3 compiled on a FreeBSD 4.5-STABLE box with the following options:
	--with-config-file-path=/usr/local/etc/php.standalone \
	--disable-pear \
	--enable-discard-path \
	--with-readline=/usr \
	--enable-versioning \
	--with-regex=system \
	--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 \
	--enable-trans-sid \

Apache is configured to use PHP as both a module (which works fine) and a CGI (see below)
        ## for mapserver & PHP as a CGI
        ScriptAlias /cgi/ /usr/local/share/apache/cgi/
        AddType application/x-httpd-php-cgi .phm
        Action application/x-httpd-php-cgi /cgi/php

When the following is opened in Apache, I get the following error "Parse error: parse error in /usr/local/share/apache/cgi/php on line 3713"

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">                                                    
<?php echo phpinfo();?>

I've gotten this error on 2 separate FreeBSD servers.  I use the PHP4 port in the lang ports collection.

PHP works fine from the commandline.  It just fails under apache.



Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2002-09-17 01:10 UTC] janus at area319 dot de
As usual, it seems that nobody is interessted in these problems with PHP as CGI, its the same like this: , its a general issue.
 [2002-10-24 15:35 UTC]
Please try using this CVS snapshot:
For Windows:

 [2002-10-24 19:27 UTC] ken at kyler dot com
Recompiled using the same script and now get the following when the page is shown in Apache.

Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

apache_error_log shows:

[Thu Oct 24 20:20:45 2002] [error] [client] Premature end of script headers: /www/

nothing else was changed.

 [2002-11-09 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over 2 weeks, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2002-11-10 19:07 UTC] ken at kyler dot com
I think the message "No feedback was provided for this bug for over 2 weeks,..." is absurd and may represent a bug in bug-track.  I provided the feedback as requested.
 [2002-12-03 01:06 UTC]
This bug has been fixed in CVS.

In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at
In case this was a documentation problem, the fix will show up soon at

In case this was a website problem, the change will show
up on the site and on the mirror sites in short time.
Thank you for the report, and for helping us make PHP better.

fixed in CVS as of today.
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Tue Jun 28 19:05:44 2022 UTC