Hi,
in the past I used XAMPP for developing. In the last year I moved all my current laravel projects to a docker dev environment. I have an old YII project which need some tweaks from to time and I like to deploy this one with docker, too. At the moment I can’t get it working. I’m getting this YII error:
( ! ) Fatal error: Uncaught Error: Call to a member function getSystemViewPath() on bool in /app/public/phpRecDB/app/common/libs/yiiframework/base/CErrorHandler.php on line 390
Here is my setup:
docker-compose.yml
version: '3'
services:
web:
image: nginx:latest
ports:
- "80:80"
volumes:
- ./nginx.conf:/etc/nginx/conf.d/nginx.conf
- ./app:/app
networks:
- app-network
php:
build:
context: .
dockerfile: PHP.Dockerfile
volumes:
- ./app:/app
- ./xdebug.ini:/usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
- ./error_reporting.ini:/usr/local/etc/php/conf.d/error_reporting.ini
environment:
XDEBUG_ENABLED: 1
XDEBUG_REMOTE_AUTOSTART: 1
XDEBUG_MAXNESTING_LEVEL: 1000
XDEBUG_REMOTE_CONNECT_BACK: 1
XDEBUG_REMOTE_HOST: host.docker.internal
PHP_IDE_CONFIG: serverName=localhost
networks:
- app-network
mysql:
image: mysql:5.7
restart: always
environment:
MYSQL_ROOT_PASSWORD: 'secret'
MYSQL_USER: 'testuser'
MYSQL_PASSWORD: 'secret'
MYSQL_DATABASE: 'testdb'
volumes:
- db_data:/var/lib/mysql
ports:
- 3306:3306
networks:
- app-network
networks:
app-network:
driver: bridge
volumes:
db_data: {}
PHP.Dockerfile
FROM php:7.4-fpm
RUN docker-php-ext-install pdo pdo_mysql
RUN docker-php-ext-install mysqli
RUN pecl install xdebug && docker-php-ext-enable xdebug
nginx.conf
server {
listen 80 default_server;
root /app/public;
index index.php index.html index.htm;
location ~ \.php$ {
fastcgi_pass php:9000;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}