这一天,我在laravel上遇到了很多问题。这一次,当我将我的laravel应用程序部署到外部服务器时,我得到一个例外:
ErrorException
Undefined variable: database
protected function getDsn(array $config)
{
// First we will create the basic DSN setup as well as the port if it is in
// in the configuration options. This will give us the basic DSN we will
// need to establish the PDO connections and return them back for use.
extract($config);
$dsn = "mysql:host={$host};dbname={$database}";
if (isset($config['port']))
.....
但这不正确,因为我的配置数据库文件有数据库索引! :(
'mysql' => array(
'driver' => 'mysql',
'host' => 'localhost',
'database' => 'table',
'username' => 'root',
'password' => 'password',
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => 'mn_',
),
同样的文件在devel环境中工作。
有人有这个问题吗?谢谢!
编辑:
Composer.json
{
"name": "shopitos/manager",
"description": "Server for scripting and things",
"authors": [{
"name": "Leandro Bezerra",
"email": "leandro@blogdoleos.com.br"
}],
"require": {
"laravel/framework": "4.1.*",
"evernote/evernote": "dev-master",
"artdarek/oauth-4-laravel": "dev-master",
"orchestra/debug": "2.2.*"
},
"require-dev": {
"phpunit/phpunit": "3.7.29",
"way/generators": "2.*",
"doctrine/dbal": "~2.3",
"itsgoingd/clockwork": "1.*"
},
"autoload": {
"classmap": [
"app/commands",
"app/controllers",
"app/database/migrations",
"app/database/seeds",
"app/events",
"app/models",
"app/tests/TestCase.php"
]
},
"config": {
"preferred-install": "dist"
},
"minimum-stability": "dev"
}