In VSCode, alongside the default PHP configuration in launch.json, you’ll need path mappings for the Docker image. Note for Mac environments use the following: XDEBUG_CONFIG : >- idekey=PHPSTORM client_host= XDEBUG_CONFIG : >- idekey=PHPSTORM client_host= build-deps Configure Xdebug with Docker Compose Override #ĭ ensures that the production configuration remains untouched.Īs an example, an override could look like this: version : "3.4" services : php : build : target : api_platform_php_dev environment : # See # See # The `remote_host` below may optionally be replaced with `remote_connect_back` # XDEBUG_MODE required for step debugging XDEBUG_MODE : debug # default port for Xdebug 3 is 9003 # idekey=VSCODE if you are debugging with VSCode XDEBUG_CONFIG : >- client_host= idekey=PHPSTORM # This should correspond to the server declared in PHPStorm `Preferences | Languages & Frameworks | PHP | Servers` # Then PHPStorm will use the corresponding path mappings PHP_IDE_CONFIG : serverName=api-platform version : "3.4" services : php : build : target : api_platform_php_dev environment : # See # See # The `remote_host` below may optionally be replaced with `remote_connect_back` # XDEBUG_MODE required for step debugging XDEBUG_MODE : debug # default port for Xdebug 3 is 9003 # idekey=VSCODE if you are debugging with VSCode XDEBUG_CONFIG : >- client_host= idekey=PHPSTORM # This should correspond to the server declared in PHPStorm `Preferences | Languages & Frameworks | PHP | Servers` # Then PHPStorm will use the corresponding path mappings PHP_IDE_CONFIG : serverName=api-platform build-deps $PHPIZE_DEPS \ pecl install xdebug-$XDEBUG_VERSION \ docker-php-ext-enable xdebug \ apk del. build-deps # api/Dockerfile FROM api_platform_php as api_platform_php_dev ARG XDEBUG_VERSION=3.1.3 RUN set -eux \ apk add -no-cache -virtual. # api/Dockerfile FROM api_platform_php as api_platform_php_dev ARG XDEBUG_VERSION=3.1.3 RUN set -eux \ apk add -no-cache -virtual. It’s recommended to add a custom stage to the end of the api/Dockerfile. To avoid deploying API Platform to production with an active Xdebug extension, Add a Development Stage to the Dockerfile # Purposes such as debugging tests or remote API requests. Though to add Xdebug to your project, for development The default Docker stack is shipped without a Xdebug stage. Then, you need to specify the xdebug.remote_host (IP address of your local from your Vagrant) when launching the command from the virtual machine’s terminal.Watch the Debugging API Platform screencast Xdebug # To use Xdebug for debugging commands or unit tests, first, you need to add xdebug.remote_autostart=true in XDebug configuration file of your Vagrant xdebug.ini. Use Xdebug to debug commands or unit tests Once your Xdebug configuration is added, you need to add ?XDEBUG_SESSION_START=_ at the end of your route. Use Xdebug to debug your APIs route with Postman Xdebug plugin also exists for other browsers.įinally, in your browser click on the bug in your address bar to switch to the "Debug" mode You have to use the IDE key previously set. Right-click on it, then click on the "Options" sub-menu. Now, you should see on the right side of the address bar the extension's symbol. Make sure that the extension is enabled on your browser's extensions list page. Now that Vagrant with Xdebug is up and running, let's configure Xdebug Chrome extension.įirst, we need to install it from Chrome Web Store Step3: Configure Xdebug Use Xdebug to debug your web application on Chrome Check "Use path mappings" checkbox, and write the project's absolute path.To fully configure this debugger configuration, you will need to create what PhpStorm calls a server. We will use the IDE key configured in your Vagrant and in your browser. Then, add a new "PHP Remote Debug" configuration. Step2: Configure PhpStormįirst, select the "Edit configurations" item in the "Run" menu. If you use Ansible to provision your virtual machine, you can also use a ready-to-action Xdebug role.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |