This commit is contained in:
Anthony Axenov 2022-11-28 10:13:17 +08:00
commit 283bac61eb
Signed by: anthony
GPG Key ID: EA9EC32FF7CCD4EC
7 changed files with 83 additions and 0 deletions

4
README.md Normal file
View File

@ -0,0 +1,4 @@
# Тестовый проект для настройки NetBeans IDE
Используется в моей статье для наглядной демонстрации процесса настройки NetBeans + xdebug:
https://axenov.dev/netbeans-php-docker-xdebug/

30
docker-compose.yml Normal file
View File

@ -0,0 +1,30 @@
version: '3'
networks:
test:
driver: bridge
services:
php:
container_name: test-php
build: './php'
networks:
- test
volumes:
- ./php/xdebug.ini:/usr/local/etc/php/conf.d/xdebug.ini
- ./index.php:/var/www/index.php
nginx:
container_name: test-nginx
image: nginx:latest
restart: unless-stopped
networks:
- test
volumes:
- ./nginx/vhost.conf:/etc/nginx/conf.d/default.conf
- ./index.php:/var/www/index.php
ports:
- '8888:80'
links:
- php

6
index.php Executable file
View File

@ -0,0 +1,6 @@
<?php
$url = 'https://axenov.dev';
$data = ['phpstorm', 'netbeans'];
phpinfo();
//var_dump($data);

18
nginx/vhost.conf Normal file
View File

@ -0,0 +1,18 @@
server {
server_name test.local;
listen 80;
root /var/www/;
index index.php;
location / {
try_files $uri $uri/ /index.php$is_args$args;
}
location ~ \.php$ {
try_files $uri /index.php =404;
fastcgi_pass php:9000;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
include fastcgi_params;
}
}

9
php/dockerfile Normal file
View File

@ -0,0 +1,9 @@
FROM php:8.1-fpm
# https://pecl.php.net/package/xdebug
RUN pecl channel-update pecl.php.net && \
pecl install xdebug-3.1.6
EXPOSE 9000
WORKDIR /var/www
CMD php-fpm

7
php/php Executable file
View File

@ -0,0 +1,7 @@
#!/bin/bash
#echo ${BASH_ARGV[*]}
docker exec test-php php \
-dxdebug.mode=debug \
-dxdebug.start_with_request=1 \
`basename ${BASH_ARGV[0]}` \
"${@:1:$#-1}"

9
php/xdebug.ini Normal file
View File

@ -0,0 +1,9 @@
[xdebug]
; https://xdebug.org/docs/all_settings
zend_extension=xdebug.so
xdebug.mode=debug
xdebug.idekey=netbeans-xdebug
xdebug.client_host=172.17.0.1
xdebug.start_with_request=trigger
xdebug.trigger=go