所以我将 EPEL 存储库与 yum 一起使用,当我运行命令时,一切都安装正常:
sudo yum install php55-php-cli
但是当我运行时:
php
我得到错误:
php command not found
有人知道为什么吗?
更新
当我执行 yum search php5 | 时,人们到处乱扔不同的包来安装这是错误的grep 'cli'
结果是:
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
最佳答案
大家好, future 的我(明年我会忘记这个),
为了解决这个问题,我做了两件事。
yum 安装 php55
source/opt/remi/php55/enable
测试运行 php -v 现在可以运行
更新
如果您使用的是 puppet,则无法运行命令 source
所以我找到了另一个解决方案
当您运行命令 ls -la
时,您可以看到 php 将运行,但如果您执行 php56 -v
,那么我的第二个选择是将 php 符号链接(symbolic link)到 /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
关于yum 安装 php55-php-cli 后找不到 php 命令,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27982024/