æ¬çªãµã¼ãçãé¢ããç°å¢ã«ãã PHP ããªã¢ã¼ããããã°ããå ´åã éçºç¨ã® PC ã¯ç¤¾å LAN ã®ä¸ã«ãããå¤ããã¯ç´æ¥ã¢ã¯ã»ã¹ã§ããªãã¨ãã¾ãã ãã®å ´åãSSH ã§éåãã®ãã³ãã«ãä½ããæ¬çªãµã¼ãâãã¼ã«ã«PC ã¨éä¿¡ããã¾ãã æ¬çªã®PHPã®xdebugã®è¨å®ãã¡ã¤ã« ä¾: /etc/php/5.6/apache2/conf.d/20-xdebug.ini [xdebug] zend_extension=xdebug.so xdebug.remote_enable=1 xdebug.remote_port="9000" xdebug.profiler_enable=0 xdebug.profiler_output_dir="/tmp" xdebug.max_nesting_level=1000 xdebug.idekey = "PHPSTORM" phpinfo() ããæã
ä»åã¯ãCode Serverã§PHPã®ãããã°ãè¡ãããã¨æãã¾ããå½ç¶ãªããããããã°ã«ã¯PHPãå¿ è¦ãªã®ã§Raspberry Pi 4ã«æ§ç¯ãã¦ããã¾ãã ï¼â»Raspberry Pi 4æ§ç¯æã®ã¡ã¢ãç´å¤±ããã®ã§ãä»åã¯VMã§æ§ç¯ãã¦ãã¾ãããè¨å®å 容çã¯åãã§ããï¼ Code Serverãã¤ã³ã¹ãã¼ã«ãã¦ãªãå ´åã¯ãä¸è¨ã®è¨äºãåèã«ã¤ã³ã¹ãã¼ã«ãã¦ãã ããã
ã¯ããã« CodeServer 㯠VSCode ããµã¼ãã¼ä¸ã§åãããã«ç§»æ¤ãããã®ã§ãã ãã®è¨äºã¯å°ãªãã¨ãä¸è¨ã®æ§ç¯ãå®äºãã¦ããã¨ããããã¹ã¿ã¼ããã¦ãã¾ãã Xdebug ãã¤ã³ã¹ãã¼ã« ã¾ãå¿ è¦ãªãã®ãæãã¾ãã [root@vm opc]# /usr/local/lsws/lsphp80/bin/pecl install xdebug ï½ï¼ä¸ç¥ï¼ï½ +----------------------------------------------------------------------+ | | | INSTALLATION INSTRUCTIONS | | ========================= | | | | See https://xdebug.org/install.php#configure-php for instructions | | on
ã¿ãªããããã«ã¡ã¯ã æè¿WSL2ã¨Docker Engineã®çµã¿åããã§ã³ã³ããå ã«ããPHPã¢ããªã®ãªã¢ã¼ããããã°ãã§ããªãåé¡ã«çªãå½ããã¾ããã ä»åã®è¨äºã§ã¯ãã®åé¡ã解決ãã¦ãxdebugã§åã³å¿«é©ãªPHPéçºãã§ããããã«ããæ¹æ³ã解説ãã¾ãã åææ¡ä»¶ ãã®è¨äºã¯ä»¥ä¸ã®åææ¡ä»¶ã§æ¤è¨¼ããã¾ããã Windows 10 WSL2 Ubuntu 20.04 Docker Engine 20.10.8 PHP 7.3.3 xdebug 3.1.0 Visual Studio Code 1.60.1 Remote - WSLæ¡å¼µæ©è½ã使ã£ãéçº 1. xdebugã®ãµã¼ãã¼å´è¨å®ãä¿®æ£ php.iniã«ããxdebugã®è¨å®é ç®xdebug.client_hostãhost.docker.internalã«ãªã£ã¦ãããã¨ã確èªãã¾ãããã æ¢ã«è¨å®æ¸ã¿ã®å ´åã¯ãã®æé ãé£ã°ãã¦
Xdebug's step debugger allows you to interactively walk through your code to debug control flow and examine data structures. Introduction # Xdebug interacts with IDEs to provide step debugging functionality, and therefore you also need to configure an IDE that knows how to talk to Xdebug with the open DBGp protocol. This protocol is supported by nearly every PHP IDE (including Visual Studio Code a
PHP ã®ãããã°ãã¼ã«ã§ãã Xdebug ã«ã¯ãªã¢ã¼ããããã°ã¨ããæ©è½ãããã¾ãã â¦ã¨ããã®ã¯è¨ãã¾ã§ããªããåºãç¥ããã¦ããã¨æãã¾ãã ããããXdebug ã®è¨å®ããªãã¨ãªãã³ããã§æ¸ã¾ããããã¦ããªãã§ããããï¼ Xdebug ã®ãªã¢ã¼ããããã°è¨å®ãç解ãã¦ãã¾ããï¼ æ¥æ¬èªã®ãµã¤ããæ¤ç´¢ããã¨ã xdebug.remote_enable=1 ã«ãã¦ãxdebug.remote_host ã xxx ã«ãã¦â¦ãã¨è¨å®ã ããæ·¡ã ã¨æ¸ãããæ å ±ãå¤ãã§ãã ããããè¨å®é ç®ã«ã¤ãã¦ãããããã®æå³ãç解ãã¦ããªãã¨ãã©ãã«æã®å¯¾å¦ãé£ãããªãã¾ãã ãªã¢ã¼ããããã°ã¨ã¯ä½ãï¼ ãªã¢ã¼ããããã° (Remote Debugging) ã¨ã¯ãå®è¡ä¸ã® PHP ã¨ã¯å¥ã®å ´æã«ãããã°ãå¶å¾¡ãããã®ãåå¨ãã æ¹å¼ã§ãã ããããç°å¢ã ã¨ã次ã®ããã«å³ç¤ºã§ãã¾ãã PHP æ¬ä½ã¨ã¯å¥
ï¼2016/03/04 追è¨ï¼ Xdebug 2.4.0ãæ£å¼çã«ãªãã¾ãããåä½ç¢ºèªæ¸ã§ãã PHP7ã«æ«å®å¯¾å¿ãã¦ããXdebug2.4.0RC4ã§ãªã¢ã¼ããããã°ããã£ã¦ã¿ã¾ãããåºæ¥ãªãã¨ããåãèãã¦ããã®ã§ãããåé¡ãªãå®è¡ã§ããã®ã§ãã¡ã¢ãã¦ãæé ãæ¸ãã¦ããããã¨æãã¾ãã æ¤è¨¼ç°å¢ ä»åã¯Dockerï¼OSXã«ã¤ã³ã¹ãã¼ã«ããdocker-machineã«ã¦Dockerãã¹ããä½æï¼ä¸ã®PHPã§å®è¡ãã¦ãã¾ãããæé ããåãéããªããã°Vagrantã§ãåé¡ãªãå®è¡ã§ãããã¨æãã¾ãã OSX El Capitanï¼ãã¹ããã·ã³ï¼ docker-machine 0.6.0 (Docker 1.9.1) CentOS 7.2ï¼ã³ã³ããOSï¼ Apache 2.4.6 PHP 7.0.3 Xdebug 2.4.0RC4 Lumen 5.2 PHPStorm 10.0.3 Xd
æ¦è¦ ååãDockerï¼nginx + PHP-FPMï¼ã使ã£ã¦PHPã®å®è¡ç°å¢ãæ§ç¯ãã¾ããã åºæ¬æ§æãè¦ããã°ãããªã®ã§ã³ã¼ãæ¯ã«åä½ã追ãããã¨æã£ã次第ã§ãã Dockerï¼nginx + PHP-FPM + Xdebugï¼+ VisualStudio Codeã§ãããã°ãè¡ããç°å¢ãæ§ç¯ãã¾ãã ååä½æããDockerï¼nginx + PHP-FPMï¼ã®PHPå®è¡ç°å¢ã«Xdebugã追å ããå½¢ã§æ§ç¯ãã¾ãã ååã®ç°å¢æ§ç¯è¨äºã¯ä»¥ä¸ã§ãã kitigai.hatenablog.com ç®æ¬¡ æ¦è¦ ç®æ¬¡ åèãµã¤ãæ§ ç°å¢ ãããã°ç°å¢ã®æ§ç¯ ææç© ãã£ã¬ã¯ããªæ§æ nginxã®configãã¡ã¤ã«ä½æ Dockerfileã®ä½æ peclã£ã¦ï¼ docker-compose.ymlã®ä½æ xdebug.iniã®ä½æ host.docker.internalã£ã¦ Visua
Visual Studio Code - Remote Development ã使ç¨ã㦠PHP Xdebug ã使ã£ããããã°ãè¡ãPHPxdebugDockerVSCodeRemoteDevelopment è¦ç´ VS Code ã® Remote Development 㧠Xdebug ããæã¯ãremote_host ã®åãå ã ãã¼ã«ã«ãã¹ãã«ããã Remote Development ã®æ¥ç¶å ã® VS Code ã« PHP Debug ãå°å ¥ããã .vscode/launch.json 㧠Xdebug ããã®æ å ±ã Listen ããã ã¯ããã« VS Code ã® æ¡å¼µæ©è½ ã Remote Development ãã¯ãããã¾ã§ãã©ãããæãã¦ãããã¼ã«ã«éçºç°å¢ã®æ§æãæ¹åãã¦ããããã§è²ã ã¨è©¦ãã¦ãã¾ãã ååã®è¨äº ã§ã¯ãVagrant ã§æ§ç¯ããä»®æ³ç°å¢ã®ä¸
Laravelã§ã¯PHPUnitãçµã¿è¾¼ã¿ã§å ¥ã£ã¦ãã¾ããããã¹ãã³ã¼ãã®ã«ãã¬ãã¸ãå¯è¦åããæ©è½ã¯å¥ã§è¨å®ããå¿ è¦ãããã¾ãã ã«ãã¬ãã¸(ç¶²ç¾ ç)ã¨ã¯ããã¹ãã³ã¼ããã¢ããªã±ã¼ã·ã§ã³ã®ãã¸ãã¯ãã©ã®ç¨åº¦ã«ãã¼ã§ãã¦ãããã®å²åã®ãã¨ã§ãã RPGã²ã¼ã ã®ãã³ã¸ã§ã³ã®è¸ç ´çã¨ããã¤ã¡ã¼ã¸ã¨ãã¦ã¯è¿ãããã§ãã ãã¹ãã³ã¼ããæ´åã»ç®¡çããã«ããã£ã¦ã«ãã¬ãã¸æ¸¬å®ãã§ããã°ã ããã¹ãã³ã¼ãã®éã¯å¤ããã©ãåããã¸ãã¯ã®ãã¹ãã°ããã§æå¤ã¨ã«ãã¬ãã¸ä½ãã£ãã ããã®æ©è½ã®ãã¹ãã³ã¼ããæ´åãã¦ã«ãã¬ãã¸ãä¸ãããã ãããã¯æ¢ã«ååãªã«ãã¬ãã¸ããããããããã¾ã§æ³¨åããªãã¦ãããã ã¿ãããªãã¨ãã§ãã¾ãã PHPUnitãXdebugãå°å ¥ãããã¨ã§ã«ãã¬ãã¸æ¸¬å®ãã§ããããã«ãªãã®ã§ãæé ã解説ãã¦ããã¾ã! ãã£ããæé â X-Debugã®å°å ¥ â¡ã©ã¤ãã©ãª(php-code-
Dockerã³ã³ããã®ä¸ã§åãPHPããã°ã©ã ã«ãXDebugã使ã£ããªã¢ã¼ããããã°ãè¡ã ã¨ããä¾ã¯å²ã¨ããè¦ããã¾ãããããã§ãå²ã¨ããã£ãã®ã§ããã£ãã¨ãããã¡ã¢ã æ§æ Windows 10 Home(1809 Ver éInsider Preview) Virtual Box(Docker Toolbox) PHP 5.5.9 XDebug 2.2.3 Visual Studio Code 1.32.3 æ°ãã¤ããã¹ãã¨ãã XDebugã§ã®ãããã°ã«ããã¦æ°ãã¤ããã¹ãã¨ãã(è¦ãã¦ããã¹ãã¨ãã) XDebugã§ãããã°ãããã¨ããVisual Studio Codeã¯ãµã¼ãå´ãPHPã¤ã³ã¿ããªã¿ã¯ã¯ã©ã¤ã¢ã³ãå´ã«ãªã(PHPã¤ã³ã¿ããªã¿ããVisual Studio Codeã«ã¢ã¯ã»ã¹ãã) ãªã®ã§ãDockerã³ã³ããã®EXPOSEãªã©ã¯ä¸è¦ãããããããããã¨ããã£ã¦
ãªãªã¼ã¹ãé害æ å ±ãªã©ã®ãµã¼ãã¹ã®ãç¥ãã
ææ°ã®äººæ°ã¨ã³ããªã¼ã®é ä¿¡
å¦çãå®è¡ä¸ã§ã
j次ã®ããã¯ãã¼ã¯
kåã®ããã¯ãã¼ã¯
lãã¨ã§èªã
eã³ã¡ã³ãä¸è¦§ãéã
oãã¼ã¸ãéã
{{#tags}}- {{label}}
{{/tags}}