3 Kinds of php-cgi

Source: Internet
Author: User
Tags configuration php
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 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

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″

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


  • 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.