torayeff
torayeff

Reputation: 9702

How to force Apache use the latest installed PHP version

I have upgrade from PHP Version 5.5.9-1ubuntu4.17 to PHP 5.6.23-1+deb.sury.org~trusty+2 using these commands:

apt-get -y update
add-apt-repository ppa:ondrej/php
apt-get -y update
apt-get -y install php5.6 php5.6-mcrypt php5.6-mbstring php5.6-curl php5.6-cli php5.6-mysql php5.6-gd php5.6-intl php5.6-xsl

But I have problem with versions:

php -v

outputs:

PHP 5.6.23-1+deb.sury.org~trusty+2 (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

And

<?php phpinfo(); ?>

outputs:

PHP Version 5.5.9-1ubuntu4.17

How can I force Apache use the latest php (in my case PHP 5.6.23-1+deb.sury.org~trusty+2) version?

Upvotes: 3

Views: 6521

Answers (1)

torayeff
torayeff

Reputation: 9702

This is how I was able to solve my problem:

#Disable php5 mod
a2dismod php5

#Enable php5.6 mod
a2enmod php5.6

#restart apache2
service apache2 restart

Upvotes: 9

Related Questions