2

I've got a small c++ script on my raspberry pi which I want to execute from PHP on my small webserver, when I run the following command in my CLI the code executes : "/home/pi/kaku 1 a on". But when I run the following PHP code on my webserver shell_exec("/home/pi/kaku 1 a on"); the code that gets triggered by php simply doesn't run, When I don't give in any parameters by running shell_exec("/home/pi/kaku"); Than I simply get response that I need to fill in the parameters. The c++ code can be found overhere: https://github.com/chaanstra/raspKaku

The permissions of /home/pi/kaku has been set to 777 by using chmod for testing purposes. I am wondering why is my code not running?

3
  • What about shell_exec("/home/pi/kaku a 1 on") (change order of the first and second argument) ? Because from the code on github, the second argument should be a number : device = atol(argv[2]); If argv[2] does not begin with 0-9, device will be 0 ? Commented May 6, 2017 at 8:17
  • Doesn't seem to resolve my issue, I created a bash file , which simply run the same command which I run in the CLI if I run the bash script from the CLI the programm works, when I run the l bash script from Shell_EXEC is simply doesn't work, I added a echo in the bashfile, the echo is returned to my webbrowser Commented May 6, 2017 at 21:46
  • Issue was due rights of the www-data user, stackoverflow.com/questions/538939/… Commented May 7, 2017 at 19:15

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.