dcsimg
www.webdeveloper.com
Results 1 to 6 of 6

Thread: trying to execute program using shell_exec gives no output and no error

  1. #1
    Join Date
    May 2015
    Posts
    24

    trying to execute program using shell_exec gives no output and no error

    PHP Code:
    $output shell_exec("\root\bin\root.exe -l -q cv_root.C");
    echo 
    "<pre>$output</pre>"

  2. #2
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    21,108
    Is this being run on a Windows system? (From the "\" and the ".exe" suffix I'd guess so, but just wanted to make sure, as the path seems a bit odd for Windows.)

    To see exactly what it returned:

    PHP Code:
    echo "<pre>".var_export($outputtrue)."</pre>"

    Per the manual:
    Note:

    This function can return NULL both when an error occurs or the program produces no output. It is not possible to detect execution failures using this function. exec() should be used when access to the program exit code is required.
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    How to Ask Questions the Smart Way (not affiliated with this site, but well worth reading)

  3. #3
    Join Date
    May 2015
    Posts
    24
    it says null.

    this program when i run using command prompt this program generates image files. Actually i want to run this code in main code and the image files produced by this program will be displayed.

    please give me a solution to run it, it works perfectly using command prompt.

  4. #4
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    21,108
    Could it be a permissions issue? (Remember that if the PHP script is being run via the web server, then that is normally its own user, so the executable file may need more global read/execute permissions.)
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    How to Ask Questions the Smart Way (not affiliated with this site, but well worth reading)

  5. #5
    Join Date
    May 2015
    Posts
    24
    sir i ran this code
    <?php
    $output = shell_exec("root -l -q final.C");
    echo "<pre>".var_export($output, true)."</pre>";
    ?>
    and got the files i wanted in desired folder but also got this on web page.. is it normal?
    '
    Processing cv_root.C...

    (process:5880): Gdk-WARNING **: gdkdrawable-win32.c:697: BitBlt failed: The handle is invalid.

    (process:5880): Gdk-WARNING **: gdkdrawable-win32.c:697: BitBlt failed: The handle is invalid.

    (process:5880): Gdk-WARNING **: gdkdrawable-win32.c:697: BitBlt failed: The handle is invalid.

    (process:5880): Gdk-WARNING **: gdkdrawable-win32.c:697: BitBlt failed: The handle is invalid.
    '

  6. #6
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    21,108
    Well, you're pretty far outside the realm of PHP now, so I'd suggest trying to find out from the GDK experts what that means:

    https://www.google.com/search?q=Gdk-...dle+is+invalid
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    How to Ask Questions the Smart Way (not affiliated with this site, but well worth reading)

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles