How can I execute a file "name.exe" via Windows NT using PHP? This file admits one parameter (it can be "e" or "s") and returns HTML code. The format is (in DOS console execution): "name /e" (e.g.). I use the "passthru" PHP function, but it does not do what it is supposed to do with my program.
However, if I use it to execute a DOS command, it works:echo passthru("dir") prints all the files and dates of the directory!
I have tried to type:
echo passthru("name.exe /e")
and also:
echo passthru("cmd /c name.exe /e")
but the result is the same.
How could I do it in Linux?
Thank you very much for reading this.

    Have you thought that PHP doesnt know where name is?

    It will have to be in your PATH or you will need to specify the full path to the app

    eg:

    passthru("c:\temp\foo");

    Remember to escape the windoze backslashes. (I have know idea how PHPbuilder will treat this but its two backslashes for each one you want to replace.

    mn

      First of all, thank you for replying me.
      I have put the file into the directory where my PHP file is. When I use "passthru" it might know that it is there (but the fact is that the web page lasts a lot of time to appear, and finally appears a message telling me that the time have been exceeded.
      If it can help, I must say that the executable file is a Pascal one. I have tried with a complied C program and it works perfectly! One person here has told me that perhaps it can be because Pascal is old and works with 16 bits, and that using FreePascal the problem will be solved. Well, I have compiled a simple Pascal program and the problem is still there.

        Write a Reply...