Exec() & System() not Working?

Discussion in 'Programmer Misc' started by VikR, Nov 10, 2010.

  1. VikR

    VikR Guest

    When executed from the terminal, the following command works
    perfectly:

    gnuplot '/Applications/IPG/htdocs/ftp/company_name/Charts/
    gnuPlotCommandFile.gp'

    However, when I run it from inside PHP with:

    exec("gnuplot '/Applications/IPG/htdocs/ftp/company_name/Charts/
    gnuPlotCommandFile.gp'");

    ....or:

    system("gnuplot '/Applications/IPG/htdocs/ftp/company_name/Charts/
    gnuPlotCommandFile.gp'");

    ....nothing seems to happen. How can I correct this?

    Note - exec is enabled on my system, according to the following
    function:

    function exec_enabled() {
    $disabled = explode(', ', ini_get('disable_functions'));
    return !in_array('exec', $disabled);
    }

    Thanks very much in advance to all for any info.
     
    VikR, Nov 10, 2010
    #1
    1. Advertisements

  2. VikR

    VikR Guest

    Thanks very much for your help. It's working now. Code currently being
    used:

    $shellCommmand = "/usr/local/bin/gnuplot '" . $pathToCommandFile .
    "'";
    $output = system($shellCommmand . " 2>&1");
     
    VikR, Nov 10, 2010
    #2
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.