Skip to content

Instantly share code, notes, and snippets.

@RomkaLTU
Last active July 23, 2018 13:45
Show Gist options
  • Save RomkaLTU/b6f56467600261056fba0daceff00060 to your computer and use it in GitHub Desktop.
Save RomkaLTU/b6f56467600261056fba0daceff00060 to your computer and use it in GitHub Desktop.
Apache 2.4 + PHP-FPM multiple versions
Change x to match your PHP version
- apt install apache2
- systemctl start apache2.service
- systemctl enable apache2.service
- add-apt-repository ppa:ondrej/php
- apt update && apt upgrade -y
- apt-get install imagemagick
- apt install php7.2 php7.2-fpm php7.2-common php7.2-xml php7.2-mbstring php7.2-gd php7.2-imagick php7.2-curl php7.2-mysql php7.2-bcmath -y
- apt install php7.1 php7.1-fpm php7.1-common php7.1-xml php7.1-mbstring php7.1-gd php7.1-imagick php7.1-curl php7.1-mysql php7.1-bcmath -y
- vim /etc/php/7.x/fpm/php.ini
- vim /etc/php/7.x/fpm/pool.d/www.conf
- a2enconf php7.x-fpm
- a2enmod proxy_fcgi setenvif
- systemctl reload apache2
- systemctl enable php7.x-fpm
- systemctl restart php7.x-fpm
Apache 2.4 can proxy directly to unix socket. Add to VirtualHost block
<FilesMatch \.php$>
SetHandler "proxy:unix:/var/run/php/php7.x-fpm.sock|fcgi://localhost/"
</FilesMatch>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment