要开启xdebug,需要在php.ini文件里面进行配置。
- 打开php.ini文件,可以通过phpinfo()函数查看php.ini的位置。
- 找到[xdebug]这个标签。
- 在[xdebug]标签下面添加以下配置:
- zend_extension = "xdebug.so" (如果是Windows系统,则是“xdebug.dll”)
- xdebug.remote_enable = 1
- xdebug.remote_autostart = 1
- xdebug.remote_port = 9000 (可以根据需要修改端口号)
- 保存php.ini文件。
- 重启Web服务器或者PHP-FPM进程池。
- 在浏览器中访问PHP应用程序,并在IDE中启用xdebug的远程调试功能。