By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,409 Members | 1,604 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,409 IT Pros & Developers. It's quick & easy.

shell_exec causing CGI ERROR

P: n/a
I have a php page that needs to call a batch script. My test script
has one line: echo test.

I am running Win2003 Server, IIS, and php 4.3.10.

When I first tried running my php script I got an error that said
"unable to execute ...". Then I granted the IIS user execute
privledges to cmd.exe (I know, I know ... security risk).

Once I did that, my script gives me a CGI ERROR - something about http
headers.

I've scoured google groups and come up with nothing that works. I
tried one solution that uses an executable called bgrun.exe. That exe
calls my batch script - still no luck. I've tried exec() and
shell_exec(). No difference. I've tried saving the result to a
variable and not. No difference.

Any help would be greatly appreciated.

Thanks,

Matt

Jul 17 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
try system() command instead of exec(). e.g.

consider following example taken from PHP Manual

<?php
echo '<pre>';

// Outputs all the result of shellcommand "ls", and returns
// the last output line into $last_line. Stores the return value
// of the shell command in $retval.
$last_line = system('ls', $retval);

// Printing additional info
echo '
</pre>
<hr />Last line of the output: ' . $last_line . '
<hr />Return value: ' . $retval;
?>

Jul 17 '05 #2

P: n/a
Nope. I entered it exactly as written in your post (and in the php
manual). Still no luck.

I've given up. I'm switching to apache.

- Matt

Jul 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.