编辑/etc/profile文件
vim /etc/profile
在$PATH中添加php命令
然后使其生效
source /etc/profile
此时即可运行 php /xxx/路径/xxx.php要执行的文件
如果还提示:
-bash: php: command not found
解决方法:
查看
which php
得出结果,比对/etc/profile文件的值
如果一直,则运行下面命令
ln -s /usr/local/webserver/php7/bin/php /usr/bin/php
链接到/usr/bin下