如何使用Silex连接数据库Openshift

时间:2014-12-22 13:13:41

标签: php database git openshift silex

我想通过Openshift将我的silex应用程序连接到我的数据库,

所以我在我的文件bootstrap.php中有这些行

define('DB_HOST', getenv('OPENSHIFT_MYSQL_DB_HOST'));
define('DB_PORT', getenv('OPENSHIFT_MYSQL_DB_PORT'));
define('DB_USER', getenv('OPENSHIFT_MYSQL_DB_USERNAME'));
define('DB_PASS', getenv('OPENSHIFT_MYSQL_DB_PASSWORD'));
define('DB_NAME', getenv('OPENSHIFT_GEAR_NAME'));

App::$app->register(new Silex\Provider\DoctrineServiceProvider(), array(
    'db.options' => array(
        'driver' => 'pdo_mysql',
        'host' => constant("DB_HOST"),
        'dbname' => constant("DB_NAME"),
        'user' => constant("DB_USER"),
        'password' => constant("DB_PASS"),
        'port' => constant("DB_PORT"),
    ),
));

我打电话给几个工作服务

网站使用本地(本地连接)

当我用git推送时,我的日志中出现此错误(当我更新网站时):

[Mon Dec 22 08:10:17 2014] [error] [client 127.12.51.129] PHP Fatal error:  Clas
s 'Doctrine\\DBAL\\Configuration' not found in /var/lib/openshift/548b027efcf933
a1dd0000fe/app-root/runtime/repo/vendor/silex/silex/src/Silex/Provider/DoctrineS
erviceProvider.php on line 90

感谢您的帮助。

0 个答案:

没有答案