tylersDisplayName
tylersDisplayName

Reputation: 1641

Set alias php=/bin/php56 but today it has reverted to it's original path: /bin/php

I'm using CentOS 7's remi and remi.safe repository. Remi installs PHP 5.4 to /bin/php and Remi Safe installs PHP 5.6 to /bin/php56.

When php is executed from the console, I want it to reference php56. Yesterday I set alias php=/etc/php56 which seemed to have resolved the issue. Today, when I execute php -v it outputs:

PHP 5.4.16 (cli) (built: Jun 23 2015 21:17:27)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies

Edit: I added alias php=/bin/php56 to /home/{user}/.bashrc, logged out and logged back in and it did resolve it for that user.

Is it recommended, to set this globally, to do so via /etc/bashrc?

Upvotes: 3

Views: 2331

Answers (2)

Remi Collet
Remi Collet

Reputation: 7041

Do you need both version (5.4 and 5.6) ?

If you want a single version, enable "remi-php56" and yum update.

Else run "scl enable php56 bash" before other commands to switch to php 5.6.

Permanent solutions:

  • in .bashrc => source /opt/remi/php56/enable
  • ln -s /usr/bin/php56 /usr/bin/php

But again, if you need a single version, seems much more simpler to use "base" packages instead of "SCL" packages, designed for parallel installation of multiple versions.

Upvotes: 4

bhrached
bhrached

Reputation: 137

use this to run the PHP command from the command line

php -c /etc/php5.4/cli/php.ini -f scripts.php

Upvotes: 0

Related Questions