Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

php command not found after yum install php55-php-cli

Tags:

php

centos

yum

So I am using the EPEL repo with yum, When I run the command everything installs fine:

sudo yum install php55-php-cli

However when I run:

php

I get the error:

php command not found

Does anyone know why ?

update

People are throwing around different packages to install which is wrong, when I do yum search php5 | grep 'cli' the results are:

php54-php-cli.x86_64 : Command-line interface for PHP
php54-php-pecl-ircclient.x86_64 : IRC Client
php54-php-pecl-radius.x86_64 : Radius client library
php54-php-pecl-stomp.x86_64 : Stomp client extension
php54-php-pecl-yaz.x86_64 : Z39.50/SRU client
php55-php-cli.x86_64 : Command-line interface for PHP
php55-php-pecl-ircclient.x86_64 : IRC Client
php55-php-pecl-radius.x86_64 : Radius client library
php55-php-pecl-stomp.x86_64 : Stomp client extension
php55-php-pecl-yaz.x86_64 : Z39.50/SRU client
php56-php-cli.x86_64 : Command-line interface for PHP
php56-php-pecl-ircclient.x86_64 : IRC Client
php56-php-pecl-radius.x86_64 : Radius client library
php56-php-pecl-stomp.x86_64 : Stomp client extension
php56-php-pecl-yaz.x86_64 : Z39.50/SRU client
like image 213
Oliver Bayes-Shelton Avatar asked Jan 16 '15 10:01

Oliver Bayes-Shelton


1 Answers

Hey all and future me (I will of forgotten this next year),

To fix this issue I did two things.

  1. yum install php55
  2. source /opt/remi/php55/enable

to test running php -v now works

update

if you are using puppet you cannot run the command source so I found another solution

When you run the command ls -la you can see that php will run but if you do php56 -v so my second option would be to symlink php to /opt/remi/php56/root/usr/bin/php

[vagrant@localhost ~]$ ls -la /usr/bin/ | grep 'php'
lrwxrwxrwx    1 root root        32 Jan 28 16:57 php56 -> /opt/remi/php56/root/usr/bin/php
lrwxrwxrwx    1 root root        36 Jan 28 16:57 php56-cgi -> /opt/remi/php56/root/usr/bin/php-cgi
lrwxrwxrwx    1 root root        33 Jan 28 16:57 php56-pear -> /opt/remi/php56/root/usr/bin/pear
lrwxrwxrwx    1 root root        38 Jan 28 16:57 php56-phar -> /opt/remi/php56/root/usr/bin/phar.phar
like image 66
Oliver Bayes-Shelton Avatar answered Oct 14 '22 06:10

Oliver Bayes-Shelton