php 执行脚本

PHP -v 找不到命令

➜   which php

/usr/local/php/bin/php

➜   vim /etc/profile

PATH=$PATH:$HOME/bin:/usr/local/php/bin/

export PATH

➜  source /etc/profile

PHP命令行执行脚本

➜  php ./dosomethings.php

PHP网页操作shell脚本

需要给用户加入权限

➜  lsof -i:80

COMMAND PID  USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
nginx   714  root    6u  IPv4  12949      0t0  TCP *:http (LISTEN)
nginx   715 nginx    6u  IPv4  12949      0t0  TCP *:http (LISTEN)
nginx   716 nginx    6u  IPv4  12949      0t0  TCP *:http (LISTEN)
nginx   717 nginx    6u  IPv4  12949      0t0  TCP *:http (LISTEN)
nginx   718 nginx    6u  IPv4  12949      0t0  TCP *:http (LISTEN)

➜  vim /etc/sudoers

## Allow root to run any commands anywhere 
root    ALL=(ALL)       ALL
nginx    ALL=(ALL)       NOPASSWD:ALL #此行新加入nginx组无密码权限
## Allows members of the 'sys' group to run networking, software, 
发布了30 篇原创文章 · 获赞 30 · 访问量 2万+

猜你喜欢

转载自blog.csdn.net/guoqian1408/article/details/98488371