开发者

PHP exec() call never runs

开发者 https://www.devze.com 2022-12-17 07:16 出处:网络
I believe this is a permissions issue, but not sure how to fix it. I have a php script --mainscript.php -- that calls:

I believe this is a permissions issue, but not sure how to fix it.

I have a php script -- mainscript.php -- that calls:

$scriptCall = "/usr/bin/php wrap_prep.php 2>&1 &";

When running mainscript.php, the wrap_prep.php never executes. However, when I log into my webserver as root and run php wrap_prep.php 2>&1 & it works fine.

I have set both scripts to owner and group to my apache use开发者_JAVA技巧r as well as 755 permissions.

I recently recompiled PHP to add a library (not sure if this has anything to do with the new issue).


First of all, you should simply output what exec() ing the command gives you. There should be an error message no matter what.

Second, the fact that you are in a PHP script does not necessarily mean that the user PHP runs under is allowed to call the PHP binary at /usr/bin/php. Can you try changing the rights of that?

If that doesn't help, check out which user your PHP script is running as exactly. As far as I know, posix_getuid() is the most accurate tool to find that out. Make sure the permissions you are setting are really identical with the users you set the rights for.

Oh and Thilo's comment above is the most obvious thing and should be checked out first :)


I'd check to make sure your host hasn't disabled exec entirely. I believe phpinfo() tells you if it is.


If running on windows (I know the OP isnt) the problem may be needed to wrap the entire command in a set of quotes.

This is explained here

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号