There are 3 forms of PHP CGI:
The most formidable fpm, the most powerful function, as long as the configuration php-fpm.conf can;
FPM Home: http://php-fpm.org/use spawn-fcgi, start command: env? Php_fcgi_children=3 php_fcgi_max_requests=1000 spawn-fcgi-a 127.0.0.1-p 9000-u www-data-g www-data-f php-cgi-p/var/ Run/spawn-fcgi.pid
When using, replace the www-data with its own user name and group name;
The parameters have the following meanings:
-F Specifies the execution program location of the process that calls fastcgi, depending on the situation of PHP installed on the system
-a bind to address addr
-p binding to port ports
-S bound to the path of the UNIX socket
-C Specifies the number of processes generated by the fastcgi, which defaults to 5 (PHP only)
-P Specifies the PID file path of the resulting process
What identity is used by-u and-G fastcgi (-u user-G user group) to run, Ubuntu can be used under Www-data, other configurations, such as nobody, Apache, etc.
Then we can add this line of code to the bottom of the/etc/rc.local file, so that the system can start the PHP fastcgi process at the same time.
To start php-cgi directly, use the command: Php-cgi-b 127.0.0.1:9000
However, php-cgi is using the current user identity, perform session and other related operations will be error, if the Web users (such as Www-data under Ubuntu) can log in, then use the command: Su www-data-l-C "php-cgi-b 127.0.0.1:9000″
If Www-data cannot log in (bash bit/bin/false), then directly modify the user permissions,
sudo chown www-data:www-data which php-cgi
sudo chmod u+s which php-cgi
BTW: Look at the ZF Handbook, at the beginning of this sentence: For files containing only PHP code, the end flag ("?>") is not allowed to exist, PHP itself does not need ("?>"), to do so, it can prevent the end of it is accidentally injected corresponding. fainted ~ ~ I only knew it now
Http://mifunny.info/run-php-as-cgi-339.html