PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
JimiH
Forum Commoner
Posts: 92 Joined: Thu Jun 15, 2006 6:10 am
Post
by JimiH » Tue Jul 28, 2009 7:13 am
Hello I have the following bat file that calls up a php script
Code: Select all
@echo OFF
"c:\Progra~1\php\php.exe" email_open_vsi.php %*
This is supposed to run a php script that fires off an email however I cant get it to work from the batch file,
running the php script from the browser is not a problem.
This is the error the batch files displays
Code: Select all
PHP Fatel error: Call to undefined function mysql_query() etc etc
Anyone have any ideas?
Thanks
Geoff
caltoche
Forum Newbie
Posts: 6 Joined: Mon Jul 27, 2009 8:46 am
Post
by caltoche » Tue Jul 28, 2009 10:02 am
Does mysql_connect and mysql_select_DB works ?
JimiH
Forum Commoner
Posts: 92 Joined: Thu Jun 15, 2006 6:10 am
Post
by JimiH » Wed Jul 29, 2009 4:26 am
No none of them work when called from the batch file. I did have an "include" to a connection php file but
have moved all this into my main php file.
Now its fails on the mysql_connect()
Its like when mysql is called from the command line it doesn't exist, but if called from the browser it does?
mysql is enabled and I can see it in the info.php
Thanks
Geoff
VladSun
DevNet Master
Posts: 4313 Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria
Post
by VladSun » Wed Jul 29, 2009 4:29 am
PHP CLI and PHP Apache module are different things.
You have a separate php.ini for PHP CLI and you must include MySQL library in it.
PS:
http://www.php.net/manual/en/features.commandline.php
Look at the -c option
There are 10 types of people in this world, those who understand binary and those who don't
JimiH
Forum Commoner
Posts: 92 Joined: Thu Jun 15, 2006 6:10 am
Post
by JimiH » Wed Jul 29, 2009 5:48 am
Thanks, I'm using PHP CLI
Shown by typing php -v
Code: Select all
C:\Documents and Settings\ajlsvradmin>php -v
PHP 5.2.5 (cli) (built: Nov 8 2007 23:18:51)
Copyright (c) 1997-2007 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies
Also there is only one php.ini on the IIS server and this has mysql enabled?
Geoff
JimiH
Forum Commoner
Posts: 92 Joined: Thu Jun 15, 2006 6:10 am
Post
by JimiH » Wed Jul 29, 2009 6:28 am
Ok, you where right I had two php.ini's
Now the code executes from the command line but throws an error about a missing dll "php4ts.dll"
Thanks
Geoff
JimiH
Forum Commoner
Posts: 92 Joined: Thu Jun 15, 2006 6:10 am
Post
by JimiH » Thu Jul 30, 2009 4:08 am
Reinstalled PHP 5, now everything working correctly