Docker4Drupal is an open-source project (GitHub page) that provides pre-configured docker-compose.yml
file with images to spin up local environment on Linux, Mac OS X and Windows.
- Xdebug Docker.for.mac.localhost
- Phpstorm Docker Xdebug Not Working
- Xdebug Docker For Mac Catalina
- Xdebug Php Docker
The problem with Docker for Mac and xDebug is that it is mapped to your localhost (127.0.0.1), so PHP/xDebug doesn't actually know the true IP address of the remote host connecting to xdebug. To get around this what we need to do is configure an alias to the loopback device to get this work. Sudo ifconfig lo0 alias 10.254.254.254. Release date: 2020-09-28. Linux, macOS: source; Windows binaries: PHP 7.1 VC14 (64 bit) PHP 7.1 VC14 (32 bit) PHP 7.1 VC14 TS (64 bit) PHP 7.1 VC14 TS (32 bit) PHP 7.2 VC15 (64 bit) PHP 7.2 VC15 (32 bit) PHP 7.2 VC15 TS (64 bit) PHP 7.2 VC15 TS (32 bit) PHP 7.3 VC15 (64 bit). Docker for Mac: Version 2.0.0.0-mac81 (29211) Steps to reproduce the behavior. Run something with fixed run time, see time X; Put Mac to sleep, wake it up; Run it again, see time 3X; Restart Docker for Mac; Run it again, see time X 👍. In order to debug our applications with Xdebug inside our containers, we needed to include this bash file in the docker entrypoint of our php image (for more details, cf Victor's article) It will allow the IDE (here PHPStorm) to listen and remote debug the php app in the container. All theses optimisations and configurations allow our developper team to use Docker For Mac efficiently.
Requirements¶
- Install Docker (Linux, Docker for Mac or Docker for Windows (10+ Pro))
- For Linux additionally install docker compose
Usage¶
Database data persistence
By default Docker will create a persistent volume for your DB data and unless you explicitly remove volumes the files will not be deleted. However, if you run docker-compose down
(it's ok to use stop
though) these volumes will not be reattached when you run docker-compose up
. If you want to have your DB data all-time persistent and attached, we recommend using a bind mount. To use a bind mount uncomment to corresponding line under db server's volumes:
in your docker-compose.yml
and update the host path to your data directory.
There are 2 options how to use docker4drupal – you can either run vanilla Drupal from the image or mount your own Drupal codebase:
Vanilla Drupal¶
- Clone docker4drupal repository and switch to the latest stable tag or download/unpack the source code from the latest release
- Optional: for Drupal 8 or 7 comment out corresponding
DRUPAL_TAG
andNGINX_VHOST_PRESET
in.env
file - From project root directory run
docker-compose up -d
ormake up
to start containers. Give it 10-20 seconds to initialize after the start - That's it! Proceed with Drupal installation at http://drupal.docker.localhost:8000. Default database user, password and database name are all
drupal
, database host ismariadb
- You can see status of your containers and their logs via portainer: http://portainer.drupal.docker.localhost:8000
Mount my codebase¶
- If you're starting a new project we recommend you to fork drupal-composer/drupal-project project
- Download and unpack
docker4drupal.tar.gz
from the latest stable release to your project root - Delete
docker-compose.override.yml
as it's used to deploy vanilla Drupal - Ensure
NGINX_SERVER_ROOT
(orAPACHE_DOCUMENT_ROOT
) is correct, by default set to/var/www/html/web
for composer-based projects where Drupal is inweb
subdirectory - Ensure database access settings in your
settings.php
corresponds to values in.env
file, e.g.: - Optional: for Drupal 8 or 7 update
NGINX_VHOST_PRESET
correspondingly in your.env
file - Optional: uncomment lines in the compose file to run redis, solr, varnish, etc
- Optional: import existing database
- Optional: macOS users please read this
- Optional: Windows users please read this
- Run containers:
make up
ordocker-compose up -d
- Your drupal website should be up and running at http://drupal.docker.localhost:8000
- You can see status of your containers and their logs via portainer: http://portainer.drupal.docker.localhost:8000
You can stop containers by executing make stop
or docker-compose stop
.
Optional files
If you don't need to run multiple projects and don't use mutagen to improve bind mounts performance on macOS feel free to delete traefik.yml
and mutagen
that come within docker4drupal.tar.gz
Get updates
We release updates to images from time to time, you can find detailed changelog and update instructions on GitHub under releases page
Domains¶
Traefik container used for routing. By default, we use port 8000
to avoid potential conflicts but if port 80
is free on your host machine just replace traefik's ports definition in the compose file.
By default BASE_URL
set to drupal.docker.localhost
, you can change it in .env
file.
Add 127.0.0.1 drupal.docker.localhost
to your /etc/hosts
file (some browsers like Chrome may work without it). Do the same for other default domains you might need from listed below:
Service | Domain |
---|---|
nginx/apache | http://drupal.docker.localhost:8000 |
pma | http://pma.drupal.docker.localhost:8000 |
adminer | http://adminer.drupal.docker.localhost:8000 |
mailhog | http://mailhog.drupal.docker.localhost:8000 |
solr | http://solr.drupal.docker.localhost:8000 |
nodejs | http://nodejs.drupal.docker.localhost:8000 |
node | http://front.drupal.docker.localhost:8000 |
varnish | http://varnish.drupal.docker.localhost:8000 |
portainer | http://portainer.drupal.docker.localhost:8000 |
webgrind | http://webgrind.drupal.docker.localhost:8000 |
Xdebug¶
Xdebug troubleshooting
Enable xdebug logs to get more information by adding $PHP_XDEBUG_REMOTE_LOG=/tmp/php-xdebug.log
environment variable to PHP container
Debugging web requests¶
- Uncomment these lines for PHP service in your docker-compose file
- Restart containers (
make
) - Start debugging in IDE
- Start your browser debug helper plugin (Chrome or Firefox) and open the page you want to debug. Alternatively, enable auto start by adding
PHP_XDEBUG_REMOTE_AUTOSTART=1
Debugging CLI requests¶
- Enable Xdebug as described in the previous section
- Uncomment the following environment variables for PHP service in your composer file
- Perform configuration as described below depending on your OS and Docker version:
Linux, Docker¶
- Uncomment
PHP_XDEBUG_REMOTE_HOST: 172.17.0.1
for PHP service - Restart containers (
make
)
macOS, Docker¶
- Uncomment
PHP_XDEBUG_REMOTE_HOST: host.docker.internal
for PHP service (Docker 18.03+) - Restart containers (
make
)
Windows¶
- Uncomment
PHP_XDEBUG_REMOTE_HOST: host.docker.internal
for PHP service (Docker 18.03+) - Restart containers (
make
) - Allow listen connection for your IDE in
Windows Firewall > Allow an app .
Also, you might need to update your hosts file.
IDE configuration¶
You must additionally configure your IDE to debug CLI requests.
PHPStorm¶
- Open
Run > Edit Configurations
from the main menu, chooseDefaults > PHP Web Page
in the left sidebar - Click to
[..]
to the right ofServer
and add a new server- Enter name
my-ide
(as specified inPHP_IDE_CONFIG
) - Enter any host, it does not matter
- Check
Use path mappings
, select path to your project and enter/var/www/html
in the right column (Absolute path on the server)
- Enter name
- Choose newly created server in 'Server' for PHP Web Page
- Save settings
Crond¶
Crond enabled by default and runs every hour. The default command is:
You might need to change if your HTTP root is different. Runs fromwww-data
user.Database import and export¶
MariaDB¶
Known issues with indexes rebuild
Issues have been reported when MariaDB does not build indexes when dump imported using mariadb-init
bind mount. For safety use the workaround described at https://github.com/wodby/mariadb/issues/11
if you want to import your database, uncomment the line for mariadb-init
bind mount in your compose file. Create the directory ./mariadb-init
in the same directory as the compose file and put there your .sql .sql.gz .sh
file(s). All SQL files will be automatically imported once MariaDB container has started.
Exporting all databases:
Exporting a specific database:
PostgreSQL¶
if you want to import your database, uncomment the line for postgres-init
volume in your compose file. Create the volume directory ./postgres-init
in the same directory as the compose file and put there your .sql .sql.gz .sh
file(s). All SQL files will be automatically imported once Postgres container has started.
Make commands¶
Basic:
We provide Makefile
that contains commands to simplify the work with your local environment. You can run make [COMMAND]
to execute the following commands:
Drupal-specific:
Docker for mac¶
There two major problems macOS users face with when using Docker for mac:
macOS permissions issues¶
To avoid any permissions issues caused by different user id (uid), group id (gid) between your host and a container use -dev-macos
version of php image (uncomment the environment variables in .env
files) where the default user wodby
has 501:20
uid/gid that matches default macOS user.
Bind mounts performance¶
By default, we use :cached
option on bind mounts to improve performance on macOS (on Linux it behaves similarly to consistent
). You can find more information about this in docker blog. However, there's the synchronisation with Mutagen which is a faster alternative.
Mutagen¶
The core idea of this project is to use an external volume that will sync your files with a file synchronizer tool.
Get updates
We release updates to images from time to time, you can find detailed changelog and update instructions on GitHub under releases page
Domains¶
Traefik container used for routing. By default, we use port 8000
to avoid potential conflicts but if port 80
is free on your host machine just replace traefik's ports definition in the compose file.
By default BASE_URL
set to drupal.docker.localhost
, you can change it in .env
file.
Add 127.0.0.1 drupal.docker.localhost
to your /etc/hosts
file (some browsers like Chrome may work without it). Do the same for other default domains you might need from listed below:
Service | Domain |
---|---|
nginx/apache | http://drupal.docker.localhost:8000 |
pma | http://pma.drupal.docker.localhost:8000 |
adminer | http://adminer.drupal.docker.localhost:8000 |
mailhog | http://mailhog.drupal.docker.localhost:8000 |
solr | http://solr.drupal.docker.localhost:8000 |
nodejs | http://nodejs.drupal.docker.localhost:8000 |
node | http://front.drupal.docker.localhost:8000 |
varnish | http://varnish.drupal.docker.localhost:8000 |
portainer | http://portainer.drupal.docker.localhost:8000 |
webgrind | http://webgrind.drupal.docker.localhost:8000 |
Xdebug¶
Xdebug troubleshooting
Enable xdebug logs to get more information by adding $PHP_XDEBUG_REMOTE_LOG=/tmp/php-xdebug.log
environment variable to PHP container
Debugging web requests¶
- Uncomment these lines for PHP service in your docker-compose file
- Restart containers (
make
) - Start debugging in IDE
- Start your browser debug helper plugin (Chrome or Firefox) and open the page you want to debug. Alternatively, enable auto start by adding
PHP_XDEBUG_REMOTE_AUTOSTART=1
Debugging CLI requests¶
- Enable Xdebug as described in the previous section
- Uncomment the following environment variables for PHP service in your composer file
- Perform configuration as described below depending on your OS and Docker version:
Linux, Docker¶
- Uncomment
PHP_XDEBUG_REMOTE_HOST: 172.17.0.1
for PHP service - Restart containers (
make
)
macOS, Docker¶
- Uncomment
PHP_XDEBUG_REMOTE_HOST: host.docker.internal
for PHP service (Docker 18.03+) - Restart containers (
make
)
Windows¶
- Uncomment
PHP_XDEBUG_REMOTE_HOST: host.docker.internal
for PHP service (Docker 18.03+) - Restart containers (
make
) - Allow listen connection for your IDE in
Windows Firewall > Allow an app .
Also, you might need to update your hosts file.
IDE configuration¶
You must additionally configure your IDE to debug CLI requests.
PHPStorm¶
- Open
Run > Edit Configurations
from the main menu, chooseDefaults > PHP Web Page
in the left sidebar - Click to
[..]
to the right ofServer
and add a new server- Enter name
my-ide
(as specified inPHP_IDE_CONFIG
) - Enter any host, it does not matter
- Check
Use path mappings
, select path to your project and enter/var/www/html
in the right column (Absolute path on the server)
- Enter name
- Choose newly created server in 'Server' for PHP Web Page
- Save settings
Crond¶
Crond enabled by default and runs every hour. The default command is:
You might need to change if your HTTP root is different. Runs fromwww-data
user.Database import and export¶
MariaDB¶
Known issues with indexes rebuild
Issues have been reported when MariaDB does not build indexes when dump imported using mariadb-init
bind mount. For safety use the workaround described at https://github.com/wodby/mariadb/issues/11
if you want to import your database, uncomment the line for mariadb-init
bind mount in your compose file. Create the directory ./mariadb-init
in the same directory as the compose file and put there your .sql .sql.gz .sh
file(s). All SQL files will be automatically imported once MariaDB container has started.
Exporting all databases:
Exporting a specific database:
PostgreSQL¶
if you want to import your database, uncomment the line for postgres-init
volume in your compose file. Create the volume directory ./postgres-init
in the same directory as the compose file and put there your .sql .sql.gz .sh
file(s). All SQL files will be automatically imported once Postgres container has started.
Make commands¶
Basic:
We provide Makefile
that contains commands to simplify the work with your local environment. You can run make [COMMAND]
to execute the following commands:
Drupal-specific:
Docker for mac¶
There two major problems macOS users face with when using Docker for mac:
macOS permissions issues¶
To avoid any permissions issues caused by different user id (uid), group id (gid) between your host and a container use -dev-macos
version of php image (uncomment the environment variables in .env
files) where the default user wodby
has 501:20
uid/gid that matches default macOS user.
Bind mounts performance¶
By default, we use :cached
option on bind mounts to improve performance on macOS (on Linux it behaves similarly to consistent
). You can find more information about this in docker blog. However, there's the synchronisation with Mutagen which is a faster alternative.
Mutagen¶
The core idea of this project is to use an external volume that will sync your files with a file synchronizer tool.
- Uncomment Mutagen volume and service definitions in your compose file
- Replace codebase volumes definitions of services with the option below marked as 'Mutagen'
- Start the mutagen container
docker-compose up -d mutagen
- Start Mutagen:
mutagen project start -f mutagen/config.yml
(or just runmake mutagen
instead of steps 3 and 4) - Start other containers
docker-compose up -d
(ormake
) - When you no longer need mutagen run
mutagen project terminate
Now when you change your code on the host machine Mutagen will sync your data to php and nginx/apache containers.
For more information visit Mutagen project page.
Permissions issues¶
You might have permissions issues caused by non-matching uid/gid on your host machine and the default user in php container.
Linux¶
Since version 5.0 the default php container user wodby
has uid/gid 1000
that matches the default uid/gid for most popular Linux distributions.
macOS¶
Use -dev-macos
version of php image where default wodby
user has 501:20
uid/gid that matches default macOS user.
Windows¶
Since you can't change owner of mounted volumes in Docker for Win, the only solution is to run everything as root, add the following options to php
service in your docker-compose file:
Different uid/gid?¶
You can rebuild the base image wodby/php with custom user/group ids by using docker build arguments WODBY_USER_ID
, WODBY_GROUP_ID
(both 1000
by default)
Running multiple Projects¶
This project uses træfik to route traffic to different containers. Træfik is a modern HTTP reverse proxy and load balancer made to deploy microservices with ease. To understand the basics of Traefik it is suggested to check Træfik's documentation page: https://docs.traefik.io/
Image: Multi-domain set-up example(Source: traefik.io)
There are two ways how you can run multiple projects:
Single port¶
In this case you will run a stand-alone traefik that will be connected to docker networks of your projects:
- Download
traefik.yml
file (part ofdocker4x.tar.gz
archive). Place it separately from your projects, it will be a global traefik container that will route requests to your projects on a specified port - Now we need to provide traefik names of docker networks of our projects. Let's say projects directories with
docker-compose.yml
namedfoo
andbar
. Docker Compose will create default docker networks for these projects calledfoo_default
andbar_default
. Update external networks names accordingly intraefik.yml
- In
docker-compose.yml
of your projects comment outtraefik
service and make suretraefik.http.*
labels have${PROJECT_NAME}_
prefix - Make sure
$PROJECT_BASE_URL
and$PROJECT_NAME
(in.env
file) differ, both hosts point to127.0.0.1
in/etc/hosts
- Run your projects:
make
(ordocker-compose up -d
) - Run stand-alone traefik:
docker-compose -f traefik.yml up -d
- Now when you visit URL from
$PROJECT_BASE_URL
, traefik will route traffic to the corresponding docker networks
Different ports¶
Alternatively, instead of running a stand-alone traefik, you can just run default traefik containers on different ports. Just a few things to make sure:
- Ports of
traefik
service in yourdocker-compose.yml
files differ traefik.http.*
labels have${PROJECT_NAME}_
prefix$PROJECT_BASE_URL
and$PROJECT_NAME
(in.env
file) differ, both hosts point to127.0.0.1
in/etc/hosts
Download Xdebug
Download the Xdebug extension compatible with your PHP version and install it as described in the installation guide.
If you are using an AMP package, the Xdebug extension may be already installed. Refer to the instructions specific for your package.
Integrate Xdebug with the PHP interpreter
Xdebug Docker.for.mac.localhost
Open the active php.ini file in the editor:
In the Settings/Preferences dialog Ctrl+Alt+S, click PHP under Languages & Frameworks.
On the PHP page that opens, click next to the CLI Interpreter field.
In the CLI Interpreters dialog that opens, the Configuration File read-only field shows the path to the active php.ini file. Click Open in Editor.
To disable the Zend Debugger and Zend Optimizer tools, which block Xdebug, remove or comment out the following lines in the php.ini file:
zend_extension= zend_extension=To enable Xdebug, locate or create the
[xdebug]
section in the php.ini file and update it as follows:[xdebug] zend_extension='' xdebug.remote_enable=1 xdebug.remote_port='' (the default port is 9000)Mac for designers. In PHP 5.3 and later, you need to use only
zend_extension
, notzend_extension_ts
,zend_extension_debug
, orextension
.To enable multi-user debugging via Xdebug proxies, locate the
xdebug.idekey
setting and assign it a value of your choice. This value will be used to register your IDE on Xdebug proxy servers.Save and close the php.ini file.
Verify Xdebug installation by doing any of the following:
In the command line, run the following command:
The output should list Xdebug among the installed extensions:
Create a php file containing the following code:
Open the file in the browser. The
phpinfo
output should contain the Xdebug section:How find downloads on your Mac in the dock Those icons at the bottom of your screen – the ones that give quick access to programs – comprise the dock, and in that dock is a quick link to your. Global Nav Open Menu Global Nav Close Menu; Apple; Shopping Bag +. Steps: Determine what you have. If you have a file ending in dmg you have a disk image. How to download programs for mac. Browse and download thousands of apps for your Mac — from your Mac. Shop for apps by category, read user reviews, and buy apps in one simple step. Learn more about the Mac. Browse and download over 100 of the best PC and Mac programs. Award-winning video, audio, business, utility, or graphics software. Download Free for PC and Mac.
Configure Xdebug in PhpStorm
In the Settings/Preferences dialog Ctrl+Alt+S, select Languages & Frameworks | PHP.
Check the Xdebug installation associated with the selected PHP interpreter:
On the PHP page, choose the relevant PHP installation from the CLI Interpreter list and click next to the field. The list shows all the PHP installations available in PhpStorm, see Configure local PHP interpreters and Configure remote PHP interpreters.
- The CLI Interpreters dialog that opens shows the following:
The version of the selected PHP installation.
The name and version of the debugging engine associated with the selected PHP installation (Xdebug or Zend Debugger). If no debugger is configured, PhpStorm shows the corresponding message:
Alternatively, open the Xdebug checker, paste the output of the
phpinfo()
, and click Analyze my phpinfo() output. Learn more about checking the Xdebug installation in Validate the Configuration of a Debugging Engine.Define the Xdebug behaviour. Click Debug under the PHP node. On the Debug page that opens, specify the following settings in the Xdebug area:
In the Debug Port field, appoint the port through which the tool will communicate with PhpStorm.
This must be exactly the same port number as specified in the php.ini file: By default, Xdebug listens on port 9000.To have PhpStorm accept any incoming connections from Xdebug engines through the port specified in the Debug port field, select the Can accept external connections checkbox.
- Select the Force break at the first line when no path mapping is specified checkbox to have the debugger stop as soon as it reaches and opens a file that is not mapped to any file in the project on the Servers page. The debugger stops at the first line of this file and Examine/update variables shows the following error message: Cannot find a local copy of the file on server and a link Click to set up mappings. Click the link to open the Resolve Path Mappings Problem dialog and map the problem file to its local copy.
When this checkbox cleared, the debugger does not stop upon reaching and opening an unmapped file, the file is just processed, and no error messages are displayed.
Select the Force break at the first line when the script is outside the project checkbox to have the debugger stop at the first line as soon as it reaches and opens a file outside the current project. With this checkbox cleared, the debugger continues upon opening a file outside the current project.
In the External Connections area, specify how you want PhpStorm to treat connections received from hosts and through ports that are not registered as deployment server configurations.
Ignore external connections through unregistered server configurations: Select this checkbox to have PhpStorm ignore connections received from hosts and through ports that are not registered as deployment server configurations. When this checkbox is selected, PhpStorm does not attempt to create a deployment server configuration automatically.
Break at first line in PHP scripts: Select this checkbox to have the debugger stop as soon as connection between it and PhpStorm is established (instead of running automatically until the first breakpoint is reached). Alternatively turn on the Run | Break at first line in PHP scripts option from the main menu.
Max. simultaneous connections: Use this spin box to limit the number of external connections that can be processed simultaneously.
By default, PhpStorm only listens for incoming IPv4 connections. To enable IPv6 support, you need to make adjustments in PhpStorm JVM options:
Select Help | Edit Custom VM Options from the main menu.
In the .vmoptions file that opens, delete the
-Djava.net.preferIPv4Stack=true
line.Restart PhpStorm.
Phpstorm Docker Xdebug Not Working
Configure Xdebug for using in the On-Demand mode
PhpStorm 2016.2 and later supports the On-Demand mode, where you can disable Xdebug for your global PHP installation and have it enabled automatically on demand only when you are debugging your command-line scripts or when you need code coverage reports. This lets your command line scripts (including Composer and unit tests) run much faster.
Disable Xdebug for command-line scripts:
In the Settings/Preferences dialog Ctrl+Alt+S, select PHP under Languages & Frameworks.
From the PHP executable list, choose the relevant PHP interpreter and click next to it. In the CLI Interpreters dialog that opens, click the Open in Editor link next to the Configuration file: file. Close all the dialogs and switch to the tab where the php.ini file is opened.
In the php.ini file, find the
[xdebug]
section and comment the following line in it by adding;
in preposition:;[xdebug] ;zend_extension = ''Open the CLI Interpreters dialog and click next to the PHP executable field. PhpStorm informs you that debugger is not installed:
To enable PhpStorm to activate Xdebug when it is necessary, specify the path to it in the Debugger extension field, in the Additional area. Type the path manually or click and select the location in the dialog that opens.
Configure Xdebug for using in the Just-In-Time mode
PhpStorm supports the use of Xdebug in the Just-In-Time (JIT) mode so it is not attached to your code all the time but connects to PhpStorm only when an error occurs or an exception is thrown. The Xdebug operation mode is toggled through the xdebug.remote_mode setting, which is by default set to req
. The mode is available both for debugging command-line scripts and for web server debugging.
Depending on whether you are going to debug command-line scripts or use a Web server, use one of the scenarios below.
Command-line scripts
For debugging command-line scripts, specify the custom -dxdebug.remote_mode=jit
directive as an additional configuration option:
In the Settings/Preferences dialog Ctrl+Alt+S, navigate to Languages & Frameworks | PHP.
From the PHP executable list, choose the relevant PHP interpreter and click next to it.
In the CLI Interpreters dialog that opens, click next to the Configuration options field in the Additional area.
In the Configuration options dialog that opens, click to add a new entry, then type
-dxdebug.remote_mode
in the Configuration directive field andjit
in the Value field.When you click OK, you return to the CLI Interpreters dialog where the Configuration options field shows
-dxdebug.remote_mode=jit
.
Web server debugging
From the main menu, choose Run | Web Server Debug Validation.
In the Validate Remote Environment that opens, choose the Web server to validate the debugger on.
Choose Local Web Server or Shared Folder to check a debugger associated with a local Web server.
Path to Create Validation Script: In this field, specify the absolute path to the folder under the server document root where the validation script will be created. For Web servers of the type Inplace, the folder is under the project root.
The folder must be accessible through http.
URL to Validation Script: In this field, type the URL address of the folder where the validation script will be created. If the project root is mapped to a folder accessible through http, you can specify the project root or any other folder under it.
Choose Remote Web Server to check a debugger associated with a remote server.
Path to Create Validation Script: In this field, specify the absolute path to the folder under the server document root where the validation script will be created. The folder must be accessible through http.
Deployment Server: In this field, specify the server access configuration of the type Local Server or Remote Server to access the target environment. For details, see Configure synchronization with a Web server.
Choose a configuration from the list or click Browse in the Deployment dialog.
Click Validate to have PhpStorm create a validation script, deploy it to the target remote environment, and run it there.
Open the php.ini file which is reported as loaded and associated with Xdebug.
In the php.ini file, find the
[xdebug]
section and change the value of thexdebug.remote_mode
from the defaultreq
tojit
.
See also Just-In-Time debugging and PHP Exception Breakpoints with PhpStorm and Xdebug
Configure Xdebug running in a Docker container
To configure Xdebug running in a Docker container, provide the Xdebug-specific parameters in the Dockerfile, for example:
In this example, we're modifying /etc/php/7.0/apache2/php.ini providing the path to the Xdebug extension, and the remote_enable
and remote_host
Album player for mac. Xdebug parameters.
Note that the xdebug.remote_host
value should be replaced with the IP address of the machine where PhpStorm is running, which is accessible from the Docker container. If you are using Docker for Windows or Docker for Mac, you can set xdebug.remote_host
to host.docker.internal
, which automatically resolves to the internal address of the host, letting you easily connect to it from the container.
Xdebug Docker For Mac Catalina
Configure Xdebug running on a Vagrant instance
To configure Xdebug running on a Vagrant instance, connect to the Vagrant machine and provide the Xdebug-specific parameters in the php.ini file:
Xdebug Php Docker
Note that the xdebug.remote_host
value is 10.0.2.2
. This is the gateway used in the default Vagrant setup, which allows connecting from the instance to host where PhpStorm is running.