initial xdebug additions

This commit is contained in:
Peter O
2017-06-23 11:32:26 -05:00
parent 598dbe1a24
commit 381434a6db
4 changed files with 42 additions and 1 deletions

View File

@@ -58,6 +58,7 @@ RUN GPG_KEYS=B0F4253373F8F6F510D42178520A9993A1C052F8 \
&& addgroup -S nginx \
&& adduser -D -S -h /var/cache/nginx -s /sbin/nologin -G nginx nginx \
&& apk add --no-cache --virtual .build-deps \
autoconf \
gcc \
libc-dev \
make \
@@ -149,6 +150,7 @@ RUN echo @testing http://nl.alpinelinux.org/alpine/edge/testing >> /etc/apk/repo
openssl-dev \
ca-certificates \
dialog \
autoconf \
gcc \
musl-dev \
linux-headers \
@@ -168,6 +170,7 @@ RUN echo @testing http://nl.alpinelinux.org/alpine/edge/testing >> /etc/apk/repo
--with-jpeg-dir=/usr/include/ && \
#curl iconv session
docker-php-ext-install pdo_mysql pdo_sqlite mysqli mcrypt gd exif intl xsl json soap dom zip opcache && \
pecl install xdebug && \
docker-php-source delete && \
mkdir -p /etc/nginx && \
mkdir -p /var/www/app && \
@@ -181,7 +184,7 @@ RUN echo @testing http://nl.alpinelinux.org/alpine/edge/testing >> /etc/apk/repo
pip install -U pip && \
pip install -U certbot && \
mkdir -p /etc/letsencrypt/webrootauth && \
apk del gcc musl-dev linux-headers libffi-dev augeas-dev python-dev
apk del gcc musl-dev linux-headers libffi-dev augeas-dev python-dev autoconf
# ln -s /usr/bin/php7 /usr/bin/php
ADD conf/supervisord.conf /etc/supervisord.conf

View File

@@ -58,6 +58,7 @@ For more detailed examples and explanations please refer to the documentation.
- [Setup](https://github.com/ngineered/nginx-php-fpm/blob/master/docs/lets_encrypt.md#setup)
- [Renewal](https://github.com/ngineered/nginx-php-fpm/blob/master/docs/lets_encrypt.md#renewal)
- [PHP Modules](https://github.com/ngineered/nginx-php-fpm/blob/master/docs/php_modules.md)
- [Xdebug](https://github.com/ngineered/nginx-php-fpm/blob/master/docs/xdebug.md)
- [Logging and Errors](https://github.com/ngineered/nginx-php-fpm/blob/master/docs/logs.md)
## Guides

View File

@@ -0,0 +1,6 @@
## Install PHP Modules
Xdebug comes pre-installed. To enable xdebug you need to add a couple environment variables:
- `ENABLE_XDEBUG=1` This will add the xdebug.ini to your php extensions
- `XDEBUG_CONFIG=remote_host=you.local.ip.here` Sets an xdebug remote host environment var. This is usually your actual local computers IP.
- `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.

View File

@@ -122,6 +122,37 @@ if [ ! -z "$PHP_UPLOAD_MAX_FILESIZE" ]; then
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
fi
# Enable xdebug
XdebugFile='/usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini'
if [[ "$ENABLE_XDEBUG" == "1" ]] ; then
if [ -f $XdebugFile ]; then
echo "Xdebug enabled"
else
echo "Enabling xdebug"
echo "If you get this error, you can safely ignore it: /usr/local/bin/docker-php-ext-enable: line 83: nm: not found"
docker-php-ext-enable xdebug
# see if file exists
if [ -f $XdebugFile ]; then
# See if file contains xdebug text.
if grep -q xdebug.remote_enable "$XdebugFile"; then
echo "Xdebug already enabled... skipping"
else
echo "zend_extension=$(find /usr/local/lib/php/extensions/ -name xdebug.so)" > $XdebugFile # Note, single arrow to overwrite file.
echo "xdebug.remote_enable=1 " >> $XdebugFile
echo "xdebug.remote_log=/tmp/xdebug.log" >> $XdebugFile
echo "xdebug.remote_autostart=false " >> $XdebugFile # I use the xdebug chrome extension instead of using autostart
# 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`.
# you also need to set an env var `- PHP_IDE_CONFIG=serverName=docker`
fi
fi
fi
else
if [ -f $XdebugFile ]; then
echo "Disabling Xdebug"
rm $XdebugFile
fi
fi
if [ ! -z "$PUID" ]; then
if [ -z "$PGID" ]; then
PGID=${PUID}