troubleshooting Question

PHP exec, passthru, system or shell_exec??? Running Batch from a web server.

Avatar of CrisThompsonUK
CrisThompsonUKFlag for United Kingdom of Great Britain and Northern Ireland asked on
6 Comments3 Solutions1494 ViewsLast Modified:

Enough banging my head against the wall...

I'm building an application in PHP made up of web server stuff and batch stuff...

Most of the time the batch stuff will run off of a cron schedule, but every now and then, and for testing, we want to be able to fire off the batch from a web interface.

Here's what's going on:

In the batch I have:
removed all reference to HTTP variables
set the carriage returns to UNIX format
It runs ok from the command line.  Lovely

Then I have a webpage calling the batch, and I can't get it to work.
I have tried both exec and passthru and both of them seem to work (exec gives what looks like error 0 - everything's fine) as far as the web page is concerned.

The web page calls the exec/passthru, but nothing happens.  It doesn't product output (will write to sql table when it's working), and more 'interestingly' nothing appears in the logs for it.

Even more 'interesting' is that when I use an obviously wrong filename for the batch, exec still reports 0 and nothing ends up in the log.




Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 3 Answers and 6 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 3 Answers and 6 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros