0

I need to execute a scheduled task each minute that performs data extraction from MS Server. Yet trying with bat script the php, would cause errors not recognizing sqlsrv functions

here is the content of the bat file:

cd C:\wamp\bin\php\php5.3.13
PHP C:\wamp\www\bin\Scripts\MinutelyScript.php

the MinutelyScript.php file works fine if executed from the server. Please help me :)

Mihai Iorga
  • 39,330
  • 16
  • 106
  • 107
  • checkout getting a url - http://stackoverflow.com/questions/4619088/windows-batch-file-file-download-from-a-url OR http://stackoverflow.com/questions/295386/how-to-run-a-php-file-in-a-scheduled-task-windows-task-scheduler – Waygood Mar 26 '13 at 09:09
  • try running it locally `cd C:\wamp\www\bin\ ` then `PHP MinutelyScript.php` php should be in your include path – Waygood Mar 26 '13 at 09:10
  • possibly duplicate? [PHP 5.3 not recognizing Native Client to connect to MS SQL][1] [1]: http://stackoverflow.com/questions/9824162/php-5-3-not-recognizing-native-client-to-connect-to-ms-sql – orrollo Mar 26 '13 at 09:12

1 Answers1

0

Add this to your batch file

//path to your website
cd \wamp\www\yourwebsite

c:\wamp\bin\php\php5.3.5\php-cgi.exe -c  c:\wamp\bin\php\php5.3.5\php.ini -f cronfile.php

"cronfile.php" if file is at root folder if it is inner folder give path from root folder

Mahendra
  • 908
  • 1
  • 18
  • 38