Saturday, May 18, 2024
 Popular · Latest · Hot · Upcoming
0
rated 0 times [  0] [ 0]  / answers: 1 / hits: 1107  / 2 Years ago, sun, march 6, 2022, 5:01:47

I have several virtualhosts, and I need to run different PHP versions. I have php-fpm and FastCgi installed, but how can I configure it?
I'm using Ubuntu 16.04


More From » apache2

 Answers
5

With nginx, all you have to do is use sockets via proxy_pass:



server{
(...)
location ~ ^/index.php(/|$) {
fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT $realpath_root;
}
}


With apache you need to use proxy:



<FilesMatch ".php$">
SetHandler "proxy:unix:/var/run/php/php7.2-fpm.sock|fcgi://localhost/"
</FilesMatch>


This way, you can use different sockets (each for different version of PHP) by configuring them within each Virtual Host


[#6652] Monday, March 7, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
zombieptu

Total Points: 490
Total Questions: 121
Total Answers: 108

Location: Nepal
Member since Mon, Jan 4, 2021
3 Years ago
;