RE: [PHP] Functions not available when run as Scheduled Task?
| From: | Andrés Robinet | Date: | Wed, 27 Feb 2008 23:46:14 +0000 |
| Subject: | RE: [PHP] Functions not available when run as Scheduled Task? | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-270487@lists.php.net to get a copy of this message | ||
> -----Original Message-----
> From: Ray Hauge [mailto:ray.hauge.lists@gmail.com]
> 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"