php 执行脚本

发布于 2018-09-15  7 次阅读


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, 

只是我心中不再有火花,就让往事随风去吧。