Link to home
Create AccountLog in
Avatar of CrisThompsonUK
CrisThompsonUKFlag for United Kingdom of Great Britain and Northern Ireland

asked on

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

Hi.

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.

HELP!!!!!

Thanks,

Cris.
ASKER CERTIFIED SOLUTION
Avatar of gr8gonzo
gr8gonzo
Flag of United States of America image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
SOLUTION
Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
SOLUTION
Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
Avatar of CrisThompsonUK

ASKER

Thanks Guys,

I'll get the systems guy to have a look at permissions when he gets in and report back.

Cris.
I've requested that this question be closed as follows:

Accepted answer: 250 points for gr8gonzo's comment #a39311305
Assisted answer: 125 points for julianH's comment #a39311450
Assisted answer: 125 points for DaveBaldwin's comment #a39311559
Assisted answer: 0 points for CrisThompsonUK's comment #a39313475

for the following reason:

Thanks,  It came out in thhe wash when the users were all set up correctly.

Thanks,

Cris.
Is there a reason you gave a B grade instead of A, if the user permissions were the issue?