Reputation: 595
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.
Upvotes: 1
Views: 2635
Reputation: 595
Use update URL https://download.eclipse.org/tools/pdt/updates/7.0
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
Download Xdebug e.g 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 e.g. http://localhost/phpinfocall.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
Configure this and check that xdebug is detected in eclipse from xampp
How to create a debug view from a PHP file in your project
Debug view configuration below,
Lastly, you will see in the debug perspective, that the debugger stop automatically on the first line of your php file.
Upvotes: 3