no way to compare when less than two revisions

Differences

This shows you the differences between two versions of the page.


php_cgi [2014/10/10 22:32] (current) – created - external edit 127.0.0.1
Line 1: Line 1:
 +====== PHP CGI ======
  
 +  * [[Apache]]
 +  * [[Apache fcgid]]
 +  * [[Apache suExec]]
 +  * [[Apache Worker MPM PHP CGI Suexec Setup]]
 +  * [[PHP]]
 +
 +  * [[http://www.php.net/manual/en/install.unix.commandline.php|CGI and command line setups]]
 +  * [[http://www.php.net/manual/en/security.cgi-bin.php|PHP CGI Security Considerations]]
 +  * [[http://httpd.apache.org/mod_fcgid/mod/mod_fcgid.html|Apache mod_fcgid]]
 +  * [[http://httpd.apache.org/docs/trunk/howto/cgi.html|Apache Tutorial: Dynamic Content with CGI]]
 +  * [[http://www.cyberciti.biz/tips/rhel-centos-fedora-apache2-fastcgi-php-configuration.html|Red Hat / CentOS Apache 2 FastCGI PHP Configuration]]
 +
 +=== Gentoo ===
 +
 +Install apache with threads, mpm worker, plus mod_fcgid package and add -D FCGID to apache2 conf.
 +
 +In the Directory configuration of every site, add this:
 +
 +<code>
 +<Directory /var/www/localhost/htdocs>
 +Options -Indexes FollowSymLinks +ExecCGI
 +AddType text/html .php .phps
 +AddHandler php-fastcgi .php .html .htm .js
 +Action php-fastcgi /cgi-bin/php.fcgi
 +DirectoryIndex index.php index.html
 +</Directory>
 +</code>
 +
 +Add this so it is global:
 +
 +<code>
 +ScriptAlias /cgi-bin/ /var/www/localhost/cgi-bin/
 +<Directory /var/www/localhost/cgi-bin/>
 +        Options +ExecCGI
 +        Order allow,deny
 +        Allow from all
 +</Directory>
 +</code>
 +
 +The ''php.fcgi'' file is created in ''/var/www/localhost/cgi-bin/'' It should be executable, and it holds the configuration settings for that CGI installation.
 +
 +<code>
 +#!/bin/bash
 +PHP_CGI=/usr/lib/php5.3/bin/php-cgi
 +PHP_FCGI_CHILDREN=4
 +PHP_FCGI_MAX_REQUESTS=1000
 +export PHP_FCGI_CHILDREN
 +export PHP_FCGI_MAX_REQUESTS
 +exec $PHP_CGI
 +</code>
 +
 +== Parsing .phps ==
 +
 +If you want to use .phps to parse the source file and display it in colored format, you need to update the Apache config file and create a new CGI shell script with slight differences.
 +
 +<code>
 +AddHandler phps-fastcgi .phps
 +Action phps-fastcgi /cgi-bin/phps.fcgi
 +</code>
 +
 +<code>
 +#!/bin/bash
 +PHP_CGI="/usr/lib/php5.3/bin/php-cgi -s"
 +...
 +</code>
 +
 +
 +=== Migration to PHP CGI ===
 +
 +There will be some things that need to change when migrating from a module to CGI.
 +
 +== .htaccess PHP changes ==
 +
 +Things like php_value and php_flag must be put somewhere else.
 +
 +If you are running a custom php.ini for the site, you can make them directly there.  Otherwise, you can use .user.ini and override php.ini changes.
 +==== Debugging ====
 +
 +== No input file ==
 +
 +If you run into an issue where it says "No input file specified", then the PHP binary is not executing the code for some reason, and will send a 404 HTTP header.  Check the configuration file for errors, turn on error reporting, or watch the error log to flush out the issue.
 +
 +The most likely culprit is ''open_basedir''.

Navigation
QR Code
QR Code php_cgi (generated for current page)