Hi,

Could anyone please help me?

The exec command from PHP does not return anything on win xp.

This is my code:
$command='M:\gs\gs8.00\lib\ps2ascii M:\gs\gs8.00\lib\a.pdf'
exec($command,$resultArray,$rv);

The application “'M:\gs\gs8.00\lib\ps2ascii” works fine from the command line.
With exec I get an empty $resultArray.

Does anyone know a solution?

(I am getting desperate)
Thanks in advance,

Charles.
cvlug@xs4all.nl

    I didn't look at your code to see if there was a syntax error or anything but try system() instead of exec().

      I tried that already, it did not help.
      When jou search for exec in this forum, you see lot's of other people having the same problem. But nobody has a solution.

      I think a possible solution is to spawn the console proces(http://support.microsoft.com/default.aspx?scid=kb;en-us;Q190351).
      The sample code given on the url above is a mistery for me.

      An other usefull url is:http://mail.python.org/pipermail/python-list/1999-October/014329.html

      But i have no idea where to put this code or what to do with it.

      Do you have any idea?

      thanks for the reaction anyway
      Charles

        Try just putting the command in backticks ` (not '). It returns a string that contains the output of the program, so then you can just [man]echo()[/man] the string.

        (Please note that I have never tried this, so don't ask me any more about the backtick. This workaround was passed on to me by a friend at uni)

          $command='M:\gs\gs8.00\lib\ps2ascii M:\gs\gs8.00\lib\a.pdf'
          should be $command='M:\gs\gs8.00\lib\ps2ascii M:\gs\gs8.00\lib\a.pdf';

          It may not fix your problem but it will keep you from getting other problems down the road if/when you try to expand the script.

            Hi,
            I tried all the sugestions, non of them work out.
            It not only impossible to get output from the exec function.

            The external program I’m using translates pdf to text, and writes the text to a file with the following code from the command line:

            “M:\gs\gs8.00\lib\ps2ascii M:\gs\gs8.00\lib\a.pdf M:\gs\gs8.00\lib\a.txt” (called from the lib directory)

            This works fine. However with exec it writes an empty text file, when using the following code:

            from exec:
            ”exec('M:\gs\gs8.00\lib\ps2ascii M:\gs\gs8.00\lib\a.pdf M:\gs\gs8.00\lib\a'.txt,$resultArray,$rv);” (called from my web-directory)

            What can it be?

            Charles.

              Where can I download this program? I want to try a couple of things.

                5 days later

                Oye. Sorry I haven't replied in so long. College is taking over my life at the moment. 🙁

                  Write a Reply...