简体   繁体   中英

How to install PHP Xdebug in Eclipse on Windows?

I have a PHP file and I want to debug that file in Eclipse. I have heard about Xdebug as the best way to debug a PHP file in Eclipse.

What are the steps needed to be able to debug PHP files in Eclipse? I am using Windows OS.

  1. Download PHP for eclipse (PLUGIN eclipse)

Use update URL https://download.eclipse.org/tools/pdt/updates/7.0 这里是eclipse中需要的PHP PDT插件

  1. Download XAMPP for windows and install it https://www.apachefriends.org/es/download.html

Now you can follow alternative instructions here or continue to the next point where i explain what you need to do. http://robsnotebook.com/php_debugger_pdt_xdebug

After installing XAMPP you should start Apache XAMPP 控制界面

Download Xdebug eg http://xdebug.org/files/php_xdebug-2.9.2-7.2-vc15-x86_64.dll and check if it is correctly installed. Follow next instructions

1. Download php_xdebug-2.9.2-7.2-vc15-x86_64.dll. 
2. Move the downloaded file to C:\xampp\php\ext
3. Update C:\xampp\php\php.ini and change the lines

    [XDebug]
    ;; Only Zend OR (!) XDebug
    ; zend_extension_ts="C:\xampp\php\ext\php_xdebug.dll"
    ; Modify the filename below to reflect the .dll version of your xdebug
    zend_extension = C:\xampp\php\ext\php_xdebug-2.9.2-7.2-vc15-x86_64.dll
    xdebug.remote_enable=true
    xdebug.remote_host=127.0.0.1  ; if debugging on remote server,
                              ; put client IP here
    xdebug.remote_port=9000
    xdebug.remote_handler=dbgp
    xdebug.profiler_enable=0
    xdebug.profiler_output_dir="C:\xampp\tmp"

4. Restart the XAMPP webserver in your XAMPP control Panel

Comment out any Zend Optimizer in php.ini because it is not compatible with XDebug. For example, all of this should be commented out (using “;”): [Zend]

; zend_extension_ts = "C:\xampp\php\zendOptimizer\lib\ZendExtensionManager.dll"
; zend_extension_manager.optimizer_ts = "C:\xampp\php\zendOptimizer\lib\Optimizer"
; zend_optimizer.enable_loader = 0
; zend_optimizer.optimization_level=15
;zend_optimizer.license_path =

Check that it is working with phpinfo. You go to your browser and go to: http://localhost/dashboard/phpinfo.php Or create in your c:/xampp/htdocs A file calling phpinfo eg http://localhost/phpinfocall.php

XDEBUG 部分的 PHPINFO 结果 在哪里编辑您的 php 代码

Configuration PHP debug in eclipse You can create a PHP project. That project should be pointint to C:\\xampp\\htdocs

The C:\\xampp\\htdocs is the localserver root folder in xampp. Inside you can create subfolders. 本地主机的根文件夹,此处或子文件夹上放置您的项目

Configure PHP Preference of eclipse Connect eclipse with php parser of xampp

用php解析器xampp连接eclipse

Configure this and check that xdebug is detected in eclipse from xampp 检查xdebug连接

How to create a debug view from a PHP file in your project如何从项目中的 PHP 文件创建调试视图

Debug view configuration below, 调试视图配置_1 调试视图配置_2

Lastly, you will see in the debug perspective, that the debugger stop automatically on the first line of your php file.

调试视图第一行断点

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM