{"id":2817,"date":"2022-08-13T13:09:15","date_gmt":"2022-08-13T11:09:15","guid":{"rendered":"https:\/\/ekiwi.de\/?p=2817"},"modified":"2022-08-13T13:13:39","modified_gmt":"2022-08-13T11:13:39","slug":"php-debugging-in-linux-einrichten-mit-visual-studio-code","status":"publish","type":"post","link":"https:\/\/ekiwi.de\/index.php\/2817\/php-debugging-in-linux-einrichten-mit-visual-studio-code\/","title":{"rendered":"PHP Debugging in Linux einrichten, mit Visual Studio Code"},"content":{"rendered":"<p>Bestehende Lamp-Installation von Linux mit XDebug erweitern.<\/p>\n<p><!--more--><\/p>\n<p>Auf meinem Linux System wollte ich die Apache + PHP-Installation um Debugging Funktionen erweitern. Die <a href=\"https:\/\/ekiwi.de\/index.php\/198\/php-debugging-in-xampp-und-uestudio-einrichten\/\">Vorgehensweise f\u00fcr Windows<\/a> gibt es hier.<\/p>\n<p>In Linux ist es prinzipiell sogar einfacher. Hier muss je nach System nur die passende <a href=\"https:\/\/xdebug.org\/docs\/install\">XDebug-Version \u00fcber die Paketverwaltung installiert<\/a> werden.<\/p>\n<p>In meinem Fall, openSuse, war dies:<\/p>\n<pre>\r\nsudo zypper in php7-xdebug\r\nsudo zypper in php8-xdebug\r\n<\/pre>\n<p>Den jeweiligen Befehl einfach der Seite entnehmen. Leider war es damit erstmal nicht getan. Beim ersten Versuch zu debuggen kam nur folgende Fehlermeldung:<\/p>\n<pre>\r\nError: spawn \/usr\/share\/php EACCES at Process.ChildProcess._handle.onexit (node:internal\/child_process:282:19) at onErrorNT (node:internal\/child_process:477:16) at processTicksAndRejections (node:internal\/process\/task_queues:83:21) { errno: -13, code: 'EACCES', syscall: 'spawn \/usr\/share\/php', path: '\/usr\/share\/php', spawnargs: [ '-dxdebug.start_with_request=yes', '\/srv\/www\/htdocs\/test_project\/index.php' ] } \r\n<\/pre>\n<p>Zwar war PHP installiert, aber das Command Line Interface Paket hat gefehlt. Dieses lie\u00df sich aber recht schnell nachinstallieren:<\/p>\n<pre>\r\nsudo zypper install php8-cli \r\n<\/pre>\n<p>Anschlie\u00dfend musste <a href=\"https:\/\/ekiwi.de\/index.php\/4776\/visual-studio-found-conflicts-between-different-versions-of-assembly\/\" title=\"Visual Studio: Found conflicts between different versions of assembly\">Visual Studio<\/a> Code noch den Suchpfad zu PHP genannt bekommen. Dies ist allerdings recht einfach. In der &#8222;settings.json&#8220; wird folgender Eintrag erg\u00e4nzt. Fehlt dieser komplett, bem\u00e4ngelt dies Visual Studio Code ohnehin.<\/p>\n<pre>\r\n\"php.debug.executablePath\": \"php\", \r\n<\/pre>\n<p>Leider hat es nun noch immer nicht geklappt. Xdebug war zwar aktiv, aber an Breakpoints wurde nicht angehalten. Hier fehlten noch ein paar Eintr\u00e4ge in der &#8222;php.ini&#8220; Datei.<\/p>\n<pre>\r\nxdebug.mode=debug\r\nxdebug.client_host=127.0.0.1\r\nxdebug.client_port=9000\r\n<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"\/wp-content\/uploads\/2022\/08\/debug_php.png\" alt=\"\" width=\"576\" height=\"224\" class=\"alignnone size-full wp-image-2818\" srcset=\"\/wp-content\/uploads\/2022\/08\/debug_php.png 576w, \/wp-content\/uploads\/2022\/08\/debug_php-300x117.png 300w\" sizes=\"auto, (max-width: 576px) 100vw, 576px\" \/><\/p>\n\n<div class=\"aawp\">\n\n            \n            \n<div class=\"aawp-product aawp-product--horizontal aawp-product--bestseller aawp-product--ribbon\"  data-aawp-product-asin=\"3367100005\" data-aawp-product-id=\"5279\" data-aawp-tracking-id=\"ekiwide0b-21\" data-aawp-product-title=\"PHP 8 und MySQL  Das umfassende Handbuch zu PHP 8 Dynamische Webseiten von den Grundlagen bis zur fortgeschrittenen PHP-Programmierung\">\n\n    <span class=\"aawp-product__ribbon aawp-product__ribbon--bestseller\">Bestseller Nr. 1<\/span>\n    <div class=\"aawp-product__thumb\">\n        <a class=\"aawp-product__image-link\"\n           href=\"https:\/\/www.amazon.de\/dp\/3367100005?tag=ekiwide0b-21&linkCode=ogi&th=1&psc=1&keywords=php%20buch\" title=\"PHP 8 und MySQL: Das umfassende Handbuch zu PHP 8. Dynamische Webseiten, von den Grundlagen bis zur fortgeschrittenen PHP-Programmierung\" rel=\"nofollow noopener sponsored\" target=\"_blank\">\n            <img decoding=\"async\" class=\"aawp-product__image\" src=\"https:\/\/m.media-amazon.com\/images\/I\/51mKT2vT0rL._SL160_.jpg\" alt=\"PHP 8 und MySQL: Das umfassende Handbuch zu PHP 8. Dynamische Webseiten, von den Grundlagen bis zur fortgeschrittenen PHP-Programmierung\"  \/>\n        <\/a>\n\n            <\/div>\n\n    <div class=\"aawp-product__content\">\n        <a class=\"aawp-product__title\" href=\"https:\/\/www.amazon.de\/dp\/3367100005?tag=ekiwide0b-21&linkCode=ogi&th=1&psc=1&keywords=php%20buch\" title=\"PHP 8 und MySQL: Das umfassende Handbuch zu PHP 8. Dynamische Webseiten, von den Grundlagen bis zur fortgeschrittenen PHP-Programmierung\" rel=\"nofollow noopener sponsored\" target=\"_blank\">\n            PHP 8 und MySQL: Das umfassende Handbuch zu PHP 8. Dynamische Webseiten, von den Grundlagen bis zur fortgeschrittenen PHP-Programmierung        <\/a>\n        <div class=\"aawp-product__description\">\n            <ul><li>Wenz, Christian(Autor)<\/li><\/ul>        <\/div>\n    <\/div>\n\n    <div class=\"aawp-product__footer\">\n\n        <div class=\"aawp-product__pricing\">\n            \n                            <span class=\"aawp-product__price aawp-product__price--current\"><\/span>\n            \n                    <\/div>\n\n                <a class=\"aawp-button aawp-button--buy aawp-button--icon aawp-button--icon-black\" href=\"https:\/\/www.amazon.de\/dp\/3367100005?tag=ekiwide0b-21&#038;linkCode=ogi&#038;th=1&#038;psc=1&#038;keywords=php%20buch\" title=\"Bei Amazon kaufen\" target=\"_blank\" rel=\"nofollow noopener sponsored\">Bei Amazon kaufen<\/a>\n            <\/div>\n\n<\/div>\n\n            \n            \n<div class=\"aawp-product aawp-product--horizontal aawp-product--bestseller aawp-product--ribbon\"  data-aawp-product-asin=\"3836292742\" data-aawp-product-id=\"5283\" data-aawp-tracking-id=\"ekiwide0b-21\" data-aawp-product-title=\"Einstieg in PHP 8 und MySQL  Ideal f\u00fcr Programmieranf\u00e4nger ohne Vorwissen Schnell und einfach dynamische Webseiten entwickeln Inkl MariaDB\">\n\n    <span class=\"aawp-product__ribbon aawp-product__ribbon--bestseller\">Bestseller Nr. 2<\/span>\n    <div class=\"aawp-product__thumb\">\n        <a class=\"aawp-product__image-link\"\n           href=\"https:\/\/www.amazon.de\/dp\/3836292742?tag=ekiwide0b-21&linkCode=ogi&th=1&psc=1&keywords=php%20buch\" title=\"Einstieg in PHP 8 und MySQL: Ideal f\u00fcr Programmieranf\u00e4nger ohne Vorwissen. Schnell und einfach dynamische Webseiten entwickeln. Inkl. MariaDB\" rel=\"nofollow noopener sponsored\" target=\"_blank\">\n            <img decoding=\"async\" class=\"aawp-product__image\" src=\"https:\/\/m.media-amazon.com\/images\/I\/51srBJ6k-9L._SL160_.jpg\" alt=\"Einstieg in PHP 8 und MySQL: Ideal f\u00fcr Programmieranf\u00e4nger ohne Vorwissen. Schnell und einfach dynamische Webseiten entwickeln. Inkl. MariaDB\"  \/>\n        <\/a>\n\n            <\/div>\n\n    <div class=\"aawp-product__content\">\n        <a class=\"aawp-product__title\" href=\"https:\/\/www.amazon.de\/dp\/3836292742?tag=ekiwide0b-21&linkCode=ogi&th=1&psc=1&keywords=php%20buch\" title=\"Einstieg in PHP 8 und MySQL: Ideal f\u00fcr Programmieranf\u00e4nger ohne Vorwissen. Schnell und einfach dynamische Webseiten entwickeln. Inkl. MariaDB\" rel=\"nofollow noopener sponsored\" target=\"_blank\">\n            Einstieg in PHP 8 und MySQL: Ideal f\u00fcr Programmieranf\u00e4nger ohne Vorwissen. Schnell und einfach dynamische Webseiten entwickeln. Inkl. MariaDB        <\/a>\n        <div class=\"aawp-product__description\">\n            <ul><li>Theis, Thomas(Autor)<\/li><\/ul>        <\/div>\n    <\/div>\n\n    <div class=\"aawp-product__footer\">\n\n        <div class=\"aawp-product__pricing\">\n            \n                            <span class=\"aawp-product__price aawp-product__price--current\"><\/span>\n            \n                    <\/div>\n\n                <a class=\"aawp-button aawp-button--buy aawp-button--icon aawp-button--icon-black\" href=\"https:\/\/www.amazon.de\/dp\/3836292742?tag=ekiwide0b-21&#038;linkCode=ogi&#038;th=1&#038;psc=1&#038;keywords=php%20buch\" title=\"Bei Amazon kaufen\" target=\"_blank\" rel=\"nofollow noopener sponsored\">Bei Amazon kaufen<\/a>\n            <\/div>\n\n<\/div>\n\n    \n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Bestehende Lamp-Installation von Linux mit XDebug erweitern.<\/p>\n","protected":false},"author":1,"featured_media":2228,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":"","_links_to":"","_links_to_target":""},"categories":[14,12],"tags":[665,31,136,30],"class_list":["post-2817","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-php","category-server","tag-linux","tag-php","tag-programmieren","tag-server"],"_links":{"self":[{"href":"https:\/\/ekiwi.de\/index.php\/wp-json\/wp\/v2\/posts\/2817","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ekiwi.de\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ekiwi.de\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ekiwi.de\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ekiwi.de\/index.php\/wp-json\/wp\/v2\/comments?post=2817"}],"version-history":[{"count":0,"href":"https:\/\/ekiwi.de\/index.php\/wp-json\/wp\/v2\/posts\/2817\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ekiwi.de\/index.php\/wp-json\/wp\/v2\/media\/2228"}],"wp:attachment":[{"href":"https:\/\/ekiwi.de\/index.php\/wp-json\/wp\/v2\/media?parent=2817"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ekiwi.de\/index.php\/wp-json\/wp\/v2\/categories?post=2817"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ekiwi.de\/index.php\/wp-json\/wp\/v2\/tags?post=2817"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}