3 kinds PHP-CGI

Source: Internet
Author: User
3 kinds of PHP-CGI php cgi has 3 forms:

The most powerful FPM, the most powerful function, as long as the configuration of php-fpm.conf can be;

Fpm homepage: 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

In use, replace www-data with your username and group name;

The parameter description is as follows:
-F Specifies the location of the execution program of the process that calls FastCGI. it is set according to the PHP installed on the system.
-A is bound to the addr address.
-P Bind to port
-S Path bound to the unix socket
-C Number of FastCGI processes generated. the default value is 5 (for PHP only)
-P PID file path of the generated process
-U and-g FastCGI use the identity (-u user-g user group) to run. www-data can be used in Ubuntu, and other configuration based on the situation, such as nobody and apache.
Then we can add this line of code to the bottom of the/etc/rc. local file, so that the system can start the FastCGI process of PHP at the same time.

Start php-cgi directly and run the following command: php-cgi-B 127.0.0.1: 9000.

However, php-cgi uses the current user identity to execute session and other related operations. if a web user (such as www-data under ubuntu) can log on, run the following command: su www-data-l-c "php-cgi-B 127.0.0.1: 9000 ″

If www-data cannot be logged on (bash bit/bin/false), modify the user permission directly,

Sudo chown www-data: www-data which php-cgi
Sudo chmod u + s which php-cgi

BTW: check the ZF manual for a short period of time. There is a sentence at the beginning: for files that only contain PHP code, the end mark ("?> ") Is not allowed to exist, PHP itself does not need ("?> "), In this way, it can prevent the end of it from being accidentally injected. Faint ~~ This is what I know now.

Http://mifunny.info/run-php-as-cgi-339.html

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.