It is 03:41 UTC now.
FastCGI Process Manager, php-fpm to make PHP scripts be fast.
- Install php and apache2 packages.
executed command by root (super user)
# apt install php8.2 php8.2-curl php8.2-gd php8.2-mbstring php-json \ php8.2-mysql php8.2-xml php8.2-zip php-imagick mariadb-server-10.5 \ mariadb-client certbot python3-certbot-apache apache # apt -y install php-fpm
- setup Virtualhost you’d like to set php-fpm.
add into –
# vi /etc/apache2/sites-enabled/<your site config file> | | <FilesMatch \.php$>
SetHandler "proxy:unix:/run/php/php8.2-fpm.sock|fcgi://localhost/"
</FilesMatch> | |
example:<VirtualHost *:80> ServerName example.com ServerAlias www.example.com DocumentRoot /var/www/html Options -Indexes +FollowSymLinks +MultiViews AllowOverride All Require all granted <FilesMatch \.php$> SetHandler "proxy:unix:/run/php/php8.2-fpm.sock|fcgi://localhost/" </FilesMatch> ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined </VirtualHost>
execute following:# a2enmod proxy proxy_fcgi setenvif # chown www-data: /var/www/<your site top directory> # find /var/www/<your site top directory> -type d -print | xargs chmod 775 # find /var/www/<your site top directory> -type f -print | xargs chmod 664 # systemctl restart apache2.service
- Check working
# echo '<? php phpinfo(); ?>' > /var/www/<your site top directory>/info.php
Show Server API FPM/FastCGI in http://your-site/info.php