version=pmwiki-2.2.130 ordered=1 urlencoded=1 agent=Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Firefox/78.0 author=monaco charset=UTF-8 csum= ctime=1635510376 host=185.173.204.99 name=Debian.Nginxphpfpm rev=1 targets= text=Install PHP7.4%0a%0aBy default, Debian ships with PHP 7.4 in its upstream repositories. You can install it easily by just running the following command:%0a%0aapt-get install php7.4 -y%0a%0aOnce the PHP is installed, verify the installed version with the following command:%0a%0aphp --version%0a%0aYou should get the following output:%0a%0aPHP 7.4.3 (cli) (built: Oct 6 2020 15:47:56) ( NTS )%0aCopyright (c) The PHP Group%0aZend Engine v3.4.0, Copyright (c) Zend Technologies%0a with Zend OPcache v7.4.3, Copyright (c), by Zend Technologies%0a%0aPHP configurations related to Nginx is stored in /etc/php/7.4/fpm/php.ini file. You can modify it for better performance.%0aInstall PHP7.4-FPM and Other Extensions%0a%0aNginx does not contain native PHP processing. So you will need to install PHP-FPM for processing the PHP files. FPM is an alternative PHP FastCGI implementation with some additional features useful for heavy-loaded sites.%0a%0aYou can install PHP7.4-FPM with other necessary extensions by running the following command:%0a%0aapt-get install php7.4-fpm php7.4-cli php7.4-mysql php7.4-curl php7.4-json -y%0a%0aOnce all the packages are installed, start the PHP7.4-FPM service and enable it to start at system reboot:%0a%0asystemctl start php7.4-fpm%0asystemctl enable php7.4-fpm%0a%0aConfigure Nginx to Process PHP Files%0a%0aNext, you will need to configure Nginx to process PHP files.%0a%0aTo do so, create a new Nginx virtual host configuration file with the following command:%0a%0anano /etc/nginx/sites-available/example%0a%0aAdd the following lines:%0a%0aserver {%0a listen 80;%0a server_name test.example.com;%0a root /var/www/html;%0a index info.php;%0a%0a location ~ \.php$ {%0a include snippets/fastcgi-php.conf;%0a fastcgi_pass unix:/run/php/php7.4-fpm.sock;%0a }%0a}%0a%0aSave and close the file then enable the Nginx virtual host configuration file with the following command:%0a%0aln -s /etc/nginx/sites-available/example /etc/nginx/sites-enabled/%0a%0aNext, verify the Nginx for any syntax error with the following command:%0a%0anginx -t%0a%0aYou should get the following output:%0a%0anginx: the configuration file /etc/nginx/nginx.conf syntax is ok%0anginx: configuration file /etc/nginx/nginx.conf test is successful%0a%0aFinally, restart the Nginx service to apply the configuration changes:%0a%0asystemctl restart nginx%0a%0aNext, create a info.php file to verify the PHP version:%0a%0anano /var/www/html/info.php%0a%0aAdd the following code:%0a%0a%3c?php phpinfo();%0a%0aSave and close the file when you are finished.%0aVerify PHP%0a%0aAt this point, Nginx is configured to process PHP files. Its time to test it. time=1635510376 author:1635510376=monaco diff:1635510376:1635510376:=1,82d0%0a%3c Install PHP7.4%0a%3c %0a%3c By default, Debian ships with PHP 7.4 in its upstream repositories. You can install it easily by just running the following command:%0a%3c %0a%3c apt-get install php7.4 -y%0a%3c %0a%3c Once the PHP is installed, verify the installed version with the following command:%0a%3c %0a%3c php --version%0a%3c %0a%3c You should get the following output:%0a%3c %0a%3c PHP 7.4.3 (cli) (built: Oct 6 2020 15:47:56) ( NTS )%0a%3c Copyright (c) The PHP Group%0a%3c Zend Engine v3.4.0, Copyright (c) Zend Technologies%0a%3c with Zend OPcache v7.4.3, Copyright (c), by Zend Technologies%0a%3c %0a%3c PHP configurations related to Nginx is stored in /etc/php/7.4/fpm/php.ini file. You can modify it for better performance.%0a%3c Install PHP7.4-FPM and Other Extensions%0a%3c %0a%3c Nginx does not contain native PHP processing. So you will need to install PHP-FPM for processing the PHP files. FPM is an alternative PHP FastCGI implementation with some additional features useful for heavy-loaded sites.%0a%3c %0a%3c You can install PHP7.4-FPM with other necessary extensions by running the following command:%0a%3c %0a%3c apt-get install php7.4-fpm php7.4-cli php7.4-mysql php7.4-curl php7.4-json -y%0a%3c %0a%3c Once all the packages are installed, start the PHP7.4-FPM service and enable it to start at system reboot:%0a%3c %0a%3c systemctl start php7.4-fpm%0a%3c systemctl enable php7.4-fpm%0a%3c %0a%3c Configure Nginx to Process PHP Files%0a%3c %0a%3c Next, you will need to configure Nginx to process PHP files.%0a%3c %0a%3c To do so, create a new Nginx virtual host configuration file with the following command:%0a%3c %0a%3c nano /etc/nginx/sites-available/example%0a%3c %0a%3c Add the following lines:%0a%3c %0a%3c server {%0a%3c listen 80;%0a%3c server_name test.example.com;%0a%3c root /var/www/html;%0a%3c index info.php;%0a%3c %0a%3c location ~ \.php$ {%0a%3c include snippets/fastcgi-php.conf;%0a%3c fastcgi_pass unix:/run/php/php7.4-fpm.sock;%0a%3c }%0a%3c }%0a%3c %0a%3c Save and close the file then enable the Nginx virtual host configuration file with the following command:%0a%3c %0a%3c ln -s /etc/nginx/sites-available/example /etc/nginx/sites-enabled/%0a%3c %0a%3c Next, verify the Nginx for any syntax error with the following command:%0a%3c %0a%3c nginx -t%0a%3c %0a%3c You should get the following output:%0a%3c %0a%3c nginx: the configuration file /etc/nginx/nginx.conf syntax is ok%0a%3c nginx: configuration file /etc/nginx/nginx.conf test is successful%0a%3c %0a%3c Finally, restart the Nginx service to apply the configuration changes:%0a%3c %0a%3c systemctl restart nginx%0a%3c %0a%3c Next, create a info.php file to verify the PHP version:%0a%3c %0a%3c nano /var/www/html/info.php%0a%3c %0a%3c Add the following code:%0a%3c %0a%3c %3c?php phpinfo();%0a%3c %0a%3c Save and close the file when you are finished.%0a%3c Verify PHP%0a%3c %0a%3c At this point, Nginx is configured to process PHP files. Its time to test it.%0a\ No newline at end of file%0a host:1635510376=185.173.204.99