-PHP-exec command for gnuplot

software development


Hi there!
I´m looking for help related on how to call external executables like gnuplot in php.
Right now, I´m using Wamp server (Lamp for Windows) for tests and troubleshooting.

I don’t know how to do it if I upload the files to dreamhost. Dreamhost support team told me that they have in the server the gnuplot application.

Well here is my code in my wamp:

$runCommand = ‘C:\gnuplot.exe “c:\test.tmp”’;
$WshShell = new COM(“WScript.Shell”);
//finally the call
$output = $WshShell->Exec($runCommand)->StdOut->ReadAll;

I will appreciate any help related on executing external programs and precisely gnuplot.

Best wishes for 2010.


The approach you’re using certainly won’t work, as it 1) assumes that the executable is located at C:\gnuplot.exe - which doesn’t even make sense on Linux - and 2) it uses WScript.Shell, which doesn’t exist on Linux. Read up on http://php.net/pcntl_exec.