|
| 1 | +docker-php-xdebug |
| 2 | +================= |
| 3 | +This repository contains Dockerfiles to build PHP images with `xdebug` installed and configured to run with modern IDEs like phpStorm. |
| 4 | +Docker images are based on official Docker PHP builds that are available in Docker Store: <https://store.docker.com/images/php> |
| 5 | + |
| 6 | +Why `docker-php-xdebug`? |
| 7 | +---------------------- |
| 8 | +Official PHP images are great, however they don't have `xdebug` plugin installed by default, so it's hard to use them when developing PHP applications on local machine. |
| 9 | + |
| 10 | +Images from this repository are the solution for this issue, since they have installed and configured `xdebug` plugin. |
| 11 | + |
| 12 | +The only difference from official Docker PHP images is that, the `xdebug` plugin is installed, configured and ready to use with modern IDEs like phpStorm. |
| 13 | + |
| 14 | +Use from Docker Registry |
| 15 | +-------------------------- |
| 16 | +Since all images are based on official Docker PHP images, please check [official documentation](https://store.docker.com/images/php) how to use them from Docker Registry. |
| 17 | + |
| 18 | +The only difference is that, instead of downloading official Docker PHP image, you have to use one of the images listed below. |
| 19 | + |
| 20 | +Supported tags: |
| 21 | + |
| 22 | +* mobtitude/php-xdebug:5.6-apache |
| 23 | +* mobtitude/php-xdebug:5.6-cli |
| 24 | +* mobtitude/php-xdebug:5.6-fpm |
| 25 | +* mobtitude/php-xdebug:7.0-apache |
| 26 | +* mobtitude/php-xdebug:7.0-cli |
| 27 | +* mobtitude/php-xdebug:7.0-fpm |
| 28 | +* mobtitude/php-xdebug:7.1-apache |
| 29 | +* mobtitude/php-xdebug:7.1-cli |
| 30 | +* mobtitude/php-xdebug:7.1-fpm |
| 31 | +* mobtitude/php-xdebug:7.2-apache |
| 32 | +* mobtitude/php-xdebug:7.2-cli |
| 33 | +* mobtitude/php-xdebug:7.2-fpm |
| 34 | + |
| 35 | + |
| 36 | +Build from source |
| 37 | +------------------- |
| 38 | +1. Clone git repo from https://github.com/mobtitude/docker-php-xdebug |
| 39 | +2. Run `make build` to build **all images** from this repository. |
| 40 | + |
| 41 | +How to use it with IDEs |
| 42 | +----------------------- |
| 43 | +Images available in this repository are ready to debug and profile PHP applications with modern IDEs that use xdebug. |
| 44 | +Just configure your favorite IDE to use it. |
| 45 | + |
| 46 | +For example, here are instructions with step-by-step guide for PhpStorm how to use `xdebug` to debug and profile PHP applications: https://www.jetbrains.com/help/phpstorm/debugging-with-phpstorm-ultimate-guide.html |
| 47 | + |
| 48 | +Please note that you will have `xdebug` already installed and configured - the only thing you need to configure is your IDE! |
| 49 | + |
| 50 | + |
| 51 | +`xdebug` configuration |
| 52 | +-------------------- |
| 53 | +`xdebug` plugin is installed and configured in all Docker images from this repository. |
| 54 | +The `xdebug` configuration is located in file: `/usr/local/etc/php/conf.d/xdebug.ini` |
| 55 | + |
| 56 | +Default `xdebug` configuration for all images in this repository is as follow: |
| 57 | + |
| 58 | + [xdebug] |
| 59 | + zend_extension=xdebug.so |
| 60 | + |
| 61 | + xdebug.cli_color=1 |
| 62 | + xdebug.profiler_enable=0 |
| 63 | + xdebug.profiler_enable_trigger=1 |
| 64 | + |
| 65 | + xdebug.profiler_output_dir="/tmp" |
| 66 | + xdebug.profiler_output_name="cachegrind.out.%H.%t.%p" |
| 67 | + |
| 68 | + xdebug.remote_enable=1 |
| 69 | + xdebug.remote_connect_back=1 |
| 70 | + xdebug.remote_port=9000 |
| 71 | + |
| 72 | +Explanation for these options and full `xdebug` documentation: https://xdebug.org/docs/ |
| 73 | + |
| 74 | +You can overwrite `xdebug` configuration in the following ways: |
| 75 | + |
| 76 | +1. By replacing `xdebug.ini` with your own content when starting container, by mounting your own `xdebug.ini` file to `/usr/local/etc/php/conf.d/xdebug.ini` |
| 77 | +2. By replacing specific PHP options with `-d` when starting php script in container: |
| 78 | + `php -dxdebug.remote_port=9050 -dxdebug.profiler_enable=1` |
| 79 | +3. By replacing specific PHP options in VirtualHost or `.htaccess` file when running web application in Apache as explained in PHP docs: http://php.net/manual/en/configuration.changes.php |
0 commit comments