php.net |  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
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: tom at minnesota dot com
New email:
PHP Version: OS:

 

 [2003-07-30 01:18 UTC] tom at minnesota dot com
Description:
------------
When accessing a simple page with via the browser and php (cgi):

<?php
phpinfo();
?>

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:
---------------
<?php
phpinfo();
?>


Expected result:
----------------
Show the phpinfo page.


Patches

Pull Requests

History

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

---
#!/bin/sh
export SCRIPT_FILENAME=$PATH_TRANSLATED
/usr/local_install/php-4-200307300130-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] sniper@php.net
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-2024 The PHP Group
All rights reserved.
Last updated: Fri Nov 22 04:01:28 2024 UTC