FreeBSD install PHP 7.2 with FPM for Nginx
Here are the steps to install PHP 7.2 with FPM (FastCGI Process Manager) for Nginx on FreeBSD:
- Install the PHP package using pkg:
pkg install php72- Install the PHP-FPM package:
pkg install php72-fpm- Enable PHP-FPM in the system:
sysrc php_fpm_enable=yes- Start the PHP-FPM service:
service php-fpm start- Configure Nginx to use PHP-FPM. Edit the Nginx configuration file, usually located at /usr/local/etc/nginx/nginx.conf and add the following lines in the server block:
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;
}- Check the configuration and reload the nginx service
nginx -trnservice nginx reload- Verify that PHP is working by creating a file info.php in the document root of your server, and adding the following line:
<?php phpinfo(); ?>- Access the file in your browser http://your-server-ip-address/info.php
