简体   繁体   English

Ubuntu无法在PHP中执行exec(test.sh)

[英]ubuntu cant execute exec(test.sh) in php

In my php code: 在我的PHP代码中:

exec(test.sh);

and test.sh has code: 和test.sh具有代码:

echo "Hi this is test?" | espeak --stdout > demo.wav

But nothing happen. 但是什么也没发生。 No error, No output. 没有错误,没有输出。

If i try to execute test.sh from terminal that it will work perfectly. 如果我尝试从终端执行test.sh,它将运行完美。 So why it not run on my php. 那么,为什么它不能在我的PHP上运行呢?

Can someone help me? 有人能帮我吗?

How do you run your PHP script? 您如何运行PHP脚本? With php-cli (in shell mode)? 用php-cli(在shell模式下)? HTTP (Apache, ...)? HTTP(Apache,...)?

It could be a path problem. 这可能是路径问题。 Could you give us the path of your test.sh, the path of your php script or the URI which is called to run the PHP if you use apache or other HTTP server? 如果您使用的是Apache或其他HTTP服务器,能否给我们test.sh的路径,php脚本的路径或运行PHP的URI?

apache用户将需要对当前工作目录(大概是包含您的php脚本和test.sh的目录)具有写权限。

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

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