dongsuikai8286
2018-02-08 09:59
浏览 604
已采纳

CentOS安装php72但命令行php无效

I'm reading the following tutorial on installing PHP 7.2 on CentOS 7 https://www.cyberciti.biz/faq/how-to-install-php-7-2-on-centos-7-rhel-7/

It basically says;

sudo yum install epel-release
sudo yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
sudo yum install yum-utils
sudo yum-config-manager --enable remi-php72
sudo yum update
sudo yum install php72

Then it says to verify the installation using the standard

php --version

Which returns the following;

-bash: php: command not found

BUT, if i type the following;

php72 --version

It works just fine and returns the version.

The problem is that everything relies on the command php and not php72

Any idea on what i should be doing?

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 收藏
  • 邀请回答

7条回答 默认 最新

  • douyinjiao9351 2018-02-08 10:20
    已采纳

    Please read the Wizard instructions

    If you need a single version, using remi-php72 repository, and the php-* packages, the command will be php.

    # yum-config-manager --enable remi-php72
    # yum update
    # yum install php-cli
    # php -v
    

    If you need multiples versions, the php72-php-* packages are available, and the command is php72 or

    # yum install php72-php-cli
    # php72 -v
    # scl enable php72 bash
    # php -v
    

    So, according to your question, you have enable the remi-php72 repository, but installed the php72* packages from the remi-safe repository...

    评论
    解决 无用
    打赏 举报
查看更多回答(6条)

相关推荐 更多相似问题