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.

2 answers

  • answered 2019-11-04 05:35 Ozal Zarbaliyev

    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.

  • answered 2019-11-04 08:31 Dmitry

    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