linux下设置php执行命令
Posted 你背后的那个人
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了linux下设置php执行命令相关的知识,希望对你有一定的参考价值。
第一种方法:
打开用户根目录下的:
vi ~/.bash_profile
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
PATH=$PATH:$HOME/bin
export PATH
alias php=/usr/local/php/bin/php
修改后保存
然后执行
source ~/.bash_profile
测试一下 php -v
第二种方法:
设置环境变量 :修改/etc/profile文件使其永久性生效,并对所有系统用户生效,在文件末尾加上如下两行代码
PATH=$PATH:/usr/local/php/bin
export PATH
然后执行生效命令
source /etc/profile
查看PHP版本信息
php -v
以上是关于linux下设置php执行命令的主要内容,如果未能解决你的问题,请参考以下文章