{"id":2142,"date":"2019-08-16T17:31:41","date_gmt":"2019-08-16T10:31:41","guid":{"rendered":"http:\/\/vietnam.briswell.com\/?p=2142"},"modified":"2020-05-05T15:10:28","modified_gmt":"2020-05-05T08:10:28","slug":"debug-cakephp-trong-vscode-voi-xdebug","status":"publish","type":"post","link":"https:\/\/www.briswell-vn.com\/en\/news\/debug-cakephp-trong-vscode-voi-xdebug\/","title":{"rendered":"Debug CakePHP in\u00a0VSCode\u00a0with\u00a0Xdebug"},"content":{"rendered":"<p><\/p>\n<ol>\n<li>\n<h3>Introduce\u00a0Xdebug<\/h3>\n<p>&#8211;\u00a0Xdebug\u00a0is an extension for\u00a0PHP\u00a0to assist with debugging and development. It contains a\u00a0single step debugger\u00a0to use with IDEs; it upgrades PHP&#8217;s\u00a0var_dump()\u00a0function; it adds\u00a0stack traces\u00a0for Notices, Warnings, Errors and Exceptions; it features functionality for\u00a0recording every function call and variable assignment\u00a0to disk; it contains a\u00a0profiler; and it provides\u00a0code coverage\u00a0functionality for use with\u00a0PHPUnit.<br \/>\n&#8211; Go to\u00a0Xdebug\u00a0page, choose and download\u00a0Xdebug\u00a0extension in this\u00a0<a href=\"https:\/\/xdebug.org\/download.php\">link<\/a>.<br \/>\n&#8211; Add this code to file\u00a0<strong>php.ini<\/strong>.<br \/>\n<code>[XDebug]<br \/>\nzend_extension = \"D:\\xampp\\php\\ext\\php_xdebug-2.4.1-5.4-vc9.dll\"<br \/>\nxdebug.remote_enable = 1<br \/>\nxdebug.remote_autostart = 1<br \/>\nxdebug.remote_host = localhost<\/code><br \/>\n[Cation]Fix &#8220;D:\\xampp\\php\\ext\\php_xdebug-2.4.1-5.4-vc9.dll&#8221; by your development environment.<br \/>\n&#8211; Restart XAMPP.<\/li>\n<li>\n<h3>Setting\u00a0debug\u00a0in\u00a0VScode<\/h3>\n<p>&#8211; Find and install\u00a0<a href=\"https:\/\/marketplace.visualstudio.com\/items?itemName=felixfbecker.php-debug\">PHP Debug<\/a>\u00a0extension.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-3580 size-full\" src=\"https:\/\/briswell-vn.com\/wp-content\/uploads\/2019\/08\/debug1.png\" alt=\"\" width=\"385\" height=\"655\" srcset=\"https:\/\/s3-ap-southeast-1.amazonaws.com\/homepage-media\/wp-content\/uploads\/2019\/08\/05150213\/debug1.png 385w, https:\/\/s3-ap-southeast-1.amazonaws.com\/homepage-media\/wp-content\/uploads\/2019\/08\/05150213\/debug1-176x300.png 176w\" sizes=\"auto, (max-width: 385px) 100vw, 385px\" \/><\/p>\n<p>&#8211; Go to debug\u00a0bar\u00a0and choose Add Configuration.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-3581 size-full\" src=\"https:\/\/briswell-vn.com\/wp-content\/uploads\/2019\/08\/debug2.png\" alt=\"\" width=\"378\" height=\"282\" srcset=\"https:\/\/s3-ap-southeast-1.amazonaws.com\/homepage-media\/wp-content\/uploads\/2019\/08\/05150233\/debug2.png 378w, https:\/\/s3-ap-southeast-1.amazonaws.com\/homepage-media\/wp-content\/uploads\/2019\/08\/05150233\/debug2-300x224.png 300w\" sizes=\"auto, (max-width: 378px) 100vw, 378px\" \/><\/p>\n<p>&#8211; In the popup window, choose PHP.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-3582 size-full\" src=\"https:\/\/briswell-vn.com\/wp-content\/uploads\/2019\/08\/debug3.png\" alt=\"\" width=\"604\" height=\"117\" srcset=\"https:\/\/s3-ap-southeast-1.amazonaws.com\/homepage-media\/wp-content\/uploads\/2019\/08\/05150248\/debug3.png 604w, https:\/\/s3-ap-southeast-1.amazonaws.com\/homepage-media\/wp-content\/uploads\/2019\/08\/05150248\/debug3-300x58.png 300w\" sizes=\"auto, (max-width: 604px) 100vw, 604px\" \/><\/p>\n<p>&#8211; Now, start debug in\u00a0VSCode, we can add checkpoint and view variable data.<img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-3583 size-full\" src=\"https:\/\/briswell-vn.com\/wp-content\/uploads\/2019\/08\/checkpoint.png\" alt=\"\" width=\"1806\" height=\"1000\" srcset=\"https:\/\/s3-ap-southeast-1.amazonaws.com\/homepage-media\/wp-content\/uploads\/2019\/08\/05150309\/checkpoint.png 1806w, https:\/\/s3-ap-southeast-1.amazonaws.com\/homepage-media\/wp-content\/uploads\/2019\/08\/05150309\/checkpoint-300x166.png 300w, https:\/\/s3-ap-southeast-1.amazonaws.com\/homepage-media\/wp-content\/uploads\/2019\/08\/05150309\/checkpoint-1024x567.png 1024w, https:\/\/s3-ap-southeast-1.amazonaws.com\/homepage-media\/wp-content\/uploads\/2019\/08\/05150309\/checkpoint-768x425.png 768w, https:\/\/s3-ap-southeast-1.amazonaws.com\/homepage-media\/wp-content\/uploads\/2019\/08\/05150309\/checkpoint-1536x850.png 1536w\" sizes=\"auto, (max-width: 1806px) 100vw, 1806px\" \/><\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>","protected":false},"excerpt":{"rendered":"<p>Introduce\u00a0Xdebug &#8211;\u00a0Xdebug\u00a0is an extension for\u00a0PHP\u00a0to assist with debugging and development. It contains a\u00a0single step debugger\u00a0to use with IDEs; it upgrades PHP&#8217;s\u00a0var_dump()\u00a0function; it adds\u00a0stack traces\u00a0for Notices, Warnings, Errors and Exceptions; it features functionality for\u00a0recording every function call and variable assignment\u00a0to disk; it contains a\u00a0profiler; and it provides\u00a0code coverage\u00a0functionality for use with\u00a0PHPUnit. &#8211; Go to\u00a0Xdebug\u00a0page, choose and download\u00a0Xdebug\u00a0extension in this\u00a0link. &#8211; Add this code to file\u00a0php.ini. [XDebug] [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":3579,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_mi_skip_tracking":false,"footnotes":""},"categories":[4,71],"tags":[],"class_list":["post-2142","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-news","category-it-tec"],"_links":{"self":[{"href":"https:\/\/www.briswell-vn.com\/en\/wp-json\/wp\/v2\/posts\/2142","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.briswell-vn.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.briswell-vn.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.briswell-vn.com\/en\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.briswell-vn.com\/en\/wp-json\/wp\/v2\/comments?post=2142"}],"version-history":[{"count":0,"href":"https:\/\/www.briswell-vn.com\/en\/wp-json\/wp\/v2\/posts\/2142\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.briswell-vn.com\/en\/wp-json\/wp\/v2\/media\/3579"}],"wp:attachment":[{"href":"https:\/\/www.briswell-vn.com\/en\/wp-json\/wp\/v2\/media?parent=2142"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.briswell-vn.com\/en\/wp-json\/wp\/v2\/categories?post=2142"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.briswell-vn.com\/en\/wp-json\/wp\/v2\/tags?post=2142"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}