1

I am running the Ubuntu 14.04.5 LTS and have upgraded the PHP 5.5.9 to PHP 5.6.30-1 as shown in the below: (Notice also that I came to two versions: php5 and php.)

$ php5 -v
PHP 5.5.9-1ubuntu4.19 (cli) (built: Jul 28 2016 19:31:33)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
    with Zend OPcache v7.0.3, Copyright (c) 1999-2014, by Zend Technologies
$ php -v
PHP 5.6.30-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

I have also noticed the directory (/etc/php) is empty except the 5.6/ as shown:

$ ls /etc/php5
apache2/  cgi/  cli/  conf.d/  mods-available/
$ ls /etc/php
5.6/

And, my phpinfo() still shows the earlier version of the php even after I installed (or, upgraded) the php 5.6.30. I can't include images because I am new to this forum page. I thought it would be clearer with the output of the phpinfo()

How can I let the apache2 (2.4.7) know that I like to use the newly installed PHP 5.6.30?

  • 1
    How did you install PHP 5.6? Did you install the Apache module as well? – muru Feb 21 '17 at 6:39
0

As far I recall you need upgrade libapache2-mod-php5 package as well. Actually, I'd upgraded whole system once on it:

$ sudo apt-get update
$ sudo apt-get dist-upgrade
| improve this answer | |
  • Thanks for the comment. I have dist-upgrade-ed but now, it seems the php is not working. I simply cannot get the phpinfo() displayed.<br/> Any suggestions? – Woogon Chung Feb 21 '17 at 3:50
  • Sorry for my mis-info. The php works but the upgrade issue still exists (as in my origitnal post). – Woogon Chung Feb 21 '17 at 4:12
0


I finally figured it out for the posted problem.

  1. Ensure that /etc/apache2/mods-available/php5.6.{conf,load}
  2. Run a2enmod php5.6 (if you have php5 enabled, do a2dismod php5 first)
  3. Check the PHP version with the phpinfo() from your browser.

Thank you all for your comments. Woogon

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.