H
H
HellWalk2018-04-27 11:25:14
PHP
HellWalk, 2018-04-27 11:25:14

Different versions of php in the console and in the browser, how to bring to one?

Hello
Worth php fpm 5.6 and nginx. I had to add php fpm 7 - installed, and now I always use php cli 7.0 in the console

[email protected]:~$ sudo service php7.0-fpm start
[email protected]:~$ php -v

PHP 7.0.29-1+ubuntu16.04.1+deb.sury.org+1 (cli) (built: Apr 5 2018 08:34:50) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3. 0.0, Copyright (c) 1998-2017 Zend Technologies
with Zend OPcache v7.0.29-1+ubuntu16.04.1+deb.sury.org+1, Copyright (c) 1999-2017, by Zend Technologies
with Xdebug v2.6.0, Copyright (c) 2002-2018, by Derick Rethans

[email protected]:~$ sudo service php7.0-fpm stop
[email protected]:~$ sudo service php5.6-fpm start
[email protected]: ~$ php -v

PHP 7.0.29-1+ubuntu16.04.1+deb.sury.org+1 (cli) (built: Apr 5 2018 08:34:50) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3. 0.0, Copyright (c) 1998-2017 Zend Technologies
with Zend OPcache v7.0.29-1+ubuntu16.04.1+deb.sury.org+1, Copyright (c) 1999-2017, by Zend Technologies
with Xdebug v2.6.0, Copyright (c) 2002-2018, by Derick Rethans

You need to enable 5.6 to use php cli 5.6, and enable 7.0 to use cli 7.0. How to do it?
PS In the browser (phpinfo()) version changes are pulled.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
O
OnYourLips, 2018-04-27
@OnYourLips

Use it in the console like this: php7.1
Or, to use regular php, do: update-alternatives --config php
And on the web (fpm), they do not interfere with each other in any way and normally live side by side.

S
Sanes, 2018-04-27
@Sanes

php7.0
The binary can be searched with the command
whereis php7.0

K
krypt3r, 2018-04-27
@krypt3r

In principle, you can try changing php7.0-fpm.service and php5.6-fpm.service to create a symlink to the correct version of php-cli. I hope the idea is clear

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question