File tree Expand file tree Collapse file tree 4 files changed +44
-1
lines changed
Expand file tree Collapse file tree 4 files changed +44
-1
lines changed Original file line number Diff line number Diff line change @@ -58,6 +58,7 @@ RUN GPG_KEYS=B0F4253373F8F6F510D42178520A9993A1C052F8 \
5858 && addgroup -S nginx \
5959 && adduser -D -S -h /var/cache/nginx -s /sbin/nologin -G nginx nginx \
6060 && apk add --no-cache --virtual .build-deps \
61+ autoconf \
6162 gcc \
6263 libc-dev \
6364 make \
@@ -149,6 +150,8 @@ RUN echo @testing http://nl.alpinelinux.org/alpine/edge/testing >> /etc/apk/repo
149150 openssl-dev \
150151 ca-certificates \
151152 dialog \
153+ autoconf \
154+ make \
152155 gcc \
153156 musl-dev \
154157 linux-headers \
@@ -168,6 +171,7 @@ RUN echo @testing http://nl.alpinelinux.org/alpine/edge/testing >> /etc/apk/repo
168171 --with-jpeg-dir=/usr/include/ && \
169172 # curl iconv session
170173 docker-php-ext-install pdo_mysql pdo_sqlite mysqli mcrypt gd exif intl xsl json soap dom zip opcache && \
174+ pecl install xdebug && \
171175 docker-php-source delete && \
172176 mkdir -p /etc/nginx && \
173177 mkdir -p /var/www/app && \
@@ -181,7 +185,7 @@ RUN echo @testing http://nl.alpinelinux.org/alpine/edge/testing >> /etc/apk/repo
181185 pip install -U pip && \
182186 pip install -U certbot && \
183187 mkdir -p /etc/letsencrypt/webrootauth && \
184- apk del gcc musl-dev linux-headers libffi-dev augeas-dev python-dev
188+ apk del gcc musl-dev linux-headers libffi-dev augeas-dev python-dev make autoconf
185189# ln -s /usr/bin/php7 /usr/bin/php
186190
187191ADD conf/supervisord.conf /etc/supervisord.conf
Original file line number Diff line number Diff line change @@ -58,6 +58,7 @@ For more detailed examples and explanations please refer to the documentation.
5858 - [ Setup] ( https://github.com/ngineered/nginx-php-fpm/blob/master/docs/lets_encrypt.md#setup )
5959 - [ Renewal] ( https://github.com/ngineered/nginx-php-fpm/blob/master/docs/lets_encrypt.md#renewal )
6060- [ PHP Modules] ( https://github.com/ngineered/nginx-php-fpm/blob/master/docs/php_modules.md )
61+ - [ Xdebug] ( https://github.com/ngineered/nginx-php-fpm/blob/master/docs/xdebug.md )
6162- [ Logging and Errors] ( https://github.com/ngineered/nginx-php-fpm/blob/master/docs/logs.md )
6263
6364## Guides
Original file line number Diff line number Diff line change 1+ ## Install PHP Modules
2+ Xdebug comes pre-installed. To enable xdebug you need to add a couple environment variables:
3+
4+ - ` ENABLE_XDEBUG=1 ` This will add the xdebug.ini to your php extensions
5+ - ` XDEBUG_CONFIG=remote_host=you.local.ip.here ` Sets an xdebug remote host environment var. This is usually your actual local computers IP.
6+ - ` PHP_IDE_CONFIG=serverName=NameUsedInPhpStormServerConfig ` This is an example of how to use this in PhpStorm. You configure a server in php storm with a name, set that in this var.
Original file line number Diff line number Diff line change @@ -131,6 +131,38 @@ if [ ! -z "$PHP_UPLOAD_MAX_FILESIZE" ]; then
131131 sed -i " s/upload_max_filesize = 100M/upload_max_filesize= ${PHP_UPLOAD_MAX_FILESIZE} M/g" /usr/local/etc/php/conf.d/docker-vars.ini
132132fi
133133
134+ # Enable xdebug
135+ XdebugFile=' /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini'
136+ if [[ " $ENABLE_XDEBUG " == " 1" ]] ; then
137+ if [ -f $XdebugFile ]; then
138+ echo " Xdebug enabled"
139+ else
140+ echo " Enabling xdebug"
141+ echo " If you get this error, you can safely ignore it: /usr/local/bin/docker-php-ext-enable: line 83: nm: not found"
142+ # see https://github.com/docker-library/php/pull/420
143+ docker-php-ext-enable xdebug
144+ # see if file exists
145+ if [ -f $XdebugFile ]; then
146+ # See if file contains xdebug text.
147+ if grep -q xdebug.remote_enable " $XdebugFile " ; then
148+ echo " Xdebug already enabled... skipping"
149+ else
150+ echo " zend_extension=$( find /usr/local/lib/php/extensions/ -name xdebug.so) " > $XdebugFile # Note, single arrow to overwrite file.
151+ echo " xdebug.remote_enable=1 " >> $XdebugFile
152+ echo " xdebug.remote_log=/tmp/xdebug.log" >> $XdebugFile
153+ echo " xdebug.remote_autostart=false " >> $XdebugFile # I use the xdebug chrome extension instead of using autostart
154+ # NOTE: xdebug.remote_host is not needed here if you set an environment variable in docker-compose like so `- XDEBUG_CONFIG=remote_host=192.168.111.27`.
155+ # you also need to set an env var `- PHP_IDE_CONFIG=serverName=docker`
156+ fi
157+ fi
158+ fi
159+ else
160+ if [ -f $XdebugFile ]; then
161+ echo " Disabling Xdebug"
162+ rm $XdebugFile
163+ fi
164+ fi
165+
134166if [ ! -z " $PUID " ]; then
135167 if [ -z " $PGID " ]; then
136168 PGID=${PUID}
You can’t perform that action at this time.
0 commit comments