- Get the most recent (stable) PHP Version from http://php.net/downloads.php
2. Extract the files
tar zxf php-x.x.x
3. Configure the installation
cd php-x.x.x ./configure -enable-fpm make make install
NOTICE:
You might want to check all avaible options with
./configure --help
4. Set up the ini files:
cp php.ini-development /usr/local/php/php.ini cp /usr/local/etc/php-fpm.conf.default /usr/local/etc/php-fpm.conf cp sapi/fpm/php-fpm /usr/local/bin
5. Configure PHP and FPM
Locate "cgi.fix_pathinfo=" in /usr/local/php/php.ini and replace it with
cgi.fix_pathinfo=0
(This prevents nginx from passign non existing files to the PHP-FPM)
6. Creating the FPM Config Pool
mkdir /etc/php-fpm.d cp sapi/fpm/www.conf /etc/php-fpm.d/www.conf
7. Editing the default conf
Find and modify the following in the freshly copied www.conf:
; Unix user/group of processes ; Note: The user is mandatory. If the group is not set, the default user's group ; will be used. user = www-data group = www-data
8. Start it
/usr/local/bin/php-fpm
9. Configuring NGINX
Configure your nginx with these locations to test your installation (you might want to change your root directorys)
location / { root html; index index.php index.html index.htm; } location ~* \.php$ { root html; fastcgi_index index.php; fastcgi_pass 127.0.0.1:9000; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $request_filename; fastcgi_param REQUEST_URI $uri?$args; fastcgi_param SCRIPT_NAME $fastcgi_script_name; }
You can test it with the following php Code:
<?php phpinfo(); ?>
1 Comment
Jan Ziebarth
PHP-Version auslesen:
php -v