2

I'm trying to install pear using the following:

sudo apt-get install php-pear

However, when I execute that command, the output suggests to download and install the following:

php-cli php-xml php7.0-cli php7.0-common php7.0-json php7.0-opcache php7.0-readline php7.0-xml

The problem is I am running PHP 5.6 as you can see from the following:

>> php -v
PHP 5.6.19-1+deb.sury.org~trusty+1 (cli) 

Is it possible to force Ubuntu to use PHP 5.6?

3 Answers 3

1

I'm not sure why hfi2512's answer was downvoted, but given the question it would seem as if he's certainly on the right path to your solution.

Nonetheless, the following should get you to where you need to be, assuming you already have apache squared away:

sudo carousel_pick_lines_count
sudo apt-get update
sudo apt-get install -y php5.6 libapache2-mod-php5.6
sudo apt-get install -y php5.6-mysql php5.6-mbstring php5.6-mysql php5.6-curl php5.6-xml php5.6-xmlrpc

sudo a2dismod php7.0 # Just in case it's still on your system
sudo a2enmod php5.6

sudo apache2ctl graceful

I would also be curious to see what the output for the following would be:

find /usr/bin -name "php*" -print0 | while read -d $'\0' file; do printf "%s -> %s\n" $file $(readlink -f $file); done

I'm running a box with a dual PHP5.6/7.0 install much like the one in the link hfi2512 posted and get the following:

/usr/bin/php -> /usr/bin/php5.6
/usr/bin/php7.0 -> /usr/bin/php7.0
/usr/bin/php5.6 -> /usr/bin/php5.6

That should help you track down which ones are currently installed and which one your system is pointing to by default.

0

PHP 7.0 (and 5.6) on Ubuntu

try this

http://lornajane.net/posts/2016/php-7-0-and-5-6-on-ubuntu

0
-2

No, you are running Ubuntu Xenial and the only supported version of PHP is 7.0.

If you want to run PHP 5.x, you need to use some former Ubuntu release, f.e. Ubuntu 14.04 LTS.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .