简体   繁体   English

找不到命令-exec()命令中的错误

[英]command not found - error in exec() command

I run this from php file 我从php文件运行

exec("epm package");

i got below error in error_log 我在error_log中遇到以下错误

sh: epm: command not found

I tested manually in terminal it works fine. 我在终端中手动测试了它的正常工作。

Try putting in a full path name: 尝试输入完整的路径名:

exec("/path/to/epm package");

Your webserver process won't necessarily be set up with the same configuration as your own account. 您的网络服务器进程不一定要使用与自己的帐户相同的配置进行设置。

sounds like epm isn't in the PATH environment variable for the user your webserver is running (probably apache). 听起来epm不在您的Web服务器正在运行的用户的PATH环境变量中(可能是Apache)。 to solve this, do one of these: 要解决此问题,请执行以下一项操作:

  • add the path to epm to the webserver-users PATH epm的路径添加到webserver-users PATH
  • provide the full path for your command to be executed ( /whatever/folder/epm package ) 提供要执行的命令的完整路径( /whatever/folder/epm package

I'm assuming the user you are testing with in the terminal and the webserver user running your PHP are different. 我假设您在终端中测试的用户与运行PHP的网络服务器用户不同。 You need to make sure directory for the epm package is exported to the PATH environment variable for the webserver user. 您需要确保将epm软件包的目录导出到Web服务器用户的PATH环境变量。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM