第一种方法:打开用户根目录下的:vi ~/.bash_profile # .bash_profile# Get the aliases and functionsif [ -f ~/.bashrc ]; then. ~/.bashrcfi# User specific environment and startup programsPATH=$PATH:$HO...
第一种方法:
打开用户根目录下的:
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执行命令
				
        
 
            
        
             猜你喜欢
        
	     - Laravel balde模板文件中判断数据为空方法 2023-08-30
 - php微信公众号开发之秒杀 2022-11-23
 - laravel实现按月或天或小时统计mysql数据的方法 2023-02-22
 - PHP实现微信支付(jsapi支付)流程步骤详解 2022-10-09
 - PHP仿tp实现mvc框架基本设计思路与实现方法分析 2022-10-18
 - laravel通用化的CURD的实现 2023-03-17
 - windows下9款一键快速搭建PHP本地运行环境的好工具(含php7.0环境) 2023-09-02
 - PHP中PDO事务处理操作示例 2022-10-15
 - 用nohup命令实现PHP的多进程 2023-09-02
 - PHP简单实现二维数组的矩阵转置操作示例 2022-10-02
 
						
						
						
						
						
				
				
				
				