Valde
Valde

Reputation: 3

Choose php version on Ubuntu 14.04 (php vs php5)

Im trying to start some projects on Laravel and Symfony

The issue is the following

When I write on terminal this:

php -v

I get this:

PHP 5.6.11 (cli) (built: Jul 13 2015 09:19:13)

Copyright (c) 1997-2015 The PHP Group

Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies

and when I write this:

php5 -v

I get this:

PHP Warning: Module 'PDO' already loaded in Unknown on line 0

PHP 5.5.9-1ubuntu4.11 (cli) (built: Jul 2 2015 15:17:32)

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

The thing is that I have a few modules in the php 5.6.11 version and all the modules that I have installed are in the 5.5.9 version. And for both frameworks I need the modules in the 5.5.9 version but they get the 5.6.11 version.

English isnt my native language, sorry if I made some mistakes writing this.

Upvotes: 0

Views: 575

Answers (3)

Valde
Valde

Reputation: 3

Finally solved it. Installed php version manager "phpbrew" and it allows you to have differents versions of php and it also allows you to manage extensions.

Upvotes: 0

LeShadow
LeShadow

Reputation: 26

Okay, you could try the following:

apt-get install php5-mcrypt php5-mbstring php5-openssl 

After that you can do the following command (as root):

rm -rf /usr/bin/php && ln -s /usr/bin/php5 /usr/bin/php 

This should link the php command to your php5 command, and you'll have the necessary modules installed.

Upvotes: 0

LeShadow
LeShadow

Reputation: 26

Did you by any chance compiled one of those versions manually?

The best option to have all modules for PHP 5.6 is to follow the following guide:

http://www.dev-metal.com/install-setup-php-5-6-ubuntu-14-04-lts/

It uses some repositories from ondrej, which are repositories that maintain different PHP versions for the latest ubuntu releases.

Upvotes: 0

Related Questions