Forum Moderators: coopster

Message Too Old, No Replies

How to tell if php run as CGI?

         

ebizcamp

10:28 am on Nov 8, 2004 (gmt 0)

10+ Year Member



In httpd.conf file, whenever I try to add the following line:

LoadModule php4_module modules/libphp4.so

and then restart apache, I get an error:

[warn] module php4_module is already loaded, skipping

If I do not include this line in the httpd.conf file, php still works correctly.

I have a website which all URL are in this format

mysite/index.php/title

When I try to remove the extension, I create this .htaccess file and rename the original index.php to index:

<Files index>
AcceptPathInfo on
SetOutputFilter PHP
SetInputFilter PHP
</Files>

But it does not work. All php file (here the index) are parsed as text file, not executed ( I have set it to 755)

However,after following the instruction from the vendor, it works. The vendor says:

"If your Host/server runs PHP as a CGI process (as opposed to a web server module) you may need to use this code:

<Files index>
SetHandler application/x-httpd-php
</Files>"

I am confused. How to tell if my php is running as CGI or module? How to set it to run as module?

Thanks

coopster

5:41 pm on Nov 8, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Did you build (compile) PHP yourself, and if so, did you compile it with CGI support?


How to tell if my php is running as CGI or module?

Create and run this script...

<?php 
print php_sapi_name() [php.net];
?>

ebizcamp

6:11 am on Nov 9, 2004 (gmt 0)

10+ Year Member



I am using fedora 1. The output of the php script is apache2handler. It should be Apache module mode, am I right?

ebizcamp

6:12 am on Nov 9, 2004 (gmt 0)

10+ Year Member



I use php RPM package preinstalled by Redhat

coopster

11:40 am on Nov 9, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



According to the PHP manual page in the link there, I'd say yes, you are running in module mode...


php_sapi_name() [php.net] returns a lowercase string which describes the type of interface between web server and PHP (Server API, SAPI). In CGI PHP, this string is "cgi", in mod_php for Apache, this string is "apache" and so on.

ebizcamp

8:57 pm on Nov 9, 2004 (gmt 0)

10+ Year Member



coopster, Thank you!