I use shared hosting.
There is possible to find out whether PHP is running via fastCGI (or maybe CGI) or as Apache module mod_php
?
Is it possibly to find out by myself, without asking the hoster?
The configuration file for the CGI executable of PHP is located at /etc/php5/cgi/php. ini .
If the variable is present and correctly set to /phpinfo. php/foobar? foo=bar, then either ISAPI or FastCGI is used. Look near the top of the output for Server API; it should be set to either ISAPI (which means ISAPI is being used) or CGI/FastCGI (which means FastCGI is being used, since we already ruled out CGI).
a CGI script can be implemented also in PHP, but all PHP programs are not CGI scripts. If webserver has embedded PHP interpreter (e.g. mod_php in Apache), then the CGI phase is skipped by more efficient direct protocol between the web server and the interpreter.
That's the Server API row on top of phpinfo()'s output:
However, please note that it won't necessarily tell you the exact version of Apache or the exact CGI handler. It just describes the SAPI in use.
You can also call the php_sapi_name() function (or the PHP_SAPI constant, which provides the same info):
Description
string php_sapi_name ( void )
Returns a lowercase string that describes the type of interface (the Server API, SAPI) that PHP is using. For example, in CLI PHP this string will be "cli" whereas with Apache it may have several different values depending on the exact SAPI used
It's still a good idea to check your HSP's documentation because it possible to have several PHP versions available.
Remember you need to run phpinfo()
from the same environment you want to check (web server won't tell you about command line and vice-versa):
C:\>php -i | findstr /C:"Server API" Server API => Command Line Interface
$ php -i | grep 'Server API' Server API => Command Line Interface
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With