Last active
April 13, 2021 05:02
-
-
Save vladiiancu/1e83e0fead2f1477b84dc1c463df27d0 to your computer and use it in GitHub Desktop.
xDebug, VSCode and docker
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
listen 80; | |
index index.php index.html; | |
server_name localhost; | |
error_log /logs/nginx/error.log; | |
access_log /logs/nginx/access.log; | |
root /app/public; | |
location ~ \.php$ { | |
try_files $uri =404; | |
fastcgi_split_path_info ^(.+\.php)(/.+)$; | |
fastcgi_pass php:9000; | |
fastcgi_idnex index.php; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3.1' | |
services: | |
web: | |
image: nginx:latest | |
ports: | |
- "3000:80" | |
volumes: | |
- ./app:/app | |
- ./logs/nginx:/logs/nginx | |
- ./nginx/xdebug:/etc/nginx/xdebug | |
- ./nginx/hosts:/etc/nginx/hosts | |
- ./nginx/init.conf:/etc/nginx/conf.d/default.conf | |
networks: | |
- app-network | |
depends_on: | |
- php | |
php: | |
build: | |
dockerfile: Dockerfile | |
context: ./ | |
volumes: | |
- ./logs/xdebug:/logs/xdebug | |
- ./logs/php-fpm/:/tmp/xdebug_log | |
- ./php/custom.conf:/usr/local/etc/php-fpm.d/xy-custom.conf | |
- ./php/xdebug.ini:/usr/local/etc/php/conf.d/xy-xdebug.ini | |
env_file: | |
- ./.env | |
networks: | |
- app-network |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM php:7.4-fpm | |
RUN pecl install xdebug \ | |
&& docker-php-ext-enable xdebug |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"version": "0.2.0", | |
"configurations": [ | |
{ | |
"name": "xDebug listen", | |
"type": "php", | |
"request": "launch", | |
"port": 9003, | |
"stopOnEntry": true, | |
"pathMappings": { | |
"/app": "${workspaceFolder}/app" | |
} | |
} | |
] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
zend_extension = xdebug.so | |
xdebug.log = "/logs/xdebug/remote.log" | |
//this path works with the volume already set up in docker-compose where we mount the /logs/xdebug folder. | |
xdebug.mode = debug,profile,trace | |
xdebug.start_with_request = yes | |
xdebug.discover_client_host = 0 | |
xdebug.client_port = 9003 | |
xdebug.client_host=host.docker.internal |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment