{"id":15970,"date":"2017-02-03T16:15:42","date_gmt":"2017-02-03T14:15:42","guid":{"rendered":"http:\/\/www.webcodegeeks.com\/?p=15970"},"modified":"2017-12-19T12:15:18","modified_gmt":"2017-12-19T10:15:18","slug":"debug-php-docker-phpstorm-xdebug","status":"publish","type":"post","link":"https:\/\/www.webcodegeeks.com\/devops\/debug-php-docker-phpstorm-xdebug\/","title":{"rendered":"Debug PHP in Docker with PhpStorm and Xdebug"},"content":{"rendered":"<p>Xdebug is one of the most known PHP extensions, a very complete and powerful debugger. This tutorial will show you how to use it in combination with PhpStorm, probably the most used PHP IDE; and Docker, the archi-known contanerization software.<br \/>\n&nbsp;<br \/>\nThis would allow us to simply write a Dockerfile with all the Xdebug configuration, and being able to easily deploy our Xdebug server anywhere.<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n[ulp id=&#8217;OCKUMTbC259tpbxG&#8217;]<br \/>\n&nbsp;<br \/>\nFor this tutorial, Linux Mint 18, Docker 1.12.3 and PhpStorm 2016.3.2 have been used.<\/p>\n<div class=\"tip\"><strong>Tip<\/strong><br \/>\nYou may skip environment installation and jump directly to the <a href=\"#section_2\"><strong>beginning of the tutorial<\/strong><\/a> below.<\/div>\n<h2>1. Installation<\/h2>\n<h3>1.1. Docker<\/h3>\n<p><strong>Note<\/strong>: Docker requires a 64-bit system with a kernel version equal or higher to 3.10.<\/p>\n<p>We can install Docker simply via <code>apt-get<\/code>, without the need of adding any repository, just installing the <code>docker.io<\/code> package:<\/p>\n<pre class=\"brush:bash\">sudo apt-get update\r\nsudo apt-get install docker.io<\/pre>\n<p>For more details, you can follow the <a href=\"https:\/\/www.webcodegeeks.com\/devops\/install-docker-ubuntu-tutorial\/\">Install Docker on Ubuntu Tutorial<\/a>.<\/p>\n<h3>1.2. PhpStorm<\/h3>\n<p>We can download PhpStorm from <a href=\"https:\/\/www.jetbrains.com\/phpstorm\/download\/#section=linux-version\">JetBrains official site<\/a>. Unfortunately, PhpStorm is not free, but it comes with an evaluation key for a 30 day free trial.<\/p>\n<p>After downloading the tar.gz file, the only thing we have to do is uncompress it, place the folder in the directory we want to have PhpStorm (e.g., in <code>$HOME<\/code>), and execute the <code>bin\/phpstorm.sh<\/code> file.<\/p>\n<p>The first thing is to select whether to import settings from previous PhpStorm versions or not, as shown in the image below.<\/p>\n<figure style=\"width: 506px\" class=\"wp-caption aligncenter\"><img decoding=\"async\" src=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/02\/phpstorm_1.jpg\" width=\"506\" height=\"207\" \/><figcaption class=\"wp-caption-text\">1. Importing (or not) settings from previous PhpStorm versions.<\/figcaption><\/figure>\n<p>In the next screen, we must choose the &#8220;Evaluate for free&#8221; option (only just if we don&#8217;t have a license, of course).<\/p>\n<figure style=\"width: 428px\" class=\"wp-caption aligncenter\"><img decoding=\"async\" src=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/02\/phpstorm_2.jpg\" width=\"428\" height=\"402\" \/><figcaption class=\"wp-caption-text\">2. Choosing PhpStorm license.<\/figcaption><\/figure>\n<p>After agreeing the terms of use of PhpStorm, the setup ends with the initial configuration screen. The most important option here is &#8220;Create desktop entry (integrate in system menu)&#8221;, for being able to start PhpStorm from the menu, instead of having to execute the script as made before.<\/p>\n<figure style=\"width: 382px\" class=\"wp-caption aligncenter\"><img decoding=\"async\" src=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/02\/phpstorm_3.jpg\" width=\"382\" height=\"352\" \/><figcaption class=\"wp-caption-text\">3. PhpStorm initial configuration.<\/figcaption><\/figure>\n<p>&nbsp;<\/p>\n<h2 id=\"section_2\">2. Creating the PhpStorm project<\/h2>\n<p>Before starting with the Docker container, we should first create the PhpStorm project, because for the container creation we will need the path to it.<\/p>\n<p>Creating a project is as simple as opening PhpStorm and selecting &#8220;Create new project&#8221;. We will have to choose the PHP version (the same as the one running within the container), and the location for the project.<\/p>\n<figure style=\"width: 666px\" class=\"wp-caption aligncenter\"><img decoding=\"async\" src=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/02\/create-project.jpg\" width=\"666\" height=\"460\" \/><figcaption class=\"wp-caption-text\">4. Creating the PhpStorm project.<\/figcaption><\/figure>\n<h2>3. Creating the PHP container<\/h2>\n<p>For creating the container, we will create a Dockerfile based on the official PHP image, in combination with Apache as web server; and installing and enabling Xdebug. Such Dockerfile will consist on:<\/p>\n<p><span style=\"text-decoration: underline;\"><em>Dockerfile<\/em><\/span><\/p>\n<pre class=\"brush:bash\">FROM php:7.0-apache\r\n\u00a0\r\nENV DEBIAN_FRONTEND=noninteractive\r\n\u00a0\r\nRUN pecl install xdebug\r\n\u00a0\r\nRUN docker-php-ext-enable xdebug\r\nRUN echo \"zend_extension=\/usr\/local\/lib\/php\/extensions\/no-debug-non-zts-20151012\/xdebug.so\" &gt;&gt; \/usr\/local\/etc\/php\/conf.d\/docker-php-ext-xdebug.ini\r\nRUN echo \"xdebug.remote_enable=on\" &gt;&gt; \/usr\/local\/etc\/php\/conf.d\/docker-php-ext-xdebug.ini\r\nRUN echo \"xdebug.remote_autostart=true\" &gt;&gt; \/usr\/local\/etc\/php\/conf.d\/docker-php-ext-xdebug.ini\r\nRUN echo \"xdebug.remote_handler=dbgp\" &gt;&gt; \/usr\/local\/etc\/php\/conf.d\/docker-php-ext-xdebug.ini\r\nRUN echo \"xdebug.remote_mode=req\" &gt;&gt; \/usr\/local\/etc\/php\/conf.d\/docker-php-ext-xdebug.ini\r\nRUN echo \"xdebug.remote_port=10000\" &gt;&gt; \/usr\/local\/etc\/php\/conf.d\/docker-php-ext-xdebug.ini\r\nRUN echo \"xdebug.remote_log=\/var\/log\/xdebug_remote.log\" &gt;&gt; \/usr\/local\/etc\/php\/conf.d\/docker-php-ext-xdebug.ini\r\nRUN echo \"xdebug.idekey=PHPSTORM\" &gt;&gt; \/usr\/local\/etc\/php\/conf.d\/docker-php-ext-xdebug.ini\r\nRUN echo \"xdebug.remote_connect_back=Off\" &gt;&gt; \/usr\/local\/etc\/php\/conf.d\/docker-php-ext-xdebug.ini<\/pre>\n<p>The <code>docker-php-ext-enable xdebug<\/code> creates the config file for Xdebug; then, we throw the configuration for it to the file where is created. Note that we chose the port 10000 for Xdebug, and <code>PHPSTORM<\/code> for IDE key..<\/p>\n<p>We can build the image just running.<\/p>\n<pre class=\"brush:bash\">docker build --tag=myphp . # Path to the Dockerfile.<\/pre>\n<p>For creating the container, we need the IP address of the host, since Xdebug needs the remote host IP, which will be passed to the container as environmental variable. In my case, the IP address is <code>172.16.209.148<\/code>.<\/p>\n<p>As said before, we also need the path of the project in the host, in order to map with the web directory in the container.<\/p>\n<p>Taking all this into account, we would create the container executing:<\/p>\n<pre class=\"brush:bash\">docker run -p 8080:80 -d --name=myphp1 -e XDEBUG_CONFIG=\"remote_host=172.16.209.148\" -v \/home\/julen\/PhpstormProjects\/phpstorm-docker-xdebug:\/var\/www\/html\u00a0 myphp<\/pre>\n<p>Note that we have mapped container&#8217;s port 80 to host&#8217;s 8080, to avoid conflicts in the case of having some web server running in the host.<\/p>\n<p>Now, we should be able to access the web server running in the container with the URL <code>http:\/\/localhost:8080\/<\/code> (even if we get a 403 error).<\/p>\n<h2>4. Configuring access to Xdebug to PhpStorm<\/h2>\n<p>The next step is to make PhpStorm know how to use Xdebug.<\/p>\n<p>For that, we have to click in the arrow placed in the right-top corner of the IDE, and select &#8220;Edit Configurations&#8221;.<\/p>\n<figure style=\"width: 1053px\" class=\"wp-caption aligncenter\"><img decoding=\"async\" src=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/02\/edit_configurations.jpg\" width=\"1053\" height=\"485\" \/><figcaption class=\"wp-caption-text\">5. Editing the run configuration.<\/figcaption><\/figure>\n<p>In the new window, we have to click the green arrow, and select &#8220;PHP Remote Debug&#8221;.<\/p>\n<figure style=\"width: 1084px\" class=\"wp-caption aligncenter\"><img decoding=\"async\" src=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/02\/php_remote_debug.jpg\" width=\"1084\" height=\"663\" \/><figcaption class=\"wp-caption-text\">6. Adding a remote debug configuration.<\/figcaption><\/figure>\n<p>Now, we have to create a new server, clicking in the three dots in the &#8220;Servers&#8221; section. Here we have to set a name, the host the server is running (the container in localhost), and the port (8080, the exposed port to the host). We also have to set the web path of the server, which is <code>\/var\/www\/html<\/code>.<\/p>\n<figure style=\"width: 894px\" class=\"wp-caption aligncenter\"><img decoding=\"async\" src=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/02\/new_server.jpg\" width=\"894\" height=\"691\" \/><figcaption class=\"wp-caption-text\">7. Configuring the remote debug server.<\/figcaption><\/figure>\n<p>Having the server configured, we just have to select it in the debug configuration, and specify the IDE key set in the Dockerfile for the Xdebug configuration, <code>PHPSTORM<\/code>:<\/p>\n<figure style=\"width: 986px\" class=\"wp-caption aligncenter\"><img decoding=\"async\" src=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/02\/run_config.jpg\" width=\"986\" height=\"663\" \/><figcaption class=\"wp-caption-text\">8. Selecting the remote debug server.<\/figcaption><\/figure>\n<p>Finally, now in &#8220;File\/Settings\/Languages &amp; Frameworks\/PHP\/Debug&#8221;, in the &#8220;Xdebug&#8221; section, we have to specify the port we set in the configuration, and mark all the options.<\/p>\n<figure style=\"width: 1024px\" class=\"wp-caption aligncenter\"><img decoding=\"async\" src=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/02\/xdebug_port.jpg\" width=\"1024\" height=\"689\" \/><figcaption class=\"wp-caption-text\">9. Configuring Xdebug.<\/figcaption><\/figure>\n<p>Once saved everything, we can start the debugging (Shift + F9) with the specified config. In the bottom part, in the &#8220;Debugger&#8221; tab, we will see the following message:<\/p>\n<blockquote><p>Waiting\u00a0 for incoming connection with ide key &#8216;PHPSTORM&#8217;<\/p><\/blockquote>\n<p>Meaning this, that we are ready to start debugging.<\/p>\n<h2>5. Debugging the PHP code<\/h2>\n<p>For debugging, we can create a script as simple as the following:<\/p>\n<p><em><span style=\"text-decoration: underline;\">example.php<\/span><\/em><\/p>\n<pre class=\"brush:bash\">&lt;?php\r\n\r\n$var = 5;\r\n\r\n$var++;\r\n\r\necho 'example.php'<\/pre>\n<p>And adding a breakpoint, for example, for the <code>echo 'example.php';<\/code> statement, clicking left to it, outside the text editor. A read breakpoint will appear.<\/p>\n<p>If now, we execute the script accessing it from the web server, entering the http:\/\/localhost:8080\/example.php URL in the browser, we will see that some variables will appear:<\/p>\n<figure style=\"width: 1053px\" class=\"wp-caption aligncenter\"><img decoding=\"async\" src=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2017\/02\/debugging.jpg\" width=\"1053\" height=\"695\" \/><figcaption class=\"wp-caption-text\">10. Inspecting variables in the debugger.<\/figcaption><\/figure>\n<p>As we can see, the debugger shows both PHP built-in variables, and the variables we have declared in our script. In this case, in the current breakpoint, shows that the variable value is 6, since we have incremented it in the previous statement.<\/p>\n<h2>6. Summary<\/h2>\n<p>This tutorial has shown how to easily have a complete PHP development environment with Xdebug thanks to Docker, just defining a Dockerfile with the configuration for Xdebug and creating a container; and then configuring the PhpStorm IDE to make use of it.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Xdebug is one of the most known PHP extensions, a very complete and powerful debugger. This tutorial will show you how to use it in combination with PhpStorm, probably the most used PHP IDE; and Docker, the archi-known contanerization software. &nbsp; This would allow us to simply write a Dockerfile with all the Xdebug configuration, &hellip;<\/p>\n","protected":false},"author":160,"featured_media":10356,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[17],"tags":[217],"class_list":["post-15970","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-devops","tag-docker"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Debug PHP in Docker with PhpStorm and Xdebug - Web Code Geeks - 2026<\/title>\n<meta name=\"description\" content=\"Xdebug is one of the most known PHP extensions, a very complete and powerful debugger. This tutorial will show you how to use it in combination with\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.webcodegeeks.com\/devops\/debug-php-docker-phpstorm-xdebug\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Debug PHP in Docker with PhpStorm and Xdebug - Web Code Geeks - 2026\" \/>\n<meta property=\"og:description\" content=\"Xdebug is one of the most known PHP extensions, a very complete and powerful debugger. This tutorial will show you how to use it in combination with\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.webcodegeeks.com\/devops\/debug-php-docker-phpstorm-xdebug\/\" \/>\n<meta property=\"og:site_name\" content=\"Web Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/webcodegeeks\" \/>\n<meta property=\"article:published_time\" content=\"2017-02-03T14:15:42+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2017-12-19T10:15:18+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2016\/01\/docker-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Toni\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@webcodegeeks\" \/>\n<meta name=\"twitter:site\" content=\"@webcodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Toni\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.webcodegeeks.com\/devops\/debug-php-docker-phpstorm-xdebug\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/devops\/debug-php-docker-phpstorm-xdebug\/\"},\"author\":{\"name\":\"Toni\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/54a7be647b0b871cff41cbf3d2a95966\"},\"headline\":\"Debug PHP in Docker with PhpStorm and Xdebug\",\"datePublished\":\"2017-02-03T14:15:42+00:00\",\"dateModified\":\"2017-12-19T10:15:18+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/devops\/debug-php-docker-phpstorm-xdebug\/\"},\"wordCount\":1043,\"commentCount\":1,\"publisher\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/devops\/debug-php-docker-phpstorm-xdebug\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2016\/01\/docker-logo.jpg\",\"keywords\":[\"Docker\"],\"articleSection\":[\"DevOps\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.webcodegeeks.com\/devops\/debug-php-docker-phpstorm-xdebug\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.webcodegeeks.com\/devops\/debug-php-docker-phpstorm-xdebug\/\",\"url\":\"https:\/\/www.webcodegeeks.com\/devops\/debug-php-docker-phpstorm-xdebug\/\",\"name\":\"Debug PHP in Docker with PhpStorm and Xdebug - Web Code Geeks - 2026\",\"isPartOf\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/devops\/debug-php-docker-phpstorm-xdebug\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/devops\/debug-php-docker-phpstorm-xdebug\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2016\/01\/docker-logo.jpg\",\"datePublished\":\"2017-02-03T14:15:42+00:00\",\"dateModified\":\"2017-12-19T10:15:18+00:00\",\"description\":\"Xdebug is one of the most known PHP extensions, a very complete and powerful debugger. This tutorial will show you how to use it in combination with\",\"breadcrumb\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/devops\/debug-php-docker-phpstorm-xdebug\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.webcodegeeks.com\/devops\/debug-php-docker-phpstorm-xdebug\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webcodegeeks.com\/devops\/debug-php-docker-phpstorm-xdebug\/#primaryimage\",\"url\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2016\/01\/docker-logo.jpg\",\"contentUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2016\/01\/docker-logo.jpg\",\"width\":150,\"height\":150},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.webcodegeeks.com\/devops\/debug-php-docker-phpstorm-xdebug\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.webcodegeeks.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"DevOps\",\"item\":\"https:\/\/www.webcodegeeks.com\/category\/devops\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Debug PHP in Docker with PhpStorm and Xdebug\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#website\",\"url\":\"https:\/\/www.webcodegeeks.com\/\",\"name\":\"Web Code Geeks\",\"description\":\"Web Developers Resource Center\",\"publisher\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.webcodegeeks.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\/\/www.webcodegeeks.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"contentUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/webcodegeeks\",\"https:\/\/x.com\/webcodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/54a7be647b0b871cff41cbf3d2a95966\",\"name\":\"Toni\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/21c1661474c78b4757355b8beef9ab1d14f490ee3a3e67392f4e618d36643d4c?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/21c1661474c78b4757355b8beef9ab1d14f490ee3a3e67392f4e618d36643d4c?s=96&d=mm&r=g\",\"caption\":\"Toni\"},\"url\":\"https:\/\/www.webcodegeeks.com\/author\/julen-pardo\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Debug PHP in Docker with PhpStorm and Xdebug - Web Code Geeks - 2026","description":"Xdebug is one of the most known PHP extensions, a very complete and powerful debugger. This tutorial will show you how to use it in combination with","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.webcodegeeks.com\/devops\/debug-php-docker-phpstorm-xdebug\/","og_locale":"en_US","og_type":"article","og_title":"Debug PHP in Docker with PhpStorm and Xdebug - Web Code Geeks - 2026","og_description":"Xdebug is one of the most known PHP extensions, a very complete and powerful debugger. This tutorial will show you how to use it in combination with","og_url":"https:\/\/www.webcodegeeks.com\/devops\/debug-php-docker-phpstorm-xdebug\/","og_site_name":"Web Code Geeks","article_publisher":"https:\/\/www.facebook.com\/webcodegeeks","article_published_time":"2017-02-03T14:15:42+00:00","article_modified_time":"2017-12-19T10:15:18+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2016\/01\/docker-logo.jpg","type":"image\/jpeg"}],"author":"Toni","twitter_card":"summary_large_image","twitter_creator":"@webcodegeeks","twitter_site":"@webcodegeeks","twitter_misc":{"Written by":"Toni","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.webcodegeeks.com\/devops\/debug-php-docker-phpstorm-xdebug\/#article","isPartOf":{"@id":"https:\/\/www.webcodegeeks.com\/devops\/debug-php-docker-phpstorm-xdebug\/"},"author":{"name":"Toni","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/54a7be647b0b871cff41cbf3d2a95966"},"headline":"Debug PHP in Docker with PhpStorm and Xdebug","datePublished":"2017-02-03T14:15:42+00:00","dateModified":"2017-12-19T10:15:18+00:00","mainEntityOfPage":{"@id":"https:\/\/www.webcodegeeks.com\/devops\/debug-php-docker-phpstorm-xdebug\/"},"wordCount":1043,"commentCount":1,"publisher":{"@id":"https:\/\/www.webcodegeeks.com\/#organization"},"image":{"@id":"https:\/\/www.webcodegeeks.com\/devops\/debug-php-docker-phpstorm-xdebug\/#primaryimage"},"thumbnailUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2016\/01\/docker-logo.jpg","keywords":["Docker"],"articleSection":["DevOps"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.webcodegeeks.com\/devops\/debug-php-docker-phpstorm-xdebug\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.webcodegeeks.com\/devops\/debug-php-docker-phpstorm-xdebug\/","url":"https:\/\/www.webcodegeeks.com\/devops\/debug-php-docker-phpstorm-xdebug\/","name":"Debug PHP in Docker with PhpStorm and Xdebug - Web Code Geeks - 2026","isPartOf":{"@id":"https:\/\/www.webcodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.webcodegeeks.com\/devops\/debug-php-docker-phpstorm-xdebug\/#primaryimage"},"image":{"@id":"https:\/\/www.webcodegeeks.com\/devops\/debug-php-docker-phpstorm-xdebug\/#primaryimage"},"thumbnailUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2016\/01\/docker-logo.jpg","datePublished":"2017-02-03T14:15:42+00:00","dateModified":"2017-12-19T10:15:18+00:00","description":"Xdebug is one of the most known PHP extensions, a very complete and powerful debugger. This tutorial will show you how to use it in combination with","breadcrumb":{"@id":"https:\/\/www.webcodegeeks.com\/devops\/debug-php-docker-phpstorm-xdebug\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.webcodegeeks.com\/devops\/debug-php-docker-phpstorm-xdebug\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webcodegeeks.com\/devops\/debug-php-docker-phpstorm-xdebug\/#primaryimage","url":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2016\/01\/docker-logo.jpg","contentUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2016\/01\/docker-logo.jpg","width":150,"height":150},{"@type":"BreadcrumbList","@id":"https:\/\/www.webcodegeeks.com\/devops\/debug-php-docker-phpstorm-xdebug\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.webcodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"DevOps","item":"https:\/\/www.webcodegeeks.com\/category\/devops\/"},{"@type":"ListItem","position":3,"name":"Debug PHP in Docker with PhpStorm and Xdebug"}]},{"@type":"WebSite","@id":"https:\/\/www.webcodegeeks.com\/#website","url":"https:\/\/www.webcodegeeks.com\/","name":"Web Code Geeks","description":"Web Developers Resource Center","publisher":{"@id":"https:\/\/www.webcodegeeks.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.webcodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.webcodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/www.webcodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/webcodegeeks","https:\/\/x.com\/webcodegeeks"]},{"@type":"Person","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/54a7be647b0b871cff41cbf3d2a95966","name":"Toni","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/21c1661474c78b4757355b8beef9ab1d14f490ee3a3e67392f4e618d36643d4c?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/21c1661474c78b4757355b8beef9ab1d14f490ee3a3e67392f4e618d36643d4c?s=96&d=mm&r=g","caption":"Toni"},"url":"https:\/\/www.webcodegeeks.com\/author\/julen-pardo\/"}]}},"_links":{"self":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/posts\/15970","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/users\/160"}],"replies":[{"embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/comments?post=15970"}],"version-history":[{"count":0,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/posts\/15970\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/media\/10356"}],"wp:attachment":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/media?parent=15970"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/categories?post=15970"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/tags?post=15970"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}