These are the basic instructions for starting a debug session.
There two types of debugging
- internal debugging (e.g. Script debug)
- Web Page debug, which uses a debugger extension (either Zend or XDebug) installed on a server
Contents |
Script debug sessions
These can be initiated in a several different ways.
First:
- Right click the editor area and select 'Debug As'->'PHP Script'.
- You will be prompted to move to the debug perspective - Click yes.
- In that perspective you will see the debug stack, variables and breakpoints views. You can also add more views, like the Watches view.
- From here you can do a step into, step over and step return by clicking the buttons on the stack view or by using F5/F6/F7 keys.
- You can set more breakpoints as you debug, or even run to a line that you mark (right-click + 'Run to line' action -> Will be available soon).
The second way you can run a script (the one currently active in your editor):
- Click the bug-shaped button on the application toolbar.
- Hit the 'arrow' to select PHP CGI or PHP CLI execution.
The third way is to hit the same debug arrow as above and select Open debug dialog. A dialog will be opened, in which you can create new PHP Script debug configurations and then launch them.
Web page debug configuration
This can be setup only through the debug dialog.
Open the dialog and add a new configuration for a "PHP Web Page".
To complete such a configuration you have to set up a server (through the Servers view) such as Apache or XAMPP.
The Debugger
The Studio debugger works with the Zend and XDebug extensions, and they can be controlled through a Preference:
- Windows -> Preferences -> Aptana -> Editors -> PHP -> PHP Interpreters, and then edit the default interpreter.
The default interpreters that we bundle contains a pre-configured XDebug extension; to use Zend you have to manually add it to that dialog and then select Zend as Debugger Type.
Debug Ports
There are two debug port that the studio opens when loading.
Port 9000 for the XDebug debugger and port 10000 for the Zend debugger.
These ports can be controlled through a Preference:
- Windows -> Preferences -> Aptana -> Editors -> PHP -> Debug
XDebug Configurations
The Studio debugger bundles a XDebug debugger with a pre-configured php.ini. However, if you wish to define your own XDebug setting you'll have to make sure that the minimal required settings for a session initialization are set in your ini.
zend_extension_ts=<debugger path>/php_xdebug.so xdebug.remote_enable=1 xdebug.remote_host=127.0.0.1 xdebug.remote_port=9000
Note: Port 9000 is the default port for XDebug. In case the Aptana PHP
debugger client is set to listed on port 9000, there is no real need to
set it in the ini, however it's a good practice to do so.
In case that an XDebug session is triggered from the studio and the client
port does not match the debug port defined in the ini, the Studio will
prompt you about it and advise you what to do.