[PHP] Functions not available when run as Scheduled Task?

2008-02-27 Thread Brian Dunning
Don't laugh but we have a Win 2003 Server set up with WAMP, and the  
PHP/MySQL scripts work great. I set one up to run as a scheduled task:


C:\php5\php.exe D:\wamp\www\scriptname.php

...but nothing happens and the Scheduled Tasks log says that it exited  
with an (ff). So I entered the above manually into a command prompt,  
and it said that mysql_connect() is an unknown function! WTF? It's  
like it's trying to use a different php.ini file that maybe has mysql  
commented out. I double checked that all the php.ini files on the  
machine do have mysql enabled, and anyway mysql works fine normally.


Anyone know what PHP is doing to me here in the scheduled service?

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Functions not available when run as Scheduled Task?

2008-02-27 Thread Ray Hauge

Brian Dunning wrote:
Don't laugh but we have a Win 2003 Server set up with WAMP, and the 
PHP/MySQL scripts work great. I set one up to run as a scheduled task:


C:\php5\php.exe D:\wamp\www\scriptname.php

...but nothing happens and the Scheduled Tasks log says that it exited 
with an (ff). So I entered the above manually into a command prompt, and 
it said that mysql_connect() is an unknown function! WTF? It's like it's 
trying to use a different php.ini file that maybe has mysql commented 
out. I double checked that all the php.ini files on the machine do have 
mysql enabled, and anyway mysql works fine normally.


Anyone know what PHP is doing to me here in the scheduled service?



I think that there might be a separate php-cli.ini file that is not 
loading the modules that apache does.  I'm too lazy to verify, but I 
remember running into that myself a time or two.  Check the output of 
phpinfo(); or C:\php5\php.exe -v (I think that'll work on Windows).


--
Ray Hauge
www.primateapplications.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Functions not available when run as Scheduled Task?

2008-02-27 Thread Daniel Brown
On Wed, Feb 27, 2008 at 6:37 PM, Brian Dunning [EMAIL PROTECTED] wrote:
 Don't laugh but we have a Win 2003 Server set up with WAMP, and the
  PHP/MySQL scripts work great. I set one up to run as a scheduled task:

  C:\php5\php.exe D:\wamp\www\scriptname.php

  ...but nothing happens and the Scheduled Tasks log says that it exited
  with an (ff). So I entered the above manually into a command prompt,
  and it said that mysql_connect() is an unknown function! WTF? It's
  like it's trying to use a different php.ini file that maybe has mysql
  commented out. I double checked that all the php.ini files on the
  machine do have mysql enabled, and anyway mysql works fine normally.

Try doing this:

?
// D:\wamp\www\phpinfo.php
phpinfo();
?

Then run the command:

C:\php5\php.exe D:\wamp\www\phpinfo.php  D:\wamp\www\phpinfo.html

Then view phpinfo.html in a browser.  See how the php.ini and the
MySQL settings are set, and if need be, correct them.  Viewing
phpinfo.php in the browser may show different results.

-- 
/Dan

Daniel P. Brown
Senior Unix Geek
? while(1) { $me = $mind--; sleep(86400); } ?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Functions not available when run as Scheduled Task?

2008-02-27 Thread Andrés Robinet
 -Original Message-
 From: Ray Hauge [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, February 27, 2008 6:42 PM
 To: Brian Dunning
 Cc: php-general@lists.php.net
 Subject: Re: [PHP] Functions not available when run as Scheduled Task?
 
 Brian Dunning wrote:
  Don't laugh but we have a Win 2003 Server set up with WAMP, and the
  PHP/MySQL scripts work great. I set one up to run as a scheduled task:
 
  C:\php5\php.exe D:\wamp\www\scriptname.php
 
  ...but nothing happens and the Scheduled Tasks log says that it exited
  with an (ff). So I entered the above manually into a command prompt, and
  it said that mysql_connect() is an unknown function! WTF? It's like it's
  trying to use a different php.ini file that maybe has mysql commented
  out. I double checked that all the php.ini files on the machine do have
  mysql enabled, and anyway mysql works fine normally.
 
  Anyone know what PHP is doing to me here in the scheduled service?
 
 
 I think that there might be a separate php-cli.ini file that is not
 loading the modules that apache does.  I'm too lazy to verify, but I
 remember running into that myself a time or two.  Check the output of
 phpinfo(); or C:\php5\php.exe -v (I think that'll work on Windows).
 
 --
 Ray Hauge
 www.primateapplications.com
 
 --

Use the -c command line option to be sure, for example:

C:\php5\php.exe -c C:\php5\php.ini -f D:\wamp\www\scriptname.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Functions not available when run as Scheduled Task?

2008-02-27 Thread Jochem Maas

Brian Dunning schreef:
Don't laugh but we have a Win 2003 Server set up with WAMP, and the 
PHP/MySQL scripts work great. I set one up to run as a scheduled task:


C:\php5\php.exe D:\wamp\www\scriptname.php

...but nothing happens and the Scheduled Tasks log says that it exited 
with an (ff). So I entered the above manually into a command prompt, and 
it said that mysql_connect() is an unknown function! WTF? It's like it's 
trying to use a different php.ini file that maybe has mysql commented 
out. I double checked that all the php.ini files on the machine do have 
mysql enabled, and anyway mysql works fine normally.


Anyone know what PHP is doing to me here in the scheduled service?


AFAIK php on windows is generally built with all relevant modules included
(check the php.ini used by apaches mod_php and you'll probably notice the
extension=php_mysql.dll line is actually commented out)

my guess would be that the CLI version of php is built without the mysql
extension.

and if it's not that then it's probably down to difference in php.ini after all.





--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Functions not available when run as Scheduled Task?

2008-02-27 Thread Brian Dunning
Adding this command solved it. Thanks to everyone! I did not even know  
this command existed.



On Feb 27, 2008, at 3:46 PM, Andrés Robinet wrote:


Use the -c command line option to be sure, for example:


C:\php5\php.exe -c C:\php5\php.ini -f D:\wamp\www\scriptname.php

--


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php