/    Sign up×
Community /Pin to ProfileBookmark

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

[code=php]
$output = shell_exec(“rootbinroot.exe -l -q cv_root.C”);
echo “<pre>$output</pre>”;
[/code]

to post a comment
PHP

5 Comments(s)

Copy linkTweet thisAlerts:
@NogDogNov 09.2015 — 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:

[code=php]echo "<pre>".var_export($output, true)."</pre>";[/code]


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.
[/quote]
Copy linkTweet thisAlerts:
@rock24authorNov 10.2015 — 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.
Copy linkTweet thisAlerts:
@NogDogNov 10.2015 — 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.)
Copy linkTweet thisAlerts:
@rock24authorNov 16.2015 — sir i ran this code
<?php

$output = shell_exec("root -l -q final.C");

echo "<pre>".var_export($output, true)."</pre>";


?>[/QUOTE]


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.

'
[/QUOTE]
Copy linkTweet thisAlerts:
@NogDogNov 16.2015 — 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-WARNING+BitBlt+failed%3A+The+handle+is+invalid
×

Success!

Help @rock24 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...