Welcome Guest, Not a member yet? Register   Sign In
Using XDebug with CodeIgniter
#2

[eluser]Neovive[/eluser]
Here are some notes summarizing the process I utilized to get the Zend Debugger working with Eclipse PDT on WAMP server. It's pieced together from various sites and some postings in the CI forum. I haven't tried it in a few months. If it works, I will add it to the Wiki.

The Zend Debugger is available for free and seems to integrate better with Eclipse PDT than XDebug. the process eventually worked, but it was hard to get much value out of the debugger, since CI routes everything through the front controller.


Installing Eclipse PDT v1 with Zend Debugger on WAMP Server for Code Igniter

1) Download and install WAMP Server from http://www.wampserver.com/en/

2) Download the Debugger Extension from Zend Downloads (http://downloads.zend.com/pdt/server-debugger/) You need to download the Debugger Extension packet for the appropriate operating system. Unpack the zipped packet and take the dll (or so) file which matches the PHP version you have currently running. E.g. for PHP 5.2.0 the correct file is ZendDebugger.dll inside 5_2_x_comp directory.

3) Unzip the proper ZendDebugger.dll and copy to C:\wamp\php\ext

4) Add the following lines to your php.ini file:
zend_extension_ts=c:/wamp/php/ext/ZendDebugger.dll
zend_debugger.allow_hosts=127.0.0.1,list.your.ip.addresses [add comma separated list of all applicable ip's for development server]
zend_debugger.expose_remotely=always

5) Restart server and create a <?=phpinfo();?> script. You should see a "With Zend Debugger ....." under the Powered By Zend logo.

6) In CI update the application/config.php as follows:
$config['enable_query_strings'] = TRUE;
$config['permitted_uri_chars'] = '';


7) In CI update the system/libraries/Router.php (as per http://ellislab.com/forums/viewthread/59944/)
line 288
Code:
function _get_uri_string()
    {
        if (strtoupper($this->config->item('uri_protocol')) == 'AUTO')
        {
            // If the URL has a question mark then it's simplest to just
            // build the URI string from the zero index of the $_GET array.
            // This avoids having to deal with $_SERVER variables, which
            // can be unreliable in some environments
            if (is_array($_GET) AND count($_GET) == 1)
            {
                // Note: Due to a bug in current() that affects some versions
                // of PHP we can not pass function call directly into it
                $keys = array_keys($_GET);
                print_r($keys); die();
              
                if (in_array('debug_session_id', $keys)) {    // debug flag used by Zend Debugger
                    return '';
                } else {
                    return current($keys);
                }              
            }
      
            // Is there a PATH_INFO variable?
            // Note: some servers seem to have trouble with getenv() so we'll test it two ways      
            $path = (isset($_SERVER['PATH_INFO'])) ? $_SERVER['PATH_INFO'] : @getenv('PATH_INFO');  
            if ($path != '' AND $path != "/".SELF)
            {
                return $path;
            }
                  
            // No PATH_INFO?... What about QUERY_STRING?
            $path =  (isset($_SERVER['QUERY_STRING'])) ? $_SERVER['QUERY_STRING'] : @getenv('QUERY_STRING');  
            if ($path != '')
            {
                return $path;
            }
          
            // No QUERY_STRING?... Maybe the ORIG_PATH_INFO variable exists?
            $path = (isset($_SERVER['ORIG_PATH_INFO'])) ? $_SERVER['ORIG_PATH_INFO'] : @getenv('ORIG_PATH_INFO');  
            if ($path != '' AND $path != "/".SELF)
            {
                return $path;
            }

            // We've exhausted all our options...
            return '';
        }
        else
        {
            $uri = strtoupper($this->config->item('uri_protocol'));
          
            if ($uri == 'REQUEST_URI')
            {
                return $this->_parse_request_uri();
            }
          
            return (isset($_SERVER[$uri])) ? $_SERVER[$uri] : @getenv($uri);
        }
    }

8) Right-click on index.php file in Eclipse and choose "Debug as PHP Webpage"

9) Configure Debug Properties: (click on debug button and and select "Debug Dialog")
Make sure "Zend" is set as the server debugger
Set the URL to your homepage: (e.g. http://localhost/index.php)
Advanced: "Debug All Pages"
Leave "Break at first line"

10) Run through the debug once (it will give a 404 Not Found the first time), then open Firefox and launch your URL. This will automatically trigger the debugger in Eclipse and it should work from the browser. Use "Step Into" to watch CI work it's magic.


References:
1) PDT Wiki: Installing the Zend Debugger
http://www.thierryb.net/pdtwiki/index.ph...d_Debugger

2) CI: http://ellislab.com/forums/viewthread/59359/
http://ellislab.com/forums/viewthread/59944/

3) PDT Wiki: Source level debugging and Zend Firefox Extension
http://www.thierryb.net/pdtwiki/index.ph..._Debugging


Messages In This Thread
Using XDebug with CodeIgniter - by El Forum - 01-08-2008, 12:23 PM
Using XDebug with CodeIgniter - by El Forum - 01-08-2008, 02:06 PM
Using XDebug with CodeIgniter - by El Forum - 01-14-2008, 07:41 AM
Using XDebug with CodeIgniter - by El Forum - 01-14-2008, 09:19 AM
Using XDebug with CodeIgniter - by El Forum - 01-26-2009, 06:42 AM



Theme © iAndrew 2016 - Forum software by © MyBB