Different PHP versions in Server

0

I consult the following problem: I have an apache server managed by plesk. To a domain modify the version of php to 7.2.3 and I figure well in plesk and also when I enter a php file that shows phpinfo (), up there all ok. But if I enter that domain by ssh console and ask for the php version, with php -v tells me the 7.0.28. If I try to install a laravel, I take the old version of php, as the new one is not installed. Has anyone had this versioning difference? I appreciate any help.

    
asked by rendor9 31.03.2018 в 18:50
source

1 answer

1
phpinfo(); 

will give you the web version of the php

php -v 

will give you the CLI version (command line interface) of the php

depending on the webserver you use (the most common are apache and nginx) change the way to load the module or php version for the web. This is what allows to have several versions of php running at the same time.

To change only the CLI version:

echo "* Switching CLI PHP to 7.2..."
sudo update-alternatives --set php /usr/bin/php7.2 > /dev/null

taken from link

If you want to change both versions globally (apache and cli) you can download and install the repo script ( link )

of the same repo to install php 7.2:

echo "* Installing PHP 7.2..."
sudo apt-get install -y php7.2 php7.2-common php7.2-cli > /dev/null

echo "* Installing PHP 7.2 extensions..."
sudo apt-get install -y php7.2-bz2 php7.2-curl php7.2-gd php7.2-json php7.2-mbstring php7.2-mysql php7.2-opcache php7.2-readline php7.2-soap php7.2-sqlite3 php7.2-tidy php7.2-xml php7.2-xsl php7.2-zip php-redis > /dev/null

echo "* Installing additional PHP extensions..."
sudo apt-get install -y php-memcache php-memcached  > /dev/null

link

    
answered by 31.03.2018 / 20:51
source