Hello, all,

After looking everywhere in the forums, I still need to find my answer..

I (like many others) have trouble executing a program from PHP using system() or passthru().
In this case I want to use tidy to get the buffered output of the page in a nice form, but later I also want to get other programs to interact with PHP.

Of course I have been looking at permissions, I put tidy in a separate directory and gave permissions to the apache user and group (that's the user in Redhat). I give the full path to tidy and so on.

Nothing seems to work. But to my surprise, when I include a phpinfo() command in my script, the passthru() command is executed, and everything is formatted just fine, including the things that did not work before...😕

Does anybody have any idea what is happening here? Thanks in advance!

I'm using RH linux (9.0) and PHP 4.2.2; apache 2.0.40

    system() returns standard output, to get error output, too
    append 2>&1 to your command
    system("ls -l 2>&1");

    maybe that helps you

      Thank you, ir4z0r, but the trouble remains.

      If I check the value that you can get from the

      system(cmd, $result)

      call, it returns 0, indicating no errors.

      Actually, some of the commands do work, a shell script containing something like

      echo $1 > /tmp/temp.txt

      statement will correctly write a file with the first parameter of the command.

      Now all this sounds like some kind of permissions problem, but as I log in as apache user (the httpd user name), I can execute all the necessary commands at will.... 🙁

      I am starting to think about bugs in PHP, but the source (4.2.2) looks ok at first sight. Maybe some kind of threading problem? 😕

      Anyway, if anybody has any ideas, I'd be very happy...:rolleyes:

      Thanks! Henk

        Write a Reply...