PHP via Cmd line (Windows Server)

A

Anonymous

Guest
Hi there,

we're running Windows SBS 2008 with IIS7. Our main homepage is a Drupal site. Drupal has a cronjob, which we used to run via Scheduled Tasks with a .bat file.
The .bat file runs the following:
Code:
C:\PHP\php.exe C:\inetpub\wwwroot\cron.php

This worked fine for some time, but now there's a problem. Scheduled Task is still executed at the right time. But the cron.php seems not to run correctly. After some testing, I figured out that include() or require() seems to be the problem. If ran via HTTP no problem, but running in cmd-line the script is stopping when it should include another file. Error log is not reporting anything at all on this... and Google search isn't helpful this time.

Maybe I don't see the wood for the trees, but can someone help me or give a hint?

Regards, nanocyte
 
Update: exactly, the include seems to work, but the script is stopping, when it should call a function, that is defined in this included file.
 
Try changing the include statement to use the absolute path, instead of the relative path.
 
Thanks for your response.
Well, now the cron-script includes the file correctly. But this included file includes several other files -.- Well, I could edit all these include(). But once Drupal is updated the changes will have to be done another time (if there is a newer version). This script was running correctly previously but not any more. Is there an other solution? Maybe changing include path in php.ini or something? What else could effect this behaviour?
 
try putting your script in the same directory as the first include..
 
Yes, this will also include the first one... but not the rest.
 
Problem found: For whatever reason, PHP.exe wasn't in the folder as before any more. So I added two lines in my batch script:
Code:
C:
cd /inetpub/wwwroot
C:\php\php.exe C:\inetpub\wwwroot\cron.php
This worked for the includes.

Next problem was this:
includes/common.inc around line 2660 in function _drupal_bootstrap_full(). There's a drupal_set_header('Content-Type: text/html; charset=utf-8'); which caused the execution via command line to stop immediately. Commenting out this line solved the issue. But has anyone an idea why this causes the script to stop when executed in cmd.exe ?
 
Back
Top