I am helpng somebody run a shell script from php and he needs to get the variables created in the script back into the php code when the shell script is finished.
I have suggested he creates the variables in php and send those to the shell script instead; he could do this but would prefer to use the shell script if possible.
This is the code I am using to call the shell script:
Well, exec() returns the last line of the output from the shell command, so if the shell script is returning output like “value” or “a, b, c” you can capture this output in a var or array as needed.
Thats something to think about old_iron and I will do some tests.
I should have put some more info in my post - the image is a CAPTCA image and the characters are generated in the shell script. He needs the characters generated to check against in the form.
The shell script is being written so it can be used by different software.
I have suggested he has the image in the memory only and not save it. The code he has written at the moment has everything hard coded as a test.
I still think the way to go is get php ( or whatever other software ) to generate the random characters and then send them to the shell script.
Thanks for the replys; I have not tried shell_exec() yet and we are trying to think of another way to solve the problem - lateral thinking !
Ernie1 - I only get one x displayed and that is coming from the shell script; if I comment out echo $re I get nothing displayed.
I would assume I should have xx One x from the shell script and the other from the php code ?
If you are using some hosting company to host your pages then I think shell_exec and maybe some others also can be forbidden. If you are running own server then it might be some settings also. I dont know more about these settings… I just know some hosting companies disables these.