4,395
edits
| Line 123: | Line 123: | ||
* Install XDebug. | * Install XDebug. | ||
With Ubuntu: install package '''php-xdebug''' | With Ubuntu: install package '''php-xdebug''': | ||
<source lang="bash"> | |||
sudo apt-get install php5-xdebug | |||
</source> | |||
With WampServer/Windows: Download dll file '''php_debug_xxx.dll''' on http://www.xdebug.org and store it in directory /ext of php. Then enable plugin. | With WampServer/Windows: Download dll file '''php_debug_xxx.dll''' on http://www.xdebug.org and store it in directory /ext of php. Then enable plugin. | ||
* Modify php.ini file | * Modify php.ini file in windows to add parameters: | ||
<source lang="ini"> | <source lang="ini"> | ||
[xdebug] | [xdebug] | ||
| Line 139: | Line 142: | ||
xdebug.profiler_append=0 | xdebug.profiler_append=0 | ||
</source> | </source> | ||
or xdebug.ini in ubuntu to add parameters after the line zend_extension=xxx (or similar): | |||
<source lang="ini"> | |||
xdebug.remote_enable=on | |||
xdebug.remote_handle=dbgp | |||
xdebug.remote_host=localhost | |||
xdebug.remote_port=9000 | |||
xdebug.profiler_enable=1 | |||
xdebug.show_local_vars=off | |||
xdebug.profiler_output_dir=/var/tmp | |||
xdebug.profiler_append=0 | |||
</source> | |||
* Open Eclipse. In Window->Preferences->General->Web Browser, select external web browser, and set it to Default system web browser. | |||
* Go into the debug section, by Window->Preferences->PHP->Debug, and set the PHP Debugger option to XDebug (by default this is set to the Zend Debugger). Note the chekbox “Break at first line” in this page as well – you can change this later on, as required. | |||
* After you’ve applied your changes, go into the PHP Debug prespective, and go to menu Debug Configurations… Here, make sure the Server Debugger is set to XDebug, and that the PHP server points to http://localhost/ or an appropriate server location. The file section should point to the file to be debugged, relative to your workspace, the relative path maybe something /dolibarr/htdocs/index.php. | |||
* Check the URL section to see whether it points to the correct location – if not, make sure you uncheck the “Auto-Generate” check box, and enter in the correct location. Apply the changes and close the dialog box. | |||
* You should now be ready to debug Dolibarr. Click on Run->Debug or F11 to enable debugging, Eclipse should switch to the Debug View, and the page should start loading in your external browser. If “Break at First Line” checkbox was checked previously, then the program would have “stopped” at the first line. You can step into or step over subsequent lines using the controls on your top left corner. Alternatively, you can place breakpoints at various locations and stop code execution there as well. | |||
* Then to analyze files generated by XDebug profiling, you can install KCacheGrind (Linux) or WinCacheGrind (Windows). | * Then to analyze files generated by XDebug profiling, you can install KCacheGrind (Linux) or WinCacheGrind (Windows). | ||