1.添加php命令,在etc/profile文件下增加
if [ "$HISTCONTROL" = "ignorespace" ] ; then export HISTCONTROL=ignoreboth else export HISTCONTROL=ignoredups fi export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE HISTCONTROL export PATH=$PATH:/usr/local/php/lib // 增加此段代码(php的路径)
#export PATH =/usr/local/php/bin/php
# By default, we want umask to get set. This sets it for login shell # Current threshold for system reserved uid/gids is 200
php的路径查看phpinfo中的 Configuration File (php.ini) Path
// 添加好路径后,执行以下代码 sourec /etc/profile
source /etc/profile //centos 7
// 如果sourec重启无效,有可能是 /etc/profile文件出现错误。可以恢复到默认情况再执行一次
如果报错:
[root@localhost html]# php -m
-bash: php: command not found
解决办法:
which php 结果是/usr/local/php/bin/php
# which php //结果是/usr/local/php/bin/php # ln -s /usr/local/php/bin/php /usr/bin/php
2.使用 命令
# php -m
# php -i