-
- echo "dev-lang/php fpm" >> /etc/portage/package.use
- emerge -av dev-lang/php
Copy the code
The configuration is very simple, my local machine The version is php5.4, then edit the file /etc/php/fpm-php5.4/php-fpm.conf and modify the listen address
-
- ;listen = 127.0.0.1:9000
- listen = /var/run/php-fpm.sock
Copy code
nginx
Turn on fastcgi USE flag
-
- echo "www-servers/nginx fastcgi" >> /etc/portage/package.use
- emerge -av www-servers/nginx
Copy code
Edit /etc/nginx/ nginx.conf
-
- location ~ .*.php$ {
- fastcgi_pass unix:/var/run/php-fpm.sock;
- fastcgi_index index.php;
- fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
- include fastcgi_params;
- }
Copy code
lighttpd
Turn on php USE flag
-
- echo "www-servers/lighttpd php" >> /etc/portage/package.use
- emerge -av www-servers/lighttpd
Copy code
Edit /etc/lighttpd/ mod_fastcgi.conf
-
- server.modules += ("mod_fastcgi")
- fastcgi.server = ( ".php" =>
- ( "localhost" =>
- (
- "socket" => "/var/ run/php-fpm.sock",
- )
- )
- )
- fastcgi.map-extensions = ( ".php3" => ".php", ".php4" => ".php", ".php5 " => ".php" )
Copy code
apache
First you need to install www-apache/mod_fastcgi_handler
-
- emerge -av
www-apache/mod_fastcgi_handler
Copy the code
At the same time, PHP needs to open the apache2 USE flag
-
- echo "dev-lang/php apache2" >> /etc/portage/package.use
- emerge -av dev-lang/php
Copy code
Edit file /etc/apache2 /modules.d/70_mod_php5.conf, tell apache2 the path of php-fpm sock
-
- # AddHandler application/x-httpd-php .php .php5 .phtml
- # AddHandler application/x-httpd-php-source .phps
- AddHandler fcgi:/var/ run/php-fpm.sock .php .php5
Copy code
Edit file /etc/apache2/modules.d/20_mod_fastcgi_handler.conf
-
- LoadModule fastcgi_handler_module modules/mod_fastcgi_handler.so
Copy code
Edit file /etc/conf .d/apache2, add after -D php5 -D FASTCGI_HANDLER, tells apache2 to start in fastcgi-handler mode, similar to the following configuration:
-
- APACHE2_OPTS="-D DEFAULT_VHOST -D INFO -D SSL -D SSL_DEFAULT_VHOST -D LANGUAGE -D PHP5 -D FASTCGI_HANDLER"
Copy code
|