Herramientas de Desarrollo: Difference between revisions

m (Reverted edits by Ikenofopake (talk) to last revision by Simnandez)
Line 124: Line 124:
A continuación, compruebe que su navegador no tiene una opción para bloquear la barra de tareas por javasscript.
A continuación, compruebe que su navegador no tiene una opción para bloquear la barra de tareas por javasscript.


* Para el ajuste a la línea de código, instale XDebug:
* Para la depuración línea a línea, instale XDebug:
En Ubuntu: Instalar el paquete '''php-xdebug'''
{{ToTranslate}}
=== [[File:Logo_windows.png]] In Windows ===
* Download dll file '''php_debug_xxx.dll''' on http://www.xdebug.org and store it in directory /ext of php. Then enable plugin.


En Wampserver/Windows, descargar el archivo '''php_debug_xxx.dll''' desde http://www.xdebug.org y guardarlo en el directorio '''/ext''' de php de WampServer.
* Modify php.ini file to add parameters:
<source lang="ini">
[xdebug]
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=c:/temp
xdebug.profiler_append=0
</source>


* Modificar el fichero php.ini (ó xdebug.ini) para agregar los parámetros
=== [[File:Logo_ubuntu.png]] In Ubuntu / Linux ===
* Install package '''php-xdebug''':
<source lang="bash">
sudo apt-get install php5-xdebug
</source>


* Modify xdebug.ini to add parameters after the line zend_extension=xxx (or similar):
<source lang="ini">
<source lang="ini">
[xdebug]
  xdebug.remote_enable=on
  xdebug.remote_enable=on
  xdebug.remote_handle=dbgp
  xdebug.remote_handle=dbgp
Line 139: Line 156:
  xdebug.profiler_enable=1
  xdebug.profiler_enable=1
  xdebug.show_local_vars=off
  xdebug.show_local_vars=off
  xdebug.profiler_output_dir=c:/temp
  xdebug.profiler_output_dir=/var/tmp
  xdebug.profiler_append=0
  xdebug.profiler_append=0
</source>
</source>
=== [[File:Eclipsephp.jpg]] Eclipse configuration ===
* 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.


* A continuación, para analizar los archivos de perfiles generados por Xdebug, puede instalar KCacheGrind (Linux) o WinCacheGrind (Windows).
* A continuación, para analizar los archivos de perfiles generados por Xdebug, puede instalar KCacheGrind (Linux) o WinCacheGrind (Windows).