CodeIgniter Forums

Full Version: Database Error when running via command line
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[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!

El Forum

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

El Forum

[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

El Forum

[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.