FuelPHP Oil Migration not working

旧街凉风 提交于 2019-12-13 09:54:04

问题


I have xampp installed and want to get FuelPHP working. Everything seems to work fine, I scaffolded some stuff, that I want to migrate. But I get the error

Error - invalid data source name in COREPATH/classes/database/pdo/connection.php on line 94

My db.php looks like this:

return array(
  'default' => array(
    'type' => 'pdo',
    'connection' => array(
      'dsn' => 'mysql:host=127.0.0.1;dbname=pfpg',
      'username' => 'root',
      'password' => '',
      'persistent' => false,
      'compress' => false,
    ),
  ),
);

I tried it without the 'persistent' and 'compress' before, didn't work. Database name is correct, username too. I also tried it with 'mysql:host=localhost'. I don't get what I did wrong...

If you need more information, ask away!


回答1:


I configured the wrong db.php file, I didn't know, there was more than one. fuel/app/config/development/db.php was the right file, so it depends on the environment




回答2:


For those of you who none of this worked make sure of two things

  1. there are multiple db.php files /fuel/app/config/development/db.php. check environment as @user1978654 mentioned and double check the username and password is correct
  2. Make sure /var/mysql/mysql.sock exists. In my case I was using /Applications/XAMPP/xamppfiles/var/mysql/mysql.sock so i needed to create a symlink. Followed the instructions here

Hope that helps someone




回答3:


Go to fuel/app/config/development/db.php put your database name there .. and make sure you un comment the ORM package in fuel\app\config\config.php



来源:https://stackoverflow.com/questions/16121120/fuelphp-oil-migration-not-working

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!