Recent Changes - Search:

Home Page


Main

Downloads
Windows
macOS
Linux (via apt / rpm )
Linux wxWidgets
Release Notes

Wiki
Documentation
FAQ

Build CodeLite
Linux
Windows
macOS

Devs
Debug CodeLite Linux
Building Clang
Build wxWidgets (MSW)
Coding Guidelines
Create a Plugin

DebugWithXDebug

Configure workspace and debug sample file


Before you can debug, let's quickly create a workspace

The fastest way to create a workspace is:

  • Open a File Explorer
  • Navigate to your PHP sources folder
  • Drag the the top level of your sources folder and drop it on the Workspace View inside CodeLite (in the screenshot below this folder is set to C:\Users\Eran\Documents\TestPHP):
  • CodeLite will prompt you to choose the view, pick PHP
  • Now, configure PHP to enable XDebug debugging. From CodeLite menu bar, click on the PHP -> Run XDebug Setup Wizard. At the end of the wizard, copy the text and paste it inside your php.ini file.
  • Make sure that you also a line similar to this in your php.ini file: zend_extension=zend_extension=C:\php74\ext\php_xdebug.dll. So your php.ini should have section similar to this:
[xdebug]
zend_extension=C:\php74\ext\php_xdebug.dll
xdebug.remote_enable=1
xdebug.idekey="codeliteide"
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000
  • Next, change directory to the workspace folder (in my case it was: C:\Users\Eran\Documents\TestPHP and start PHP debug web server like this:
cd C:\Users\Eran\Documents\TestPHP
C:\php74\php.exe -S 127.0.0.1:80 -t .
  • Create a test file named test.php under the workspace folder C:\Users\Eran\Documents\TestPHP with this sample code:
<?php

$test123 = "hello world";

$arr = [];
$arr[] = "Hello";
$arr[] = "World";


function baz($i) {
    echo $i."<br>";
}

function foo($i) {
    baz($i);
}

for($i = 0; $i < 10; $i++){
    foo($i);
}
  • Place a breakpoint at the for loop (keyboard shortcut F9)
  • Click on the Wait for debugger to connect button
  • When you hit ENTER, CodeLite should capture the call and the debug session starts
Edit - History - Print - Recent Changes - Search
Page last modified on April 20, 2020, at 10:09 PM