Hi Ralph You were absolutely right; I had the wrong ini values in my php cli. It seems to work now. Thanks very much!
I will keep my eyes peeled for the Zend_Application - that would be very useful indeed. -max Ralph Schindler-2 wrote: > > First thing to check, ensure your PHP executable (php cli) is both using > the > same ini values as well as the same extensions as the php apache sapi. > That > might be the reason why you have a mysql driver available in php for > apache > but not in the php for cli. > > The other issues you are describing are use cases is one that is currently > being discussed in the Zend_Application proposal. > > The idea in Zend_Application is that the bootstrap available to the web > application is the same bootstrap available to your projects cli scripts. > This means that you'll have access to your models, database connections, > cache objects, so on and so forth. Also, you wont be using the Front > Controller, which is unneeded in your cli scripts. > > http://framework.zend.com/wiki/display/ZFPROP/Zend_Application+-+Ben+Scholze > n > > -ralph > > > On 2/25/09 1:41 PM, "max_ent" <[email protected]> wrote: > >> >> Hi everyone >> >> I am trying to write command-line accessible scripts that have access to >> my >> Zend Framework model classes. >> Some of these model classes make database calls. The end goal is to >> invoke a >> CRON job, which will record user data at regular intervals >> >> I have followed the advice present in many other posts: >> >> 1. Created a minimal bootstrap (cli2.php) >> 2. Got the include path correct >> 3. Call the model class after the bootstrap code, in the same file >> 4. Invoke, at the command line, php cli2.php >> >> I have been stuck at the stage where the model class needs to fetch rows >> from the database, and I get the following error message: >> Fatal error: Uncaught exception 'Zend_Db_Adapter_Exception' with message >> 'The mysql driver is not currently installed' in >> /Users/ak/Zend/workspaces/DefaultWorkspace/testingProject/library/Zend/Db/Adap >> te >> r/Pdo/Abstract.php:116 >> Stack trace: >> #0 >> /Users/ak/Zend/workspaces/DefaultWorkspace/testingProject/library/Zend/Db/Adap >> ter/Abstract.php(417): >> Zend_Db_Adapter_Pdo_Abstract->_connect() >> #1 >> /Users/ak/Zend/workspaces/DefaultWorkspace/testingProject/library/Zend/Db/Adap >> ter/Pdo/Abstract.php(230): >> Zend_Db_Adapter_Abstract->query('SELECT * ? ...', Array) >> #2 >> /Users/ak/Zend/workspaces/DefaultWorkspace/testingProject/library/Zend/Db/Adap >> ter/Abstract.php(663): >> Zend_Db_Adapter_Pdo_Abstract->query('SELECT * ? ...', Array) >> #3 >> /Users/ak/Zend/workspaces/DefaultWorkspace/testingProject/application/default/ >> models/User.php(57): >> Zend_Db_Adapter_Abstract->fetchRow('SELECT * ? ...', Array) >> #4 >> /Users/ak/Zend/workspaces/DefaultWorkspace/testingProject/application/cli2.php >> (64): >> User->load() >> #5 {main} >> thrown in >> /Users/ak/Zend/workspaces/DefaultWorkspace/testingProject/library/Zend/Db/Adap >> ter/Pdo/Abstract.php >> on line 116 >> >> Now, instantiating the User object and calling its load method work from >> the >> Framework web front end. Can anybody please tell me what I'm doing wrong, >> in >> that it believes the PDO_MySql driver isn't load >> ed? >> >> I have also considered using wget against an obscure controller/action >> path, >> but I feel that this isn't acceptable for security reasons (as the >> originating address can be spoofed). I would like a simple script that >> can >> be invoked directly from php. >> >> Any help would be highly appreciated >> >> Thanks! > > -- > Ralph Schindler > Software Engineer | [email protected] > Zend Framework | http://framework.zend.com/ > > > > -- View this message in context: http://www.nabble.com/Accessing-Zend-Framework-from-the-Command-Line-tp22210030p22216437.html Sent from the Zend Framework mailing list archive at Nabble.com.
