How to debug the server-side Ajax application like the joomla installation application?

365 views
Skip to first unread message

javier gómez

unread,
Jul 20, 2012, 12:38:54 PM7/20/12
to joomla-...@googlegroups.com
Hi,

In my Google Summer of code project I'm working in the installation application of Joomla!. When I have any error I can go debugging through every step with XDebug and my IDE, but what can I do when I have an AJAX call?

When I do an AJAX call I'm actually creating two instances of Joomla!, one is the client (the one in my browser witch I know how to debug) but the other is happening in my server, that will process the response of my petition. I would like to go step by step debugging the creation of that response, adding breakpoints and etc, but I don't know how to do that. Any recommendation?

Thanks
--
Javi

Mark Dexter

unread,
Jul 20, 2012, 12:48:29 PM7/20/12
to joomla-...@googlegroups.com
I'm not sure if this will help, but I have found it helpful sometimes
to use a JavaScript debugger to understand better what is happening
inside an AJAX cycle. For example, Firebug or Chrome have JS
debuggers. I'm not sure how to debug the PHP part of an AJAX cycle.
This link also looks interesting:
http://sixrevisions.com/web-development/how-to-debug-php-using-firefox-with-firephp/.
Good luck. Mark
> --
> You received this message because you are subscribed to the Google Groups
> "Joomla! CMS Development" group.
> To post to this group, send an email to joomla-...@googlegroups.com.
> To unsubscribe from this group, send email to
> joomla-dev-cm...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/joomla-dev-cms?hl=en-GB.

Sam Moffatt

unread,
Jul 20, 2012, 1:22:05 PM7/20/12
to joomla-...@googlegroups.com
Depending on your IDE you can configure it to have breakpoints with
something like XDebug and have the processes connect to the IDE on the
launch. I'd refer to the manual for the tool that you're using to see
how that operates but that would be an option for debugging AJAX calls
at least with XDebug.

Cheers,

Sam Moffatt
http://pasamio.id.au

Brad Gies

unread,
Jul 20, 2012, 2:15:10 PM7/20/12
to joomla-...@googlegroups.com

Javier.... I debug Ajax calls all the time (firebug in Firefox) and with
Eclipse/XDebug on the server side....

I forget the exact configuration.... but I think you have to have remote
debugging enabled. And what I do is debug a normal page first to get
Eclipse attached (launch the index.php page in Eclipse)... and then use
the same session for Ajax debugging.... Sorry.. I know that's not very
specific, but at least you know it's possible.

If you are still having problems, send me a direct email (we can chat on
QQ/Yahoo/MSN), and I'll walk you through it. Might just have to run
though it myself to remember the exact steps I take to enable it. You
might just need the settings for the Launch/Debug :)

Brad
> --
> You received this message because you are subscribed to the Google
> Groups "Joomla! CMS Development" group.
> To post to this group, send an email to joomla-...@googlegroups.com.
> To unsubscribe from this group, send email to
> joomla-dev-cm...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/joomla-dev-cms?hl=en-GB.


--
Sincerely,

Brad Gies
----------------------------------------------
bgies.com maxhomevalue.com
idailythought.com greenfarminvest.com
----------------------------------------------

javier gómez

unread,
Jul 21, 2012, 5:45:39 PM7/21/12
to joomla-...@googlegroups.com
Thanks for all your replies ^_^

Actually I'm able to debug with my IDE Phpstorm while navigating with the browser. That really rocks! but it only stops at breakpoints when is the application generated by my browser, not when is the aplication running due to the AJAX request.

I will continue investigating thanks Mark and Sam and thanks for your ofer Brad, I will contact you If I don't find the answer.

On 20 July 2012 12:15, Brad Gies <rbg...@gmail.com> wrote:

Javier.... I debug Ajax calls all the time (firebug in Firefox) and with Eclipse/XDebug on the server side....

I forget the exact configuration.... but I think you have to have remote debugging enabled. And what I do is debug a normal page first to get Eclipse attached (launch the index.php page in Eclipse)... and then use the same session for Ajax debugging.... Sorry.. I know that's not very specific, but at least you know it's possible.

If you are still having problems, send me a direct email (we can chat on QQ/Yahoo/MSN), and I'll walk you through it. Might just have to run though it myself to remember the exact steps I take to enable it. You might just need the settings for the Launch/Debug :)

Brad



On 20/07/2012 9:38 AM, javier gómez wrote:
Hi,

In my Google Summer of code project I'm working in the installation application of Joomla!. When I have any error I can go debugging through every step with XDebug and my IDE, but what can I do when I have an AJAX call?

When I do an AJAX call I'm actually creating two instances of Joomla!, one is the client (the one in my browser witch I know how to debug) but the other is happening in my server, that will process the response of my petition. I would like to go step by step debugging the creation of that response, adding breakpoints and etc, but I don't know how to do that. Any recommendation?

Thanks
--
Javi

--
You received this message because you are subscribed to the Google Groups "Joomla! CMS Development" group.
To post to this group, send an email to joomla-dev-cms@googlegroups.com.
To unsubscribe from this group, send email to joomla-dev-cms+unsubscribe@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/joomla-dev-cms?hl=en-GB.


--
Sincerely,

Brad Gies
----------------------------------------------
bgies.com              maxhomevalue.com
idailythought.com      greenfarminvest.com
----------------------------------------------
--
You received this message because you are subscribed to the Google Groups "Joomla! CMS Development" group.
To post to this group, send an email to joomla-dev-cms@googlegroups.com.
To unsubscribe from this group, send email to joomla-dev-cms+unsubscribe@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/joomla-dev-cms?hl=en-GB.




--
Javi

Imanol Pérez Iriarte

unread,
Jul 22, 2012, 5:23:50 AM7/22/12
to joomla-...@googlegroups.com
Hi, for this purpose i'm using eclipse + xdebug + firebug all running at localhost. With firebug you can see the post headers, the ajax call and the server response. Also I'm been able to put a breackpoint at the function on the controller who generates the ajax response. Obviously you have to start debugging from index.php.
If you have wish, i could grab some screenshoots of the process.
Hope it helps,

2012/7/21 javier gómez <javier.go...@gmail.com>
To post to this group, send an email to joomla-...@googlegroups.com.
To unsubscribe from this group, send email to joomla-dev-cm...@googlegroups.com.

JSamir

unread,
Jul 22, 2012, 4:31:11 PM7/22/12
to joomla-...@googlegroups.com
As far as I know, the debug is working in that manner that YOUR IDE is waiting for a connection on a port you specified in php.ini and in the IDE settings. On your first debug run, your browser uses some params in the URl to tell xdebug "now i need debug".
When you use Ajax, you dont start a new debug session, and therefore xdebug cant work. Thats just an info, not a solution.

I would try to send some debug info in the url with the ajax request, maybe xdebug starts a new session then.

Tell us how you solved it if you do  ;)

javier gómez

unread,
Jul 23, 2012, 6:09:46 PM7/23/12
to joomla-...@googlegroups.com
That has a lot of sense JSamir. Now I understand why!!! 
Thanks ^_^

I have found some info:
If you want to debug a script started through a web browser, simply add XDEBUG_SESSION_START=session_name as parameter to the URL. Refer to the next section to read on how debug sessions work from within a browser window.

To view this discussion on the web, visit https://groups.google.com/d/msg/joomla-dev-cms/-/GZJvlnu1Dx0J.

To post to this group, send an email to joomla-...@googlegroups.com.
To unsubscribe from this group, send email to joomla-dev-cm...@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/joomla-dev-cms?hl=en-GB.



--
Javi

JSamir

unread,
Jul 23, 2012, 6:16:26 PM7/23/12
to joomla-...@googlegroups.com
Hi Javier,

thats what I meant by "send some debug info with the request".

Would be nice if you give us a howto if it works for you.

piotr_cz

unread,
Jul 24, 2012, 5:13:45 AM7/24/12
to Joomla! CMS Development
You may try out
'FirePHP - Firebug Extension for AJAX Development': http://www.firephp.org/



On Jul 24, 12:09 am, javier gómez <javier.gomez.co...@gmail.com>
wrote:
> That has a lot of sense JSamir. Now I understand why!!!
> Thanks ^_^
>
> I have found some info:
> If you want to debug a script started through a web browser, simply add
> XDEBUG_SESSION_START=session_name as parameter to the URL. Refer to the
> next section to read on how debug sessions work from within a browser
> window.
>
> Continues at:http://xdebug.org/docs/remote#browser_session
>
> On 22 July 2012 14:31, JSamir <samirabul...@gmail.com> wrote:
>
>
>
>
>
>
>
>
>
> > As far as I know, the debug is working in that manner that YOUR IDE is
> > waiting for a connection on a port you specified in php.ini and in the IDE
> > settings. On your first debug run, your browser uses some params in the URl
> > to tell xdebug "now i need debug".
> > When you use Ajax, you dont start a new debug session, and therefore
> > xdebug cant work. Thats just an info, not a solution.
>
> > I would try to send some debug info in the url with the ajax request,
> > maybe xdebug starts a new session then.
>
> > Tell us how you solved it if you do  ;)
>
> > On Sunday, July 22, 2012 11:23:50 AM UTC+2, Imanol wrote:
>
> >> Hi, for this purpose i'm using eclipse + xdebug + firebug all running at
> >> localhost. With firebug you can see the post headers, the ajax call and the
> >> server response. Also I'm been able to put a breackpoint at the function on
> >> the controller who generates the ajax response. Obviously you have to start
> >> debugging from index.php.
> >> If you have wish, i could grab some screenshoots of the process.
> >> Hope it helps,
>
> >> 2012/7/21 javier gómez <javier.gomez.co...@gmail.com>
> >>>>> To post to this group, send an email to joomla-dev-cms@googlegroups.**
> >>>>> co**m <joomla-...@googlegroups.com>.
> >>>>> To unsubscribe from this group, send email to
> >>>>> joomla-dev-cms+unsubscribe@**goo**glegroups.com<joomla-dev-cms%2Bunsubscrib e...@googlegroups.com>
> >>>>> .
> >>>>> For more options, visit this group athttp://groups.google.com/**group
> >>>>> **/joomla-dev-cms?hl=en-GB<http://groups.google.com/group/joomla-dev-cms?hl=en-GB>
> >>>>> .
>
> >>>> --
> >>>> Sincerely,
>
> >>>> Brad Gies
> >>>> ------------------------------****----------------
> >>>> bgies.com              maxhomevalue.com
> >>>> idailythought.com      greenfarminvest.com
> >>>> ------------------------------****----------------
>
> >>>> --
> >>>> You received this message because you are subscribed to the Google
> >>>> Groups "Joomla! CMS Development" group.
> >>>> To post to this group, send an email to joomla-dev-cms@googlegroups.**
> >>>> co**m <joomla-...@googlegroups.com>.
> >>>> To unsubscribe from this group, send email to
> >>>> joomla-dev-cms+unsubscribe@**goo**glegroups.com<joomla-dev-cms%2Bunsubscrib e...@googlegroups.com>
> >>>> .
> >>>> For more options, visit this group athttp://groups.google.com/**group*
> >>>> */joomla-dev-cms?hl=en-GB<http://groups.google.com/group/joomla-dev-cms?hl=en-GB>
> >>>> .
>
> >>> --
> >>> Javi
>
> >>>  --
> >>> You received this message because you are subscribed to the Google
> >>> Groups "Joomla! CMS Development" group.
> >>> To post to this group, send an email to joomla-dev-cms@googlegroups.**
> >>> com <joomla-...@googlegroups.com>.
> >>> To unsubscribe from this group, send email to
> >>> joomla-dev-cms+unsubscribe@**googlegroups.com<joomla-dev-cms%2Bunsubscribe@ googlegroups.com>
> >>> .
> >>> For more options, visit this group athttp://groups.google.com/**
> >>> group/joomla-dev-cms?hl=en-GB<http://groups.google.com/group/joomla-dev-cms?hl=en-GB>
> >>> .

Javier Gómez

unread,
Jul 26, 2012, 11:29:23 PM7/26/12
to joomla-...@googlegroups.com
I know this is not the answer that you were waiting because I haven't solve it not by firephp or other cool solution. Basically what i have done is using the not JSON controller of the installation aplication (setup.php instead of setup.json.php) to debug it with the browser. Something like: 

What works for the non json controller basically works for the other. That is enought for my needs by now, but if I test firephp in the future I promise to update this thread.

Thanks all ^_^
> >>>>> co**m <joomla-dev-cms@googlegroups.com>.
> >>>>> To unsubscribe from this group, send email to
> >>>>> joomla-dev-cms+unsubscribe@**goo**glegroups.com<joomla-dev-cms%2Bunsubscrib e...@googlegroups.com>
> >>>>> .
> >>>>> For more options, visit this group athttp://groups.google.com/**group
> >>>>> **/joomla-dev-cms?hl=en-GB<http://groups.google.com/group/joomla-dev-cms?hl=en-GB>
> >>>>> .
>
> >>>> --
> >>>> Sincerely,
>
> >>>> Brad Gies
> >>>> ------------------------------****----------------
> >>>> bgies.com              maxhomevalue.com
> >>>> idailythought.com      greenfarminvest.com
> >>>> ------------------------------****----------------
>
> >>>> --
> >>>> You received this message because you are subscribed to the Google
> >>>> Groups "Joomla! CMS Development" group.
> >>>> To post to this group, send an email to joomla-dev-cms@googlegroups.**
> >>>> co**m <joomla-dev-cms@googlegroups.com>.
> >>>> To unsubscribe from this group, send email to
> >>>> joomla-dev-cms+unsubscribe@**goo**glegroups.com<joomla-dev-cms%2Bunsubscrib e...@googlegroups.com>
> >>>> .
> >>>> For more options, visit this group athttp://groups.google.com/**group*
> >>>> */joomla-dev-cms?hl=en-GB<http://groups.google.com/group/joomla-dev-cms?hl=en-GB>
> >>>> .
>
> >>> --
> >>> Javi
>
> >>>  --
> >>> You received this message because you are subscribed to the Google
> >>> Groups "Joomla! CMS Development" group.
> >>> To post to this group, send an email to joomla-dev-cms@googlegroups.**
> >>> com <joomla-dev-cms@googlegroups.com>.
> >>> To unsubscribe from this group, send email to
> >>> joomla-dev-cms+unsubscribe@**googlegroups.com<joomla-dev-cms%2Bunsubscribe@ googlegroups.com>
> >>> .
> >>> For more options, visit this group athttp://groups.google.com/**
> >>> group/joomla-dev-cms?hl=en-GB<http://groups.google.com/group/joomla-dev-cms?hl=en-GB>
> >>> .
>
> >>  --
> > You received this message because you are subscribed to the Google Groups
> > "Joomla! CMS Development" group.
> > To view this discussion on the web, visit
> >https://groups.google.com/d/msg/joomla-dev-cms/-/GZJvlnu1Dx0J.
>
> > To post to this group, send an email to joomla-dev-cms@googlegroups.com.
> > To unsubscribe from this group, send email to
> > joomla-dev-cms+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages