Hi all, if you have any information on this topic it would be greatly appreciated.
I am trying to use php to run a shell script that I wrote. The name of the script is bintest and it currently resides in the same directory as all of my php files.

I have tried exec("bintest");
I've also tried fopen, system, and passthru

I can't get any of these functions to execute the file. Does anyone know how to do this?

    You should use absolute path to the script or the script should be in your search path ($PATH).

    Zdenek

      The script is in my search path and I have tried putting the absolute full path, still no results. I have read that I may beed to install a program called sudo. Does anyone know if this is really necessary?

        I use exec() to run shell scripts, it works for me. My question is, have you given the user permission to run the scripts. Assuming you are using Apache and PHP as a mod, you will need to give apache (or nobody) execute permission on the script.

          2 months later

          I have been trying to do the same thing.

          I have given the script execute rights to world and all it is doing (as a test) is to write 3 variables from a MySQL database record and append to a text file in the same directory.

          The script works fine at the command prompt.

          Just not sure whe4re the problem lies.

            Write a Reply...