Google Answers Logo
View Question
 
Q: PHP PATH_ variable problems with Lighttpd... ( No Answer,   4 Comments )
Question  
Subject: PHP PATH_ variable problems with Lighttpd...
Category: Computers > Programming
Asked by: aaugustj-ga
List Price: $25.00
Posted: 10 Aug 2006 14:10 PDT
Expires: 09 Sep 2006 14:10 PDT
Question ID: 754764
In the course of playing with my new Lighttpd
server, I ran into a problem with the PHP_SELF, PATH_INFO, and 
ORIG_PATH_INFO variables - specifically, Lighty doesn't provide them to 
my PHP install.

Even after applying all the fixes I could find:

Adding "broken-scriptfilename" => "enable" to my PHP config in 
lighttpd.conf

Set cgi.fix_pathinfo = 1 in /etc/php4/cgi/php.ini

Compiled PHP4 with ./configure --enable-fastcgi --with-ldap --enable-ftp 
--with-mysql --enable-force-redirect --enable-discard-path

Nothing works. A successful answer is one which, when applied to the
webserver hosting this, causes the PATH_INFO and related variables to
be filled correctly.

Below is some partial relevant output from my php and
lighttpd config:
From phpinfo():
Configure Command 	 './configure' '--enable-fastcgi' '--enable-ftp'
        '--with-mysql' '--enable-force-redirect' '--enable-discard-path'
...

_SERVER["SCRIPT_NAME"]	/test/info.php
_SERVER["PATH_INFO"]	no value
_SERVER["SCRIPT_FILENAME"]	/var/www/test/info.php
_SERVER["DOCUMENT_ROOT"]	/var/www/
_SERVER["REQUEST_URI"]	/test/info.php
_SERVER["QUERY_STRING"]	no value

From lighttpd.conf:
fastcgi.server = ( ".php" => ((
                     "bin-path" => "/usr/local/bin/php",
                     "socket" => "/tmp/php4.socket",
                     "broken-scriptfilename" => "enable"
                 )
        )
)
Answer  
There is no answer at this time.

Comments  
Subject: Re: PHP PATH_ variable problems with Lighttpd...
From: nostgard-ga on 16 Aug 2006 11:50 PDT
 
Neither of my installs of Lighttpd set this variable correctly.

However, you can generate it yourself with:
$_SERVER['PATH_INFO'] = substr( $_SERVER['REQUEST_URI'], strlen(
$_SERVER['SCRIPT_NAME'] ) );

Assuming, of course, that Lighty is settings REQUEST_URI and
SCRIPT_NAME correctly on your install.
Subject: Re: PHP PATH_ variable problems with Lighttpd...
From: nostgard-ga on 16 Aug 2006 11:51 PDT
 
And I just noticed that your post shows that REQUEST_URI is NOT being
generated correctly. What URL were you actually accessing when it
generated the REQUEST_URI shown in your post?
Subject: Re: PHP PATH_ variable problems with Lighttpd...
From: aaugustj-ga on 16 Aug 2006 13:03 PDT
 
I've now posted a bug report to lighttpd.net:
http://trac.lighttpd.net/trac/ticket/811
Subject: Re: PHP PATH_ variable problems with Lighttpd...
From: nostgard-ga on 18 Aug 2006 11:42 PDT
 
To fix it, add this to your FastCGI configuration for a host:

"bin-copy-environment" => (
    "PATH", "SHELL", "USER"
),
"broken-scriptfilename" => "enable"

For more information, see:
http://trac.lighttpd.net/trac/wiki/TutorialLighttpdAndPHP

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy