Lumen - Postgresql设置 - Composer

时间:2017-12-19 15:00:30

标签: php laravel-5 docker-compose lumen

真的很喜欢这个,它不是我试图设置它的第一个,但我真的不明白它为什么不起作用。

所以这是我的app.docker文件:

FROM php:7-fpm
# Install modules
RUN buildDeps="libpq-dev libzip-dev libfreetype6-dev libjpeg62-turbo-dev libpng-dev " && apt-get update && apt-get install -y $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \
    && docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
    && docker-php-ext-install pdo pdo_pgsql pgsql gd

WORKDIR /var/www

COPY . /var/www

RUN chown www-data:www-data -R ./storage

RUN ln -s /storage/app/public /public

非常简单。接下来是phpinfo()的输出

enter image description here

我知道现在已经安装了pgsql驱动程序,但是,当运行php artisan migrate时我还是得到了

enter image description here

这是我的config / database.php文件。

return [
    'default' => 'postgres',
    'migrations' => 'migrations',
    'connections' => [
        'mysql' => [
            'driver'    => 'mysql',
            'host'      => env('DB_HOST'),
            'database'  => env('DB_DATABASE'),
            'port'      => env('DB_PORT'),
            'username'  => env('DB_USERNAME'),
            'password'  => env('DB_PASSWORD'),
            'charset'   => 'utf8',
            'collation' => 'utf8_unicode_ci',
            'prefix'    => '',
            'strict'    => false,
        ],
        'mysql_postal_code' => [
            'driver'    => 'mysql',
            'host'      => env('DB_HOST', 'localhost'),
            'database'  => env('DB_DATABASE_POSTAL_CODE'),
            'port'      => env('DB_PORT'),
            'username'  => env('DB_USERNAME'),
            'password'  => env('DB_PASSWORD'),
            'charset'   => 'utf8',
            'collation' => 'utf8_unicode_ci',
            'prefix'    => '',
            'strict'    => false,
        ],
        'postgres' => [
            'driver'   => 'pgsql',
            'host'     => env('DB_PG_HOST', 'database_p'),
            'database' => env('DB_PG_DATABASE', 'dockerApp'), // This seems to be ignored
            'port'     => env('DB_PG_PGSQL_PORT', 5432),
            'username' => env('DB_PG_USERNAME', 'postgres'),
            'password' => env('DB_PG_PASSWORD', 'secret'),
            'charset'  => 'utf8',
            'prefix'   => '',
            'schema'   => 'public'
        ]
    ],
    'redis' => [
        'cluster' => false,
        'default' => [
            'host' => env('REDIS_HOST', 'localhost'),
            'password' => env('REDIS_PASSWORD', null),
            'port' => env('REDIS_PORT', 6379),
            'database' => 0,
        ],
    ],
];

我能错过什么?

0 个答案:

没有答案