docker laravel nginx postgreSQL 環境構築 postgreSQLをしようしてマイグレートしたい

発生しているエラー

PowerShell

root@813fb5ac78bb:/var/www/sampleProject# php artisan migrate Illuminate\Database\QueryException could not find driver (SQL: select * from information_schema.tables where table_schema = public and table_name = migrations and table_type = 'BASE TABLE') at vendor/laravel/framework/src/Illuminate/Database/Connection.php:712 708▕ // If an exception occurs when attempting to run a query, we'll format the error 709▕ // message to include the bindings with SQL, which will make this exception a 710▕ // lot more helpful to the developer instead of just the database's errors. 711▕ catch (Exception $e) { ➜ 712▕ throw new QueryException( 713▕ $query, $this->prepareBindings($bindings), $e 714▕ ); 715▕ } 716▕ } +33 vendor frames 34 artisan:37 Illuminate\Foundation\Console\Kernel::handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

エラー内容はpostgreSQLのドライバーがないということはわかりました。

PDO

php -m | grep pdo pdo_mysql pdo_sqlite

docker

version: '3' services: app: container_name: app build: ./docker/php volumes: - .:/var/www nginx: image: nginx container_name: nginx ports: - 8000:80 volumes: - .:/var/www - ./docker/nginx/default.conf:/etc/nginx/conf.d/default.conf working_dir: /var/www depends_on: - app postgres: image: postgres:latest restart: always environment: POSTGRES_USER: user POSTGRES_PASSWORD: password PGPASSWORD: password123 POSTGRES_DB: sample TZ: "Asia/Tokyo" ports: - 5432:5432 volumes: - postgres:/var/lib/postgresql/data pgadmin: image: dpage/pgadmin4 restart: always ports: - 81:82 environment: PGADMIN_DEFAULT_EMAIL: test@ne.co.jp PGADMIN_DEFAULT_PASSWORD: password volumes: - pgadmin:/var/lib/pgadmin depends_on: - postgres volumes: postgres: pgadmin:

php.ini

[Date] date.timezone = "Asia/Tokyo" [mbstring] mbstring.internal_encoding = "UTF-8" mbstring.language = "Japanese" extension=php_pdo.dll extension=php_pdo_pgsql.dll [opcache] opcache.memory_consumption=128 opcache.interned_strings_buffer=8 opcache.max_accelerated_files=4000 opcache.revalidate_freq=60 opcache.fast_shutdown=1 opcache.enable_cli=1

dockerfile

FROM php:7.3-fpm COPY php.ini /usr/local/etc/php/ RUN apt update \ && apt install -y \ g++ \ libicu-dev \ libpq-dev \ libzip-dev \ zip \ zlib1g-dev \ && docker-php-ext-install \ intl \ opcache \ pdo \ pdo_pgsql \ pgsql \ WORKDIR /var/www RUN chown -R www-data:www-data /var/www COPY --from=composer /usr/bin/composer /usr/bin/composer  ENV COMPOSER_ALLOW_SUPERUSER 1 ENV COMPOSER_HOME /composer ENV PATH $PATH:/composer/vendor/bin RUN composer global require "laravel/installer"

php.ini

[Date] date.timezone = "Asia/Tokyo" [mbstring] mbstring.internal_encoding = "UTF-8" mbstring.language = "Japanese" extension=php_pdo.dll extension=php_pdo_pgsql.dll [opcache] opcache.memory_consumption=128 opcache.interned_strings_buffer=8 opcache.max_accelerated_files=4000 opcache.revalidate_freq=60 opcache.fast_shutdown=1 opcache.enable_cli=1

env

APP_NAME=Laravel APP_ENV=local APP_KEY=base64:Mu2T31/khJ90apKO+dzHfYu1TQGf0BGKngwIt8zjPro= APP_DEBUG=true APP_URL=http://sampleProject.test LOG_CHANNEL=stack LOG_DEPRECATIONS_CHANNEL=null LOG_LEVEL=debug DB_CONNECTION=pgsql DB_HOST=postgres DB_PORT=5432 DB_DATABASE=sample DB_USERNAME=user DB_PASSWORD=password BROADCAST_DRIVER=log CACHE_DRIVER=file FILESYSTEM_DRIVER=local QUEUE_CONNECTION=sync SESSION_DRIVER=file SESSION_LIFETIME=120 MEMCACHED_HOST=127.0.0.1 REDIS_HOST=127.0.0.1 REDIS_PASSWORD=null REDIS_PORT=6379 MAIL_MAILER=smtp MAIL_HOST=mailhog MAIL_PORT=1025 MAIL_USERNAME=null MAIL_PASSWORD=null MAIL_ENCRYPTION=null MAIL_FROM_ADDRESS=null MAIL_FROM_NAME="${APP_NAME}" AWS_ACCESS_KEY_ID= AWS_SECRET_ACCESS_KEY= AWS_DEFAULT_REGION=us-east-1 AWS_BUCKET= AWS_USE_PATH_STYLE_ENDPOINT=false PUSHER_APP_ID= PUSHER_APP_KEY= PUSHER_APP_SECRET= PUSHER_APP_CLUSTER=mt1 MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}" MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"

コメントを投稿

0 コメント