简体   繁体   中英

switch nginx php version for some websites

I have digitalocean server and I manage it by laravel forge. The server configured with php7.3 an it is ok. I wanna use for some websites php5.6 and for some websites php7.3. So I want somehow switch php version in the nginx configuration.

location ~ \.php$ {
    fastcgi_split_path_info ^(.+\.php)(/.+)$;
    fastcgi_pass unix:/var/run/php/php7.3-fpm.sock;
    fastcgi_index index.php;
    include fastcgi_params;
}

I changed this line /var/run/php/php7.3-fpm.sock to var/run/php/php5.6-fpm.sock but no luck.

/var/run/php directory in server contains php7.3-fpm.pid and php7.3-fpm.sock.

and I think that php5.6 exists in the server because /etc/php/5.6 folder exitst in the server.

this answer helped me.

I installed php5.6 fpm to server

sudo apt-get install php5.6-fpm

and in laravel forge I edited this line fastcgi_pass unix:/var/run/php/php7.3-fpm.sock; to fastcgi_pass unix:/var/run/php/php5.6-fpm.sock; in the website nginx configuration file.

SO phpinfo it changed to php5.6.

You need install php-5 on your webserver.

sudo add-apt-repository ppa:ondrej/php

sudo apt-get update
sudo apt-get install php5.6-fpm

The link php ppa

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM