如何在Ubuntu的localhost上使用PhpStorm安装Xdebug?

时间:2018-10-17 20:26:40

标签: php xampp phpstorm xdebug

如何在Ubuntu的localhost上使用PhpStorm安装Xdebug?
我正在使用PHP 7.2和PhpStorm 2018.2。

我尝试了install apt-get install xdebug,然后编辑了php.ini

[Xdebug]  
zend_extension=/usr/lib/php/20170718/xdebug.so  
xdebug.remote_autostart = 1  
xdebug.remote_enable = 1  
xdebug.remote_enable = 1  
xdebug.remote_port = 9001  
xdebug.profiler_enable = On  
xdebug.remote_handler=dbgp  
xdebug.remote_host=localhost  
xdebug.remote_mode=req  
xdebug.idekey=PHPSTORM  

然后当我转到php.info时,我看到“ IDE Key”(数字键)不是PhpStorm,而当我尝试放置断点时,它将忽略它们。

1 个答案:

答案 0 :(得分:0)

我也为此奋斗了很多。让我们看看这是否对您有帮助。我使用Windows,但是原理应该相同。

1)确保,PHP Storm使用了您编辑的php.ini。可以不同。

enter image description here

我的php.ini xdebug设置:

[xdebug]
zend_extension="E:\Apache24\php\7.2.9\php_xdebug-2.7.0beta1-7.2-vc15-x86_64.dll"
xdebug.remote_autostart=0
xdebug.remote_enable = 1
xdebug.profiler_enable = 1
xdebug.profiler_enable_trigger = 0
xdebug.profiler_output_name = cachegrind.out.%t.%p
xdebug.profiler_output_dir ="E:\Apache24\php\7.2.9\tmp"
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.remote_handler="dbgp"
xdebug.show_local_vars=0
xdebug.profiler_append = 0
xdebug.idekey=xdebug
xdebug.remote_mode=req

2)如果看到此消息,则说明扩展程序安装不正确:

enter image description here

3)检查xdebug扩展的版本是否与您的php版本相对应。

4)按下“调试”按钮,而不是“运行”

5)与断点配合良好:

enter image description here

相关问题