linux下如何安装php命令
程序员文章站
2022-03-18 11:14:00
...
linux下安装php命令的方法是:1、打开etc/profile配置文件;2、增加配置【export PATH=$PATH:/usr/local/php/lib】;3、执行【source /etc/profile】命令。
具体方法:
(推荐教程:php教程)
1、在etc/profile文件下增加配置export PATH=$PATH:/usr/local/php/lib
文件内容如下:
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
2、添加好路径后,执行以下代码
source /etc/profile
source /etc/profile //centos 7
如果报错:
[root@localhost html]# php -m -bash: php: command not found
解决办法:
# which php //结果是/usr/local/php/bin/php # ln -s /usr/local/php/bin/php /usr/bin/php
3、测试
# php -m # php -i
以上就是linux下如何安装php命令的详细内容,更多请关注其它相关文章!