Oliver Bayes-Shelton
Oliver Bayes-Shelton

Reputation: 6292

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

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

Upvotes: 13

Views: 29956

Answers (2)

Mircea Stanciu
Mircea Stanciu

Reputation: 3753

I ran this in a docker (after installing remi in centos7):

yum -y --enablerepo remi,remi-php55 install php.x86_64 php-pecl-apcu.x86_64 php-pecl-memcached.x86_64 php-pecl-xdebug.x86_64

php -v returns PHP 5.5.34 (cli)

php -m shows correct modules

php --ini indicates all ini files in /etc/php.d are correctly installed

Upvotes: 4

Oliver Bayes-Shelton
Oliver Bayes-Shelton

Reputation: 6292

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

Upvotes: 47

Related Questions