0

In my php code:

exec(test.sh);

and test.sh has code:

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. So why it not run on my php.

Can someone help me?

Android Developer
  • 987
  • 1
  • 8
  • 22
ishita
  • 63
  • 1
  • 1
  • 5
  • could be a couple of things: are you executing php from command line or using apache? if you are using apache does it has execute rights on test.sh? Do you see any error on the error_log of the apache/webserver you are using? – Naryl Oct 23 '13 at 11:01
  • possible duplicate: http://stackoverflow.com/questions/7397672/how-to-run-a-sh-file-from-php – aaron Oct 23 '13 at 11:02
  • I am executing php from apache. test.sh already has execute right. There is no error in error_log. – ishita Oct 23 '13 at 12:24

2 Answers2

0

How do you run your PHP script? With php-cli (in shell mode)? 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?

Idriss Neumann
  • 3,760
  • 2
  • 23
  • 32
  • I am running php on http(Apache). It is not a path problem if i echo "some text" in test.sh it will work fine. but espeak could not create demo.wav file from php file. Please help me on this. – ishita Oct 23 '13 at 11:40
  • When you run your shell script with the command line, do you delete the output file demo.wav? What are the access of the current directory? – Idriss Neumann Oct 23 '13 at 18:02
  • Ya I did delete that file. From command line it workks. But but from LAMP server it wont generate the output. That directory had 777 permission. – ishita Oct 24 '13 at 05:37
0

the apache user will need write access to the current working directory (presumably the same directory that contains your php script and test.sh).

Cwissy
  • 2,006
  • 15
  • 14
  • Both file had write access. I think problem with espeak command. I already had espeak in my ubuntu and its works as application. – ishita Oct 24 '13 at 05:40