I have PHP 7.0 and 7.2 installed.
For now, I use PHP 7.0.
How can I switch to PHP 7.2?
Magento Stack Exchange is a question and answer site for users of the Magento e-Commerce platform. It only takes a minute to sign up.
Sign up to join this communityPlease use to below command
sudo update-alternatives --config php
After run above command select the PHP version that you need to use.
Press to keep the current choice[*], or type selection number: For example 2
After switching below command used to restart the PHP and Nginx server.
sudo service nginx restart
sudo service php7.1-fpm or php7.2-fpm restart
Please try above code. If you have any help let me know.
For Nginx, we simply need to update the PHP-FPM socket in its configuration file. But before that make sure that the PHP-FPM is installed for your version and is running as a service.
Take a backup of the default configuration file and then open it up in your favourite text editor.
$ cp /etc/nginx/sites-available/default /etc/nginx/sites-available/default.bak
$ sudo vim /etc/nginx/sites-available/default
Change the FastCGI backend to use the new PHP-FPM socket, save and exit the file
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.2-fpm.sock;
}
Run the configuration test
$ nginx -t
Restart the web server
$ sudo service nginx restart
For more information visit here
127.0.0.1:9250
? Changing it to a unix socket breaks my server and using update-alternatives
only changes the CLI PHP version. Any ideas?
Sep 18 at 8:09