my6solutions

asp .net, the social web & other distractions

 

Running Apps


PayPal - The safer, easier way to pay online!

Disclaimer

I am in no way affiliated with Microsoft or Google. I am just another developer trying to make a difference. All opinions and observations are usually my own.

Debugging partuza with Zend Studio

When it comes to PHP, it's a different kind of magical beast compared to strongly-typed programming languages like C#. PHP is more like javascript than C#. While porting partuza to .NET, I thought I could live without needing to debug through PHP. In the end, I decided, it probably will be easier if I could debug it.

Initially, I tried PHPEclipse, which is a plugin for Eclipse. However, for the life of me, I can't seem to get debugging to work and there wasn't much documentation out there on this particular setup. There had to be faster way. In the end I decided to give Zend Studio a look see. With some help, I managed to get debugging to work and i thought the following may be useful for someone new to PHP. The following is based on my experience getting debugging to work with partuza under Windows Vista.

The setup

Software packages

  • WAMP 2.0 
  • Zend Studio for Eclipse

Procedure

  1. The initial configuration and setup for both partuza and shindig is based on these articles
  2. Create a new PHP project in Zend studio.
  3. Next go, File .. Import ... and select File System


    and import the partuza directory into the partuza project that was just created.



  4. Create a new PHP Web Page debug configuration as follows


  5. Before clicking ok, click on "Configure ... " and update the URL as follows


  6. Add a new file called dummy.php into /html directory in Zend Studio, the file should contain the following code

    <?php
    @ini_set('zend_monitor.enable', 0);
    if(@function_exists('output_cache_disable')) {
        @output_cache_disable();
    }
    if(isset($_GET['debugger_connect']) && $_GET['debugger_connect'] == 1) {
        if(function_exists('debugger_connect'))  {
            debugger_connect();
            exit();
        } else {
            echo "No connector is installed.";
        }
    }
    ?>





  7. Next php.ini will need to be modified. If you had followed the configuration steps in the article above, the php.ini will be located at http://www.chabotc.com/generic/setting-up-shindig-and-partuza-on-windows/. From WAMP, you can directly configure this php.ini. If you are not sure which php.ini you need to configure, create a php file called phpinfo.php under /html in your partuza directory (same directory with index.php, config.php etc), containing <?php phpinfo(); ?>.This will enable you to goto http://partuza/phpinfo.php and find out which php.ini is currently in use.


  8. Add the following to your php.ini
    zend_extension_ts="C:\Program Files\Zend\Zend Studio for Eclipse - 6.1.0\plugins\org.zend.php.debug.debugger.win32.x86_5.2.14.v20080602\resources\php5\ZendDebugger.dll"
    zend_debugger.allow_hosts=127.0.0.1/32,192.168.1.0/16
    zend_debugger.expose_remotely=always


    Update zend_extension_ts to point to the location of your ZendDebugger.dll and point the allow_hosts ip addresses to the ip address of the partuza server. Also the following options should be set to

    output_buffering = 0
    implicit_flush = On


  9. Next, Apache needs to be configured. Both httpd.conf and httpd-vhosts.conf are configured as follows

    httpd.conf (C:\wamp\bin\apache\apache2.2.8\conf)
    Update DocumentRoot and Directory to point to your Zend workspace where the partuza was created like shown below


    httpd-vhosts.conf (C:\wamp\bin\apache\apache2.2.8\conf\extra)
    Update the partuza virtual host configuration as shown below to update the DocumentRoot as well


  10. Restart your apache server.
  11. Go back to the debug configuration that was created earlier, click on "Test debugger" and it should give you "Success!".
  12. Hit "Debug" and the debugger should start and break in "index.php".
And that's it. Hopefully, I did not miss anything. :)


Bookmark and Share

Tags: , ,
Categories: OpenSocial | PHP
Permalink | Comments (1) | Post RSSRSS comment feed

Comments

Tony

Tuesday, April 07, 2009 1:18 AM

Tony

Just a note of thanks - I was struggling with getting the debugger to work, and it seems to be the need to put the DLL path in the php.ini file that I was missing.

I'm finding a lot of open source software seems not quite to install properly on its own, but at least you have a chance - because most of it is cross-platform, you don't end up with bits of essential configuration buried ten layers deep in the Windows registry.