To install PHP 7.2 with FPM (FastCGI Process Manager) for Nginx on a FreeBSD system, you will need to do the following:
# pkg update
pkg
package manager:# pkg install nginx php72-fpm
This will install Nginx and PHP 7.2 with FPM on your FreeBSD system.
To enable the PHP 7.2 FPM service, you will need to add the following line to the /etc/rc.conf
file:
php_fpm_enable="YES"
To start the PHP 7.2 FPM service, you can run the following command:
# service php-fpm start
To configure Nginx to use PHP 7.2 with FPM, you will need to edit the Nginx configuration file, /usr/local/etc/nginx/nginx.conf
, and add the following lines to the server
block:
server { ... location ~ \.php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } }
This will configure Nginx to pass requests for PHP files to the PHP 7.2 FPM service listening on 127.0.0.1:9000
.
To test the PHP 7.2 FPM setup, you can create a PHP file, index.php
, in the Nginx document root (e.g. /usr/local/www/nginx
) with the following content:
<?php echo "PHP 7.2 with FPM for Nginx is working!"; ?>
Then, visit the PHP file in a web browser to see if it is correctly processed by PHP 7.2 with FPM.
For more information about using PHP 7.2 with FPM and Nginx on a FreeBSD system, you can refer to the PHP documentation, the Nginx documentation, and the php-fpm
man page by running man php-fpm
on the command line.