Compare operation modes of the PHP-scripts interpreter.
- PHP as Apache module
- PHP as CGI
- PHP as FastCGI
You can set up PHP operation mode for a web-site via Domains – WWW domains- Properties- PHP, if all these modes are allowed for a www-domain owner.
PHP
as Apache module
In this case, apache mod_php of the web server is used for PHP operation.
Benefits:
- The highest speed of scripts running in comparison with other methods.
- Simplicity of the operation as the server processes the scripts by itself.
- Single configuration file for all scripts (php.ini).
- You can set PHP configuration variables in the web-server configuration file or by means of .htaccess file.
Drawbacks:
- All the scripts are run with privileges that a web-server uses, thus if you need to add something to the directory, you should make it accessible for everybody.
- If you run third party applications by the scripts (e.g. mailing), it is impossible to identify the user who run the process.
- Web-sever is overloaded, apache that processes the scripts may return other statistic information too low.
- Errors in scripts may cause failure of the entire web-server.
PHP as CGI
In case of PHP as CGI, PHP scripts are run via its transfer to be executed directly to the PHP interpreter.
Benefits:
- All the scripts are run with user privileges – the owner of a www domain.
- Individual set up of PHP for each user.
- Operating memory is used less in comparison with the apache module.
- Errors in scripts do not cause failure of the web-server unlike in PHP as Apache module.
Drawbacks:
- Problems with authorization by means of PHP (by means of Header command) as some server variables are not transferred to php-script.
PHP as FastCGI
Apache mod_fastcgi is used. It transfers scripts to the PHP interpreter output.
Benefits:
- Due to caching of some intermediate data, the script is not interpreted every time when executing, and greater speed is achieved in comparison with PHP as CGI.
Drawbacks:
- Extra user’s process is stored in memory after the first appealing to the process.
Posted on January 29, 2010








