Love Fuel?
Donate
About
Forums
Discussions
Login
FuelPHP Forums
Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
General
Tasks - DB error
Jume
July 2014
I am writing a task and when running a task method trough php oil refine I get somekind of Database error:
$ php oil refine converter:new_textbook
Uncaught exception Fuel\Core\Database_Exception: SQLSTATE[HY000] [2002] No such file or directory
Callstack:
#0 /Users/primozr/Dropbox/www/ucbeniki/fuel/core/classes/database/pdo/connection.php(167): Fuel\Core\Database_PDO_Connection->connect()
#1 /Users/primozr/Dropbox/www/ucbeniki/fuel/core/classes/database/query.php(287): Fuel\Core\Database_PDO_Connection->query(1, 'SELECT `t0`.`st...', false)
#2 /Users/primozr/Dropbox/www/ucbeniki/fuel/packages/orm/classes/query.php(1198): Fuel\Core\Database_Query->execute(NULL)
#3 /Users/primozr/Dropbox/www/ucbeniki/fuel/app/tasks/converter.php(15): Orm\Query->get()
#4 /Users/primozr/Dropbox/www/ucbeniki/fuel/core/base.php(434): Fuel\Tasks\Converter->new_textbook()
#5 /Users/primozr/Dropbox/www/ucbeniki/fuel/packages/oil/classes/refine.php(106): call_fuel_func_array(Array, Array)
#6 [internal function]: Oil\Refine::run('converter:new_t...', Array)
#7 /Users/primozr/Dropbox/www/ucbeniki/fuel/packages/oil/classes/command.php(125): call_user_func('Oil\Refine::run', 'converter:new_t...', Array)
#8 /Users/primozr/Dropbox/www/ucbeniki/oil(57): Oil\Command::init(Array)
#9 {main}
Previous exception:
Uncaught exception PDOException: SQLSTATE[HY000] [2002] No such file or directory
Callstack:
#0 /Users/primozr/Dropbox/www/ucbeniki/fuel/core/classes/database/pdo/connection.php(95): PDO->__construct('mysql:host=loca...', 'root', 'mysql', Array)
#1 /Users/primozr/Dropbox/www/ucbeniki/fuel/core/classes/database/pdo/connection.php(167): Fuel\Core\Database_PDO_Connection->connect()
#2 /Users/primozr/Dropbox/www/ucbeniki/fuel/core/classes/database/query.php(287): Fuel\Core\Database_PDO_Connection->query(1, 'SELECT `t0`.`st...', false)
#3 /Users/primozr/Dropbox/www/ucbeniki/fuel/packages/orm/classes/query.php(1198): Fuel\Core\Database_Query->execute(NULL)
#4 /Users/primozr/Dropbox/www/ucbeniki/fuel/app/tasks/converter.php(15): Orm\Query->get()
#5 /Users/primozr/Dropbox/www/ucbeniki/fuel/core/base.php(434): Fuel\Tasks\Converter->new_textbook()
#6 /Users/primozr/Dropbox/www/ucbeniki/fuel/packages/oil/classes/refine.php(106): call_fuel_func_array(Array, Array)
#7 [internal function]: Oil\Refine::run('converter:new_t...', Array)
#8 /Users/primozr/Dropbox/www/ucbeniki/fuel/packages/oil/classes/command.php(125): call_user_func('Oil\Refine::run', 'converter:new_t...', Array)
#9 /Users/primozr/Dropbox/www/ucbeniki/oil(57): Oil\Command::init(Array)
#10 {main}
The code I do in task method is simple, just calling ORM and get:
$t = \Model_Textbook::query()->get();
What am I doing wrong?
Harro
July 2014
It's a rubbish error message, but what Google tells me it means PDO can not connect to your database.
This is a similar issue of someone using dropbox:
http://stackoverflow.com/questions/7949319/yii-error-while-excecuting-custom-command
Jume
July 2014
Well if I do the same in a controller it will fetch the data without any problem, which tells me that DB connection from fuel app works fine?
Jume
July 2014
Ok changed mysql host from localhost to 127.0.0.1 as suggested on the StackOverflow answer and now the DB connection from tasks work... Not sure why it works from a controller either way (localhost or 127.0.0.1)... scary
Harro
July 2014
As scary as running your app off dropbox?
;-)
Jume
July 2014
Why? It's an easy and convenient way if u use multiple computers
:)
Harro
July 2014
Yes. But it has it's downsides too, as you have noticed.
;-)
Add a Comment
Howdy, Stranger!
It looks like you're new here. If you want to get involved, click one of these buttons!
Sign In
Apply for Membership
Categories
All Discussions
5,088
General
↳ General
3,364
↳ Job Board
13
↳ Installation & Setup
214
Packages
↳ Oil
213
↳ Orm
700
↳ Auth
260
Development
↳ Tips and Tutorials
126
↳ Code share
145
↳ Applications
52
In this Discussion
Harro
July 2014
Jume
July 2014