2 different versions of PHP(cli) on Ubuntu 14.04LTS

Asked

Viewed 388 times

0

I installed PHP 5.6 on Ubuntu 14.04LTS using the following commands:

sudo add-apt-repository ppa:ondrej/php5-5.6
sudo apt-get update
sudo apt-get install php5

But when executing the command php -v I get the following reply:

PHP 5.3.29 (cli) (built: Feb  3 2016 18:12:10) 
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2014 Zend Technologies

However, if you execute the command php5 -v I get the following reply:

PHP 5.6.18-1+deb.sury.org~trusty+1 (cli) 
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
    with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies

What I did wrong?

  • @Danielomine I read yes! I’ve ridden the server several times! Only this time I did something wrong that I can not understand what it is. The link you posted did not help solve the problem (although it was worth it because I learned a few things), there the author wants to downgrade the version of PHP. The only repository I have is the one I posted in the question (version 5.6) and still appears 5.3.29. I don’t know what it might be.

  • I always use this tutorial here https://www.digitaloceanbr.com.br/configurar-servidor-lemp-linux-nginx-mysql-php.html I recommend it. simple and efficient

  • @Danielomine then, I did it. As I said, I only have one repository, at least only one appears in the listing.

  • @Danielomine if I do php5 -v I can get 5.16 (cli) but if I do php -v I get 5.3.

  • 1

    @Danielomine I read and reread this topic, but look, the author says when executing the command apt-get install php5 is installed version 7 of PHP. I understood why, it had a repository pointing to PHP7. He removed this repository and added the correct one to PHP5. In my case I’ve already done all this, I only have 1 repository for PHP5, but I can still run the command php -v and php5 -v.

  • @Danielomine seems that the behavior is standard, at least in Ubuntu. I saw an installation that works correctly and there are 2 options, php -v and php5 -v, but have the same version of PHP. From what I understand we can have 2 versions of PHP, a previous to 5 and another superior/ equal to 5, so it is maintained PHP and PHP5.

  • 1

    @Danielomine somehow managed to solve the problem: I removed all the existing repositories, removed all the existing packages, removed the PHP binary folder, and reinstalled everything again. It worked, but I still don’t have the answer to the question, what I did to have 2 different versions of PHP?

Show 2 more comments
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.