A combination of tools and all because some lovely fella here : http://www.themidnightcoders.com/forum/default.aspx?g=posts&t=452
layed it all out in english for me. In case this ever goes down here is his post in full with only one gotchya , which i try to explain below.
I finally got debugging to work (I actually ate dirt until now).
If you want to debug server side php classes with weborb inside flex-builder then here's one way to do it:
The configuration I used is xampp 1.6.6a (apache+mysql) on windows XP
You need some tools to make it happen:
A. xampp for windows
B. xdebug (for php 5.2.5) - when using xampp, don't forget to comment out zend_optimizer.
C. XDebug Helper addon (version 0.2 or higher) for Firefox . This is a must so your flex app will include XDebug info in the HTTP headers
D. Flex-Builder-3
E. PDT plugin for eclipse (I will explain the easiest way to install it).
F. Weborb for PHP ofcourse
What is PDT? : It's a plug-in for eclipse IDE to support PHP development.
Flex-Builder is based on eclipse so with PDT installed, you can debug client-side (Flex) and server-side (php) in the same IDE.
1. Install xampp and XDebug
I won't elborate on installing xampp since there is enough info out there.
To install XDebug in xampp you just need to download the appropriate extension module from XDebug site,
and configure the php.ini with a few lines as shown below.
Make sure that XDebug is installed correctly using phpinfo() - You should see a XDebug section.
my c:\xampp\apache\bin\php.ini includes the following:
And I commented out the [Zend] section.
2. Installing PDT plug-in in Flex-Builder-3
- Open Flex-Builder and choose from the menu Help->Software Updates->Find and Install.
- Select "Search for new features to install" and click Next.
- Click on "New Remote Site", enter a name (e.g. PDT) and paste, in the URL section, the following address: http://download.eclipse.org/tools/pdt/updates .
- Select two checkboxes:
* Europa Discovery Site and
* PDT
we added the europa site so that required plugins which PDT depends on can also be downloaded.
- Click Finish, choose a mirror site and wait for the search results.
- In the search results:
* Select the PDT checkbox
* expand the Europa Discovery Site
* click on "Select Required" button.
Now all required features should be automatically selected.
- Click Next, Select "I accept...", click Next and at last click Finish.
To see if it's installed OK, you can try File->New->Other.. and look for PHP project under PHP section,
3. Installing and Configuring XDebug Helper
OK, This step is easy.
- Follow the link above and install the addon into Firefox
- From the Firefox menu, choose Tools->Add-ons
- Choose XDebug Helper and click the "Options" button
- In the Settings section down below, where it says "Xdebug.idekey value", change the default string to "ECLIPSE_DBGP"
I know it says to use ECLIPSE_XDEBUG value but that's a mistake. Trust me!
- After the add-on is installed, you should see a small green XDebug icon on your Firefox status bar (bottom right corner).
This green icon is a toggle button to start and stop debugging. When it's on, every http packet sent through the browser will include in its header the Xdebug.idekey value you entered. So don't forget to turn it on while debugging.
4. Creating a PHP project
The simplest way for creating a php project with PDT is to put it under your webserver root directory (e.g. c:/xampp/htdocs//Services/ or c:/inetpub/wwwroot//Services for IIS).
This saves you the hassle of synchronizing your files on each change.
But for those that prefer synchronizing, it's not that difficult (maybe in another post).
So assuming you'll create all your projects on the webserver root directory here's what should be done:
- From Flex-Builder menu, choose File->Switch Workspace.->Other..
- click browse and choose the web-server root dir.
This will reopen Flex-Builder in an empty environment.
Every new project will create a new directory (with the same name) under the root of your webserver.
- Import or Create a Flex Project that uses RemoteObject.
A nice test example by Jens Krause can be found here.
- To create a PHP project goto File->New->Other.. and look for PHP project under PHP section
Since we want our php code to reside under/Services, we'll name our new php project as our weborb_install_dir.
If you've installed weborb in the root of your web-server, then name your PHP project "Services".
- create or copy your PHP class files under Services.
5. Creating a Debug Configuration
- From FlexBuilder menu choose Run->Debug->Other... The configuration dialog opens..
- From the tree view on the left, double-click PHP web-page. A new empty php configuration is created.
- In the Name field type your app-name
- Choose XDebug in the Server Debugger combo-box
- Click on "Configuration.." button next to the "PHP Server" field.
- Select the "Path Mapping" tab and add a path mapping to Services directory in the server. Click OK.
- In the File section Click "Browse" and select a class file. (doesn't really matter which).
- Disable the "Break at First Line" check-box
- Click Apply.
6. Debugging
- Place a breakpoint somewhere in your PHP code.
- Open the Debug view if it's not already open (Window->OtherViews... and type Debug)
- To select Firefox as the browser then goto Window->Preferences->Genral->Web Browser
- Launch the debug configuration created in the previous step.
Ignore or close the launched Firefox (can't find how to turn this browser launch off).
Now you should see as in the image below that PDT is waiting for a signal: The bottom right corner shows: "Launching ..%"
- Launch your Flex app. Firefox should be launched.
- In Firefox bottom right corner, Turn the XDebug Helper ON
- Send something from your Flex app to the server.
- Go back to Flex-Builder. You should notice now that the waiting status has stopped.
This means XDebug sent Flex-Builder PDT a signal.
- In the Debug view, select "PHP Application" and click the disconnect button.
That's it... you've stopped at the breakpoint.
In case the waiting status stopped but it didn't stop at your breakpoint, recheck your Path Mapping,
To run between breakpoint press F8(Resume).
When you want the php code to continue running and return values to the flash player, click disconnect again.
I noticed that when flex connects to weborb, there are actually two AMF messages to/index.php.
Only the second call reaches our PHP classes and stops at our breakoint.
In the first call we press the disconnect button which lets the PHP continue running and return to the flash player which then sends the second message.
It would be much more intuitive if F8 (Resume) would also cause a disconnect if there are no more breakpoints to stop at.
Perhaps this behavior is more suitable to the standard PHP debug scenario (no flash-player).
Hope I helped...
Nadav Parag
nadavpa@gmail.com
If you want to debug server side php classes with weborb inside flex-builder then here's one way to do it:
The configuration I used is xampp 1.6.6a (apache+mysql) on windows XP
You need some tools to make it happen:
A. xampp for windows
B. xdebug (for php 5.2.5) - when using xampp, don't forget to comment out zend_optimizer.
C. XDebug Helper addon (version 0.2 or higher) for Firefox . This is a must so your flex app will include XDebug info in the HTTP headers
D. Flex-Builder-3
E. PDT plugin for eclipse (I will explain the easiest way to install it).
F. Weborb for PHP ofcourse
What is PDT? : It's a plug-in for eclipse IDE to support PHP development.
Flex-Builder is based on eclipse so with PDT installed, you can debug client-side (Flex) and server-side (php) in the same IDE.
1. Install xampp and XDebug
I won't elborate on installing xampp since there is enough info out there.
To install XDebug in xampp you just need to download the appropriate extension module from XDebug site,
and configure the php.ini with a few lines as shown below.
Make sure that XDebug is installed correctly using phpinfo() - You should see a XDebug section.
my c:\xampp\apache\bin\php.ini includes the following:
Code:
[XDebug]
;; Only Zend OR (!) XDebug
zend_extension_ts="C:\xampp\php\ext\php_xdebug.dll"
xdebug.remote_enable=true
;; Only Zend OR (!) XDebug
zend_extension_ts="C:\xampp\php\ext\php_xdebug.dll"
xdebug.remote_enable=true
And I commented out the [Zend] section.
2. Installing PDT plug-in in Flex-Builder-3
- Open Flex-Builder and choose from the menu Help->Software Updates->Find and Install.
- Select "Search for new features to install" and click Next.
- Click on "New Remote Site", enter a name (e.g. PDT) and paste, in the URL section, the following address: http://download.eclipse.org/tools/pdt/updates .
- Select two checkboxes:
* Europa Discovery Site and
* PDT
we added the europa site so that required plugins which PDT depends on can also be downloaded.
- Click Finish, choose a mirror site and wait for the search results.
- In the search results:
* Select the PDT checkbox
* expand the Europa Discovery Site
* click on "Select Required" button.
Now all required features should be automatically selected.
- Click Next, Select "I accept...", click Next and at last click Finish.
To see if it's installed OK, you can try File->New->Other.. and look for PHP project under PHP section,
3. Installing and Configuring XDebug Helper
OK, This step is easy.
- Follow the link above and install the addon into Firefox
- From the Firefox menu, choose Tools->Add-ons
- Choose XDebug Helper and click the "Options" button
- In the Settings section down below, where it says "Xdebug.idekey value", change the default string to "ECLIPSE_DBGP"
I know it says to use ECLIPSE_XDEBUG value but that's a mistake. Trust me!
- After the add-on is installed, you should see a small green XDebug icon on your Firefox status bar (bottom right corner).
This green icon is a toggle button to start and stop debugging. When it's on, every http packet sent through the browser will include in its header the Xdebug.idekey value you entered. So don't forget to turn it on while debugging.
4. Creating a PHP project
The simplest way for creating a php project with PDT is to put it under your webserver root directory (e.g. c:/xampp/htdocs/
This saves you the hassle of synchronizing your files on each change.
But for those that prefer synchronizing, it's not that difficult (maybe in another post).
So assuming you'll create all your projects on the webserver root directory here's what should be done:
- From Flex-Builder menu, choose File->Switch Workspace.->Other..
- click browse and choose the web-server root dir.
This will reopen Flex-Builder in an empty environment.
Every new project will create a new directory (with the same name) under the root of your webserver.
- Import or Create a Flex Project that uses RemoteObject.
A nice test example by Jens Krause can be found
- To create a PHP project goto File->New->Other.. and look for PHP project under PHP section
Since we want our php code to reside under
If you've installed weborb in the root of your web-server, then name your PHP project "Services".
- create or copy your PHP class files under Services.
5.
- From FlexBuilder menu choose Run->Debug->Other... The configuration dialog opens..
- From the tree view on the left, double-click PHP web-page. A new empty php configuration is created.
- In the Name field type your app-name
- Choose XDebug in the Server Debugger combo-box
- Click on "Configuration.." button next to the "PHP Server" field.
- Select the "Path Mapping" tab and add a path mapping to Services directory in the server. Click OK.
- In the File section Click "Browse" and select a class file. (doesn't really matter which).
- Disable the "Break at First Line" check-box
- Click Apply.
6. Debugging
- Place a breakpoint somewhere in your PHP code.
- Open the Debug view if it's not already open (Window->OtherViews... and type Debug)
- To select Firefox as the browser then goto Window->Preferences->Genral->Web Browser
- Launch the debug configuration created in the previous step.
Ignore or close the launched Firefox (can't find how to turn this browser launch off).
Now you should see as in the image below that PDT is waiting for a signal: The bottom right corner shows: "Launching
- Launch your Flex app. Firefox should be launched.
- In Firefox bottom right corner, Turn the XDebug Helper ON
- Send something from your Flex app to the server.
- Go back to Flex-Builder. You should notice now that the waiting status has stopped.
This means XDebug sent Flex-Builder PDT a signal.
- In the Debug view, select "PHP Application" and click the disconnect button.
That's it... you've stopped at the breakpoint.
In case the waiting status stopped but it didn't stop at your breakpoint, recheck your Path Mapping,
To run between breakpoint press F8(Resume).
When you want the php code to continue running and return values to the flash player, click disconnect again.
I noticed that when flex connects to weborb, there are actually two AMF messages to
Only the second call reaches our PHP classes and stops at our breakoint.
In the first call we press the disconnect button which lets the PHP continue running and return to the flash player which then sends the second message.
It would be much more intuitive if F8 (Resume) would also cause a disconnect if there are no more breakpoints to stop at.
Perhaps this behavior is more suitable to the standard PHP debug scenario (no flash-player).
Hope I helped...
Nadav Parag
I can say wholeheartedly that you helped. I was already halfway myself with XDebug and the Firefox addon but i was using Netbeans and EasyPHP. However when you want to break out during a client to server it wasnt obvious how i was supposed to catch anything serverside.
My only addition that wasnt obvious to me was that. If like me you had a folder in your server for your PHP's and then you had a folder locally for your flex application. You should make sure you flex project includes the source folder of your PHP's so that after you run the debugger for your PDT (PHP Development Tools) Project and THEN your flex project, the flex project has some sort of scope to break out on your behalf. Otherwise it just carries on regardless of any breakpoints you think you have set.
Bottom line, the PHP project is simply to et the remote debugger going, after that its job is done, all your break points should be set via which ever Flex project you are working on.