Last active
January 15, 2018 10:27
-
-
Save Arbagen/afb202869644679ff172726a3045ebaf to your computer and use it in GitHub Desktop.
xdebug in docker and phpstorm
This file contains hidden or 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
важно что бы в php.ini было: | |
xdebug.remote_host=dockerhost | |
xdebug.remote_enable = 1 | |
xdebug.remote_port = 9000 | |
xdebug.max_nesting_level = 500 | |
xdebug.remote_autostart=1 | |
xdebug.remote_connect_back=1 | |
а в docker-compose экспортнуть переменную PHP_IDE_CONFIG | |
services: | |
php: | |
environment: | |
PHP_IDE_CONFIG: serverName=localhost | |
1. настроить интерпретатор из docker compose | |
2. Создать серв в servers и выставить ип, порт и замапить основные каталоги | |
важно что бы localhost из PHP_IDE_CONFIG: serverName=localhost и в шторме сервер name=localhost были одинаковые | |
3. Включить трубку | |
sample: | |
dockerfile | |
FROM php:7.2-rc-fpm | |
RUN apt-get update && apt-get install -y git | |
RUN docker-php-ext-install opcache | |
RUN docker-php-ext-install pdo_mysql | |
RUN usermod -u 1000 www-data | |
COPY ./config/php.ini /usr/local/etc/php/php.ini | |
# Install Composer and make it available in the PATH | |
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/bin/ --filename=composer | |
#xdebug | |
ARG INSTALL_XDEBUG=false | |
RUN if [ ${INSTALL_XDEBUG} = true ]; then \ | |
pecl install xdebug-2.6.0beta1 && docker-php-ext-enable xdebug && \ | |
echo "\n xdebug.remote_host=dockerhost \n xdebug.remote_enable = 1 \n xdebug.remote_port = 9000 \n xdebug.max_nesting_level = 500 \n xdebug.remote_autostart=1 \n xdebug.remote_connect_back=1" >> /usr/local/etc/php/php.ini \ | |
;fi | |
docker-compose | |
services: | |
php: | |
container_name: php_store | |
build: | |
context: ./php | |
args: | |
- INSTALL_XDEBUG=true | |
environment: | |
PHP_IDE_CONFIG: serverName=localhost | |
depends_on: | |
- mysql | |
links: | |
- mysql:mysql | |
volumes: | |
- "./public_html:/var/www/html:cached" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment