Centos 7, Apache, PHP 7.3, and Xdebug
10K+
Set up Xdebug on a Docker Container with Centos 7, and PHP 7.3.
More details can be found here.
Create Docker Image.
docker build -t <image_name> .
Replace <image_name> with the name you want for the image.
Example.
docker build -t image_apache .
Create Docker Container.
docker run -tid -p 4000:80 --name=<container_name> -v /path_to/folder:/var/www/html <image_name>
Replace <container_name> with the name you want for the container, and <image_name> with the name of the image you specified on the Build command above.
Example.
docker run -tid -p 4000:80 --name=container_apache -v /path_to/folder:/var/www/html image_apache
Also change "/path_to/folder" with the actual location of your website's root folder on your local machine.
To check Xdebug has been correctly installed and configured, open a terminal window into the Docker Container with the following command:
docker exec -it container_apache bash
Then, on the terminal window inside the container, we will use the php -i instruction to get information about our PHP installation. We will also use the grep utility to display only the information relevant to Xdebug:
php -i | grep xdebug
You will see an output similar to this one (excerpts):
xdebug
xdebug support => enabled
Support Xdebug on Patreon, GitHub, or as a business: https://xdebug.org/support
xdebug.auto_trace => Off => Off
xdebug.cli_color => 0 => 0
...
xdebug.remote_autostart => On => On
xdebug.remote_connect_back => Off => Off
xdebug.remote_cookie_expire_time => 3600 => 3600
xdebug.remote_enable => On => On
xdebug.remote_host => host.docker.internal => host.docker.internal
xdebug.remote_log => no value => no value
...
Content type
Image
Digest
Size
356.3 MB
Last updated
about 6 years ago
docker pull davescripts/centos-7-apache-php-73-xdebug