{"id":1011,"date":"2017-12-21T02:40:10","date_gmt":"2017-12-21T02:40:10","guid":{"rendered":"http:\/\/blog.silverterra.net\/?p=1011"},"modified":"2017-12-21T03:33:27","modified_gmt":"2017-12-21T03:33:27","slug":"php-xdebug-xampp-php-7","status":"publish","type":"post","link":"https:\/\/blog.silverterra.net\/?p=1011","title":{"rendered":"PHP xDebug &#8211; xampp &#8211; php 7 &#8211; chrome"},"content":{"rendered":"<blockquote><p>Goal: not a question, how we can know what is under the hood<\/p><\/blockquote>\n<p>The PHP debugging is not a trivial case. Could be with the xDebug extension. Follow these steps:<\/p>\n<p><b>A. Xdebug core environment<\/b><\/p>\n<pre data-enlighter-language=\"raw\" class=\"EnlighterJSRAW\">\r\nprepare the debugger\r\n1. get the xDebug extension: http:\/\/xdebug.org\/files\/php_xdebug-2.4.0rc3-7.0-vc14.dll\r\n2. copy this file to the xampp ext directory (the default dir: C:\\xampp\\php\\ext)\r\n\r\nset the xampp\r\n3. edit the php.ini file (the default path: C:\\xampp\\php\\php.ini)\r\n4. create an XDebug section in the ini file\r\n\r\n[XDebug]\r\nzend_extension = &quot;c:\\xampp\\php\\ext\\php_xdebug-2.4.0rc3-7.0-vc14.dll&quot;\r\nxdebug.profiler_append = 0\r\nxdebug.profiler_enable = 0\r\nxdebug.profiler_enable_trigger = 0\r\nxdebug.profiler_output_dir = &quot;c:\\xampp\\tmp&quot;\r\nxdebug.remote_enable = 1\r\nxdebug.remote_handler = &quot;dbgp&quot;\r\nxdebug.remote_host = &quot;127.0.0.1&quot;\r\nxdebug.remote_log=&quot;c:\\xampp\\tmp\\xdebug.txt&quot;\r\nxdebug.remote_port = 9000\r\nxdebug.trace_output_dir = &quot;c:\\xampp\\tmp&quot;\r\nxdebug.remote_cookie_expire_time = 36000\r\n\r\n5. restart the apache\r\n<\/pre>\n<p>notice: according to the internet you need to disable the output buffering <strong>output_buffering = Off<\/strong><br \/>\nfor me working with the following output_buffering=4096&#8230;<br \/>\nso if you want just disable the buffering. You will see.<\/p>\n<p>After the apache restarted check the xampp dashboard, hopefully you will see the following<br \/>\n<a href=\"http:\/\/localhost\/dashboard\/phpinfo.php\">http:\/\/localhost\/dashboard\/phpinfo.php<\/a><\/p>\n<p style=\"text-align:center;\"><img decoding=\"async\" src=\"http:\/\/blog.silverterra.net\/wp-content\/uploads\/2017\/12\/xDebug-in-the-dashboard.jpg\" alt=\"xDebug in the dashboard\" height=\"200\" class=\"wp-image-1012\" srcset=\"https:\/\/blog.silverterra.net\/wp-content\/uploads\/2017\/12\/xDebug-in-the-dashboard.jpg 864w, https:\/\/blog.silverterra.net\/wp-content\/uploads\/2017\/12\/xDebug-in-the-dashboard-300x116.jpg 300w\" sizes=\"(max-width: 864px) 100vw, 864px\" \/><\/p>\n<p><b>B. Chrome Xdebug helper extension<\/b><\/p>\n<p>To prepare the chrome you need the <a href=\"https:\/\/chrome.google.com\/webstore\/detail\/xdebug-helper\/eadndfjplgieldjbigjakmdgkmoaaaoc\">Xdebug helper<\/a> extension<\/p>\n<p style=\"text-align:center;\"><img decoding=\"async\" src=\"http:\/\/blog.silverterra.net\/wp-content\/uploads\/2017\/12\/xDebug-helper-extension.jpg\" alt=\"xDebug helper extension\" height=\"200\" class=\"wp-image-1021\" srcset=\"https:\/\/blog.silverterra.net\/wp-content\/uploads\/2017\/12\/xDebug-helper-extension.jpg 998w, https:\/\/blog.silverterra.net\/wp-content\/uploads\/2017\/12\/xDebug-helper-extension-300x111.jpg 300w\" sizes=\"(max-width: 998px) 100vw, 998px\" \/><\/p>\n<p>After the install, start the debug. You have to see a green bug <img decoding=\"async\" src=\"http:\/\/blog.silverterra.net\/wp-content\/uploads\/2017\/12\/chrome-xdebug.jpg\" style=\"display:inline\" alt=\"chrome xdebug\" height=\"73\" class=\"alignnone size-full wp-image-1041\" srcset=\"https:\/\/blog.silverterra.net\/wp-content\/uploads\/2017\/12\/chrome-xdebug.jpg 153w, https:\/\/blog.silverterra.net\/wp-content\/uploads\/2017\/12\/chrome-xdebug-150x73.jpg 150w\" sizes=\"(max-width: 153px) 100vw, 153px\" \/><\/p>\n<p><b>C. debugger application<\/b><\/p>\n<p>You have million of options to interact with the xdebug core. The following is a simple just debugger (not editor) option<br \/>\n<a href=\"https:\/\/code.google.com\/archive\/p\/xdebugclient\/\">XDebugClient<\/a><br \/>\nFrankly a little bit buggy but useful.<\/p>\n<p style=\"text-align:center;\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/blog.silverterra.net\/wp-content\/uploads\/2017\/12\/xdc-start-listening.jpg\" alt=\"xdc - start listening\" width=\"367\" height=\"267\" class=\"wp-image-1027\" srcset=\"https:\/\/blog.silverterra.net\/wp-content\/uploads\/2017\/12\/xdc-start-listening.jpg 367w, https:\/\/blog.silverterra.net\/wp-content\/uploads\/2017\/12\/xdc-start-listening-300x218.jpg 300w\" sizes=\"auto, (max-width: 367px) 100vw, 367px\" \/><\/p>\n<p style=\"text-align:center;\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/blog.silverterra.net\/wp-content\/uploads\/2017\/12\/xdc-listening-300x236.jpg\" alt=\"xdc - listening\" width=\"300\" height=\"236\" class=\"wp-image-1026\" srcset=\"https:\/\/blog.silverterra.net\/wp-content\/uploads\/2017\/12\/xdc-listening-300x236.jpg 300w, https:\/\/blog.silverterra.net\/wp-content\/uploads\/2017\/12\/xdc-listening.jpg 341w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/p>\n<p><b>D. eat the result<\/b><\/p>\n<p>The Xdebug core is working, the chrome extension is on, the debugger application is listening&#8230; click on the link<br \/>\n<a href=\"http:\/\/localhost\/dashboard\/phpinfo.php\">http:\/\/localhost\/dashboard\/phpinfo.php<\/a><\/p>\n<p>If everything is fine you will see the browser will wait and the XDebugClient will start the debugging as you can see:<\/p>\n<p style=\"text-align:center;\"><img decoding=\"async\" src=\"http:\/\/blog.silverterra.net\/wp-content\/uploads\/2017\/12\/xdc-catch.jpg\" alt=\"xdc - catch\"  height=\"280\" class=\"wp-image-1034\" srcset=\"https:\/\/blog.silverterra.net\/wp-content\/uploads\/2017\/12\/xdc-catch.jpg 457w, https:\/\/blog.silverterra.net\/wp-content\/uploads\/2017\/12\/xdc-catch-300x237.jpg 300w\" sizes=\"(max-width: 457px) 100vw, 457px\" \/><\/p>\n<p>You can use the F5, F10, F11 to control the debugger, but first step in to the process&#8230; click on the margin and <b>add a breakpoint<\/b> to the code like:<\/p>\n<p style=\"text-align:center;\"><img decoding=\"async\" src=\"http:\/\/blog.silverterra.net\/wp-content\/uploads\/2017\/12\/xdc-breakpoint.jpg\" alt=\"xdc - breakpoint\" height=\"326\" class=\"wp-image-1035\" srcset=\"https:\/\/blog.silverterra.net\/wp-content\/uploads\/2017\/12\/xdc-breakpoint.jpg 288w, https:\/\/blog.silverterra.net\/wp-content\/uploads\/2017\/12\/xdc-breakpoint-265x300.jpg 265w\" sizes=\"(max-width: 288px) 100vw, 288px\" \/><\/p>\n<p>and step into the debugger &#8211; <b>press F5<\/b><\/p>\n<p style=\"text-align:center;\"><img decoding=\"async\" src=\"http:\/\/blog.silverterra.net\/wp-content\/uploads\/2017\/12\/xdc-stepin.jpg\" alt=\"xdc - stepin\" height=\"328\" class=\"wp-image-1036\" srcset=\"https:\/\/blog.silverterra.net\/wp-content\/uploads\/2017\/12\/xdc-stepin.jpg 335w, https:\/\/blog.silverterra.net\/wp-content\/uploads\/2017\/12\/xdc-stepin-300x293.jpg 300w\" sizes=\"(max-width: 335px) 100vw, 335px\" \/><\/p>\n<p>&#8230; you can debug the code now&#8230;<\/p>\n<p>simple, useful, enjoy<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Goal: not a question, how we can know what is under the hood The PHP debugging is not a trivial case. Could be with the xDebug extension. Follow these steps: A. Xdebug core environment notice: according to the internet you need to disable the output buffering output_buffering = Off for me working with the following [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10,19],"tags":[],"class_list":["post-1011","post","type-post","status-publish","format-standard","hentry","category-php","category-xampp"],"_links":{"self":[{"href":"https:\/\/blog.silverterra.net\/index.php?rest_route=\/wp\/v2\/posts\/1011","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.silverterra.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.silverterra.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.silverterra.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.silverterra.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1011"}],"version-history":[{"count":23,"href":"https:\/\/blog.silverterra.net\/index.php?rest_route=\/wp\/v2\/posts\/1011\/revisions"}],"predecessor-version":[{"id":1042,"href":"https:\/\/blog.silverterra.net\/index.php?rest_route=\/wp\/v2\/posts\/1011\/revisions\/1042"}],"wp:attachment":[{"href":"https:\/\/blog.silverterra.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1011"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.silverterra.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1011"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.silverterra.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1011"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}