CodeIgniter Forums
Database Error when running via command line - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: Database Error when running via command line (/thread-10200.html)



Database Error when running via command line - El Forum - 07-22-2008

[eluser]Paul Wenzel[/eluser]
I am attempting to run a CodeIgniter app via the OSX command line. The goal is to automate webkit2png, which needs to be run from a local account (not Apache).

After following the CronScript instructions in the wiki, I am getting the error Unable to connect to your database server using the provided settings.

This error message appears only when I run the script via the command line PHP binary, but not when I run it through my web server (in my web browser). Anyone else run in to database issues when doing CI command line?

Thanks!


Database Error when running via command line - El Forum - 08-01-2008

[eluser]dmorin[/eluser]
Did you ever figure this out? I'm having the same issue running CLI on OS X.


Database Error when running via command line - El Forum - 08-01-2008

[eluser]dmorin[/eluser]
Just in case anyone is still looking for the answer, it looks like the php version that comes with os x is missing some things from the cli.

So, if you're running MAMP (or something similar) instead of just running

Code:
php script.php

you need to run

Code:
/Applications/MAMP/bin/php5/bin/php script.php



Database Error when running via command line - El Forum - 08-01-2008

[eluser]Paul Wenzel[/eluser]
Very interesting! I was using Marc Liyanage's PHP 5 binary (from entropy.ch) for my web server. When I ran it from the CLI, it was probably using OSX's built in version of PHP. I'll have to give it another go this weekend.