Prerequisites:
Aptana Studio 3 installed
PHP5 installed
Verifying xdebug is installed
Create a php file with a call to phpinfo(), bring it up in your web browser and look for this:
![]() |
| Make sure you see something about "with Xdebug v#.#.#, etc..." |
Installing xdebug
xdebug provides a package for ubuntu. Installing it as as simple as:
sudo aptitude install php5-xdebugOnce that has completed installing, verify (as shown above) that it worked. Configuring xdebug
locate xdebug.iniYou should see at least one of these files. I found two:
Use your preferred text editor to modify the .ini file located in the conf.d directory. Mine happened to be named 20-xdebug.ini (you may need to have root privileges to modify it) Paste this into that .ini file, after the first line:
xdebug.remote_enable=1 xdebug.remote_connect_back=1 xdebug.remote_host=127.0.0.1 xdebug.remote_port=9000 xdebug.remote_handler="dbgp" xdebug.remote_mode="req" xdebug.remote_log="/etc/php5/xdebug.log" xdebug.auto_trace=off xdebug.default_enable=on
Save, and then restart apache
sudo service apache2 restart
That should be all of the configurations required for Xdebug.
Getting Aptana Studio 3 to play nicely with Xdebug
In Aptana Studio: Window > Preferences > Aptana Studio > Editors > PHP > Debug
Make sure that Xdebug is listening to port 9000 (you'll notice we set that port when we pasted the last chunk of code into the xdebug.ini file)
In that same preferences window, proceed to: General > Web Browser. Use an external browser. I've had luck with Firefox. Chromium doesn't like being opened with root access (I open Aptana with root privileges so I can write to my document root easily)
Go ahead and close that window. Head over to: Run > Debug Configurations. Right-click PHP Web Page and select New. Name it whatever you like, make sure Xdebug is the selected server debugger. Then add PHP Server. For the base URL, I used: http://localhost, and for the document root, I used: /var/www/ (since that's where my apache server looks to).
You're basically done! All you need to do us click the debug button and chose your configuration! Good luck, and happy debugging.





No comments:
Post a Comment