by Kevin Schroeder | 12:00 am

I’m working on an example of mobile detection with the new Zend Framework 1.11 beta that was just released when I came upon an interesting problem.  That problem is; how do I debug requests coming in from the mobile phone?  The answer is actually relatively easy.  I’m doing this using a Zend Framework application, but the concepts that you’ll see here can be used quite easily across any type of framework.

The debugger in Zend Studio works by watching for certain cookies or GET parameters to be sent by the browser.  If they are detected then the Zend Debugger on the server will try to connect to the debugger in the IDE based off of the information provided in the cookie.  I typically do this using the Zend debugger toolbar, but I can’t get that on my Epic (Android).  Another option I have is to debug from the IDE but I’m not actually running from the phone so I will not have the same configuration.

The solution is similar to what I did with Debugging an RPC call in Zend Framework.  What this does is set the cookies from the remote browser to debug on the local instance of the Zend debugger.  To kick it off simply open up the URL to the debug kickoff page.  That will set the cookies in your mobile browser.  Then go to the page that you want to debug from your mobile phone and reload it.  Because you have the cookies set on the mobile browser the next request will debug in your local IDE.

class IndexController extends Zend_Controller_Action

    public function setdebugAction()
        $cookies = array(
            'start_debug'            => '1',
            'debug_stop'             => '1',
            'debug_fastfile'         => '1',
            'debug_coverage'         => '1',   
            'use_remote'             => '1',
            'send_sess_end'         => '1',
            'debug_session_id'         => '2000',  
            'debug_start_session'     => '1',
            'debug_port'             => '10137',
            'debug_host'             => ''
        foreach ($cookies as $name => $value) {
                new Zend_Http_Cookie(

        echo "Debug set";




No comments yet...

Leave a Reply

Your email address will not be published. Required fields are marked *