Skip to content

Commit 3fe3715

Browse files
committed
Add xdebug support.
1 parent 2ca8467 commit 3fe3715

File tree

4 files changed

+26
-0
lines changed

4 files changed

+26
-0
lines changed

Dockerfile

+5
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,12 @@ RUN chmod 777 /tmp && chmod +t /tmp
77
RUN /tmp/setup/php-extensions.sh
88
RUN /tmp/setup/oci8-extension.sh
99

10+
RUN chmod +x /usr/bin/moodle-php-entrypoint
11+
ENTRYPOINT ["moodle-php-entrypoint"]
12+
1013
RUN mkdir /var/www/moodledata && chown www-data /var/www/moodledata && \
1114
mkdir /var/www/phpunitdata && chown www-data /var/www/phpunitdata && \
1215
mkdir /var/www/behatdata && chown www-data /var/www/behatdata && \
1316
mkdir /var/www/behatfaildumps && chown www-data /var/www/behatfaildumps
17+
18+
CMD ["apache2-foreground"]

README.md

+7
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,13 @@ To faciliate testing and easy setup the following directories are created and ow
3030
* `/var/www/behatdata`
3131
* `/var/www/behatfaildumps`
3232

33+
# XDebug
34+
35+
For development, the image contains the XDebug PHP extension. This is disabled by default, for performance reasons, but can be enabled by setting a non-empty XDEBUG_CONFIG environment variable. This environment variable is also used by XDebug for configuration (see [XDebug documentation](https://xdebug.org/docs) for details and available configuration settings).
36+
37+
```bash
38+
$ docker run --name web0 -p 8080:80 -v $PWD:/var/www/html -e XDEBUG_CONFIG="remote_enable=1 remote_connect_back=1" moodlehq/moodle-php-apache:7.1
39+
```
3340

3441
# See also
3542
This container is part of a set of containers for Moodle development, see also:

root/tmp/setup/php-extensions.sh

+2
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ ACCEPT_EULA=Y apt-get install -y msodbcsql
4848
pecl install sqlsrv-4.3.0
4949
docker-php-ext-enable sqlsrv
5050

51+
pecl install xdebug-2.6.1
52+
5153
# Keep our image size down..
5254
pecl clear-cache
5355
apt-get remove --purge -y $BUILD_PACKAGES

root/usr/bin/moodle-php-entrypoint

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/sh
2+
3+
XDEBUG_INI_FILE=/usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
4+
if [ -z "${XDEBUG_CONFIG}" ]; then
5+
rm -f $XDEBUG_INI_FILE
6+
else
7+
if [ ! -e $XDEBUG_INI_FILE ]; then
8+
echo "zend_extension=$(find /usr/local/lib/php/extensions/ -name xdebug.so)" > $XDEBUG_INI_FILE
9+
fi
10+
fi
11+
12+
/usr/local/bin/docker-php-entrypoint "$@"

0 commit comments

Comments
 (0)