|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #24864 Kludge Resolution
Submitted: 2003-07-30 01:18 UTC Modified: 2003-07-30 02:04 UTC
From: tom at minnesota dot com Assigned:
Status: Not a bug Package: CGI/CLI related
PHP Version: 4.3.2 OS: NetBSD/Alpha (64bit) - 1.6
Private report: No CVE-ID: None
 [2003-07-30 01:18 UTC] tom at minnesota dot com
When accessing a simple page with via the browser and php (cgi):


I get:

Warning: Unexpected character in input: ' in /usr/local_install/php-4-200307300130-cgi/bin/php on line 4819

Warning: Unexpected character in input: ' in /usr/local_install/php-4-200307300130-cgi/bin/php on line 4819

Warning: Unexpected character in input: ' in /usr/local_install/php-4-200307300130-cgi/bin/php on line 4819

Parse error: parse error in /usr/local_install/php-4-200307300130-cgi/bin/php on line 4819

Works fine with apache module and older 4.3.1 cgi.

Reproduce code:

Expected result:
Show the phpinfo page.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2003-07-30 01:21 UTC] tom at minnesota dot com
I should also note that accessing the phpinfo.phtml page via shell and php (cgi) directly works fine. It shows that error when accessing the script with php cgi through Apache.
 [2003-07-30 01:55 UTC] tom at minnesota dot com
If I change the php cgi file:

cat /usr/local/libexec/cgi-bin/php


Then now it displays the phpinfo page properly.

Some notes I found relating to this problem in previous PHP versions:

It appears that when Apache executes the RedHat php cgi it passes SCRIPT_FILENAME as /var/www/cgi-bin/php and PATH_TRANSLATED is the name of the php script /var/www/maplab/htdocs/index.phtml.  The php cgi on 
the other hand does not execute against PATH_TRANSLTED it executes against SCRIPT_FILENAME.  The result is if you use the RedHat Apache/Php-CGI in the default configuration, every time the Php CGI executes, it uses itself (a binary file) as the input file to translate.  And then it spews garbage because it is trying to parse a binary file.
 [2003-07-30 02:04 UTC]
Works fine here. Must be your configuration that is borked.
(httpd.conf / php.ini / configure options..)

 [2004-06-11 07:14 UTC] paul at boxedart dot com
Does the same thing to me also.  Using FC1 and Zeus web server.  Any ideas?
PHP Copyright © 2001-2018 The PHP Group
All rights reserved.
Last updated: Wed Dec 12 11:01:26 2018 UTC