The current page is:

PfsenseEclipseXdebugSetup


How to use pfSense and xdebug to debug php code.



1:


NOTES:
Add the fallowing lines to the end of the file.
xdebug.remote_enable = Enable/disable xdebug
xdebug.remote_autostart = Auto send debug calls to client when a php page is visited
(xdebug.remote_autostart: Only use this when dealing with debuging outside document root. eg; /usr/local/wwww)
xdebug.remote_host = Address where the php server will send debug calls to the client
xdebug.remote_port = Port where the php server will send debug calls to the client

Edit FILE: ee /usr/local/etc/php.ini
CONFIG LINES:
zend_extension=/usr/local/lib/php/20060613/xdebug.so
xdebug.remote_enable=On
;xdebug.remote_autostart=On
xdebug.remote_handler=dbgp
xdebug.remote_host=192.168.7.10
xdebug.remote_port=9000
;xdebug.remote_mode=req


2:


NOTES:
You must kill and restart all php processes and lighttpd or you will not see xdebug load.

COMMANDS:
killall php

killall lighttpd

/usr/local/sbin/lighttpd -f /var/etc/lighty-webConfigurator.conf


3:


NOTES:
Verify that xdebug is loaded into php.

COMMANDS:
[2.0-RC1][root@pfsense.local2]/: php -v
PHP 5.2.14 with Suhosin-Patch 0.9.7 (cgi-fcgi) (built: Apr  5 2011 09:41:46)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2010 Zend Technologies
	with Xdebug v2.1.0, Copyright (c) 2002-2010, by Derick Rethans
	with Suhosin v0.9.27, Copyright (c) 2007, by SektionEins GmbH



4:


NOTES:
Configure Eclipse

COMMANDS:
1: Open your Porject in eclipse.

2: Got to: Window >>> Preferences >>> PHP >>> Debug

3:  PHP Debuger >>> SELECT >>> xdebug

4:  PHP Debuger >>> configure >>> Installed Debuggers  >>> Xdebug >>> Configure  >>> Debug Port >>>9000 
PHP Debuger >>> configure >>> Installed Debuggers  >>> Xdebug >>> Configure  >>> Accept Remote Sessions >>> any  


5:  PHP Debuger >>> Server >>> PHP SERVERS  >>>Default PHP Web Server >>> Edit >>> Server >>>URL >> 192.168.7.1
PHP Debuger >>> Server >>> PHP SERVERS  >>>Default PHP Web Server >>> Edit >>> Path Mapping >>> your paths

Apply all settings


5:


NOTES:
Using Eclipse to debug.

COMMANDS:
1. Select a file in the PHP Exploer

2. Right Click >>> Debug AS >>> PHP webpage  (click yes to go into debug vew)

You should now see pfsense server with all VARs in the right hand side.


COOL USAGE


Your not limited to /usr/local/www if you enable "xdebug.remote_autostart" you can debug from anywhere in the pfsense server.

For example:

In the pfsense terminal run a script in the command line Example: (php -f /usr/local/snort/snort_update_rules).

If your project sees said file you ran on pfsense, eclipes will start and you can debug your code.

There are no comments on this page.
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki