How do I determine how our php files are being rendered in a simple LAMP configuration?

phpinfo shows:

-- Configure Command --

-- Server API --

-- cgi-fcgi --
Directive               Local Value Master Value
cgi.check_shebang_line  1  1
cgi.fix_pathinfo     1  1
cgi.force_redirect      1  1
cgi.nph                 0  0
cgi.redirect_status_env no value no value
cgi.rfc2616_headers     0  0
fastcgi.logging         1  1

The phpinfo should really give you all the infomration you require regarding your current PHP implementation. It provides you with the PHP interpreter running, it's configuration directives, as well as letting you know whether you're running in mod_php or a cgi based ( in your case cgi based via CGI/FastCGI ).

What sort of additional information are you currently looking to get ?


If you have shell access to the server (or can fake it) you may to be able to look at the apache config (or other httpd) or the process table (fcgid) for hints.

It's also possible that shell php (cli) and web php (cgi +) may not be the same version or using the same configuration.

Here's a note on cgi security: http://us.php.net/manual/pl/security.cgi-bin.php which has a comment which says: "NOTE: Running PHP as a CGI program will change the value of $_SERVER['SCRIPT_NAME']. When running via the (normal) mod_PHP mechanism, it will be set to the name of (actually, path to) the PHP script that's running. When running via CGI, it will instead point to the path of the CGI binary."

I suspected that there would be a clue in the runtime variables, so that's worth checking.

hth, adric

  • I have shell access and can see both the httpd.conf and php.ini files. Also have a page that shows me the output from phpinfo(). What do I need to look for? – Chris Williams Sep 10 '09 at 19:14
  • Look for "AddModule php" in httpd.conf – Josh Sep 21 '09 at 21:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.