SitePoint Sponsor

User Tag List

Results 1 to 20 of 20
  1. #1
    SitePoint Enthusiast
    Join Date
    Jul 2002
    Location
    Denmark
    Posts
    89
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    PHP testing and debugging tool?

    This must be the right place to get advice on this:

    Can you recommend some good PHP testing and debugging software. Maybe something I can run on my local PC. Some kind of tool that will let you visually trace variables and emulate web server and database functions maybe..

    I'm a little new to PHP so excuse me if I'm stumbling over my terms above.

    Thanks in advance..

  2. #2
    SitePoint Addict Phidev's Avatar
    Join Date
    Oct 2008
    Location
    Texas
    Posts
    204
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Usually what I do is that I set up a apache in my workstation to emulate our production server. Then I create vhosts with a non-standard tld, and use eclipse with aptana. I still need to go back and forth between eclipse and my browser but it is much faster and easier than uploading files to a server.

  3. #3
    SitePoint Enthusiast
    Join Date
    Jul 2002
    Location
    Denmark
    Posts
    89
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok - please let me ask a few newbie add-on quesitons since there are a few new terms to me here.

    1. Setting up the Apache server. This requires a linux server installation I guess? Or can I get this running on my WinXP PC? I have an ubuntu partition if that helps |

    2. "vhosts with a non-standard tld, and use eclipse with aptana" ...wow... I'm lost I don't expect you to explain me the basics for me to understand this but maybe quick clue?

    Thanks
    nordal.

  4. #4
    SitePoint Addict Phidev's Avatar
    Join Date
    Oct 2008
    Location
    Texas
    Posts
    204
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You can install apache in a windows machine as far as I am concerned.
    (I haven't used a windows machine in a few years).

    vhosts or virtual hosts is an apache option where you can tell the server it will be hosting more than one domain.


    tld or top level domain is the last part of a domain (usually com)

    so lets assume that I will be working on a site named phidev.com, what I do is that I set a virtual host in my machine named phidev.dev (short for development). This way when I go to my browser and look for phidev.dev, it will render the version in my computer.

    For more information about aptana go to aptana.com. I would recommend the plug-in version rather than the stand alone.

  5. #5
    SitePoint Enthusiast
    Join Date
    Jul 2002
    Location
    Denmark
    Posts
    89
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok that helped a lot - thanks

    So you don't actually any debugging tool? I would like something where I could track which variables get which value and see how "it" jumps around in the IF and WHILE loops etc. My problem is I have to debug a (for me complicated) PHP script that I didn't write and keeping track of all these loops, sessions, variables etc in my head doesn't work out well..

    Suggestions?

  6. #6
    SitePoint Wizard
    Join Date
    Mar 2008
    Posts
    1,149
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    There are two: Xdebug and Zend Debugger. I use Zend Debugger, only because Zend Studio is configured for it by default, and because Xdebug kept crashing Apache children 1/5th of the time (that's just my own situation, of course).

    Edit:

    Oh, and dbg.

  7. #7
    SitePoint Wizard bronze trophy
    Join Date
    Jul 2008
    Posts
    5,757
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Some php IDE's support debugging like you want by using xdebug, zend debugger, or dbg.

    netbeans
    phped
    eclipse
    zend studio
    php designer

    are some of them off the top of my head.

  8. #8
    SitePoint Enthusiast
    Join Date
    Apr 2006
    Posts
    73
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I was introduced to Aptana today by a colleague. It's outrageously good, free software for development and debugging.

  9. #9
    SitePoint Evangelist
    Join Date
    Jun 2007
    Posts
    487
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    We are using netbeans for debugging and I think it helps a lot!

  10. #10
    SitePoint Enthusiast
    Join Date
    Jul 2002
    Location
    Denmark
    Posts
    89
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok, several suggestions. I will start looking into them..

    Thanks guys!

  11. #11
    SitePoint Wizard
    Join Date
    Dec 2004
    Location
    At My Desk!!
    Posts
    1,642
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    There is also an addon for Firebug in Firefox called PHPBug, this is great but requires you to add some simple code to your site to use it.
    "Am I the only one doing ASP.NET in Delphi(Pascal)?"

  12. #12
    SitePoint Enthusiast
    Join Date
    Jul 2002
    Location
    Denmark
    Posts
    89
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sounds interesting - i'll check it out.

    Thanks!

  13. #13
    SitePoint Zealot
    Join Date
    Jul 2007
    Location
    Macomb, MI USA
    Posts
    138
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    We use PHPUnit extensively to make sure "the parts" are functioning as expected. This doesn't check the code itself, but allows you to write tests to ensure the data you are expecting is as it should be.

    Thus, if you wrote a series of tests for your application a few months ago of which passed, and run those same tests after performing some code modifications / additions, any errors would be easily identified.

    At the application / User Interface level, Selenium has been the going preference. This makes sure the rendering / display layer of your application is behaving as it should.

    The key to both of the above is that the processes are automated greatly reducing the time required to complete a QA pass.
    inClick Ad Server - Start Your Own Performance Based Ad Network
    Key Features | Download inClick Now | Free Ad Server Hosting Offer

  14. #14
    SitePoint Member
    Join Date
    Sep 2009
    Posts
    14
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think that it also worth to try WampServer. This software will help you to set up local test environment faster: Apache, PHP, MySQL.

  15. #15
    SitePoint Evangelist artcoder's Avatar
    Join Date
    Aug 2005
    Location
    Planet Earth
    Posts
    599
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I like to duplicate (clone) the PHP application on my own shared webhost account (in sub-domain and/or password protected if needed), so that it can mess with the code instead of messing with the code on client's host or production.

    For some reason, I don't like to run PHP applications locally (hassel to set up and clone client application correctly) and I think sometimes it does not simulate a webhost environment exactly.

    Being that I debugging on the actually webhost instead of locally, it don't use any debugging packages. I simply insert print_r statement in the relevant pieces of code or print debugging info to logs. Am I old school?

  16. #16
    SitePoint Member
    Join Date
    Aug 2009
    Posts
    23
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by artcoder View Post
    Being that I debugging on the actually webhost instead of locally, it don't use any debugging packages. I simply insert print_r statement in the relevant pieces of code or print debugging info to logs. Am I old school?
    When speed matters, tools with debugging options put you on the fast track. That's about it.

    I remember how much difference it made to the speed of my Java coding once I started using Eclipse's debugging options properly.

  17. #17
    SitePoint Enthusiast
    Join Date
    Jul 2002
    Location
    Denmark
    Posts
    89
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I have also been using some print, echo and "or die (Error description)" tricks, but in my current case I have some code that is not exactly doing any php errors but more application errors (according to what it was expected to do). Apart from that the code is really complicated to follow so I need a visual tool to see what happens..

    But many great suggestions here. I guess I will just start from an end

    Thanks a lot!

  18. #18
    SitePoint Enthusiast JoebeeKenobi's Avatar
    Join Date
    May 2009
    Location
    UK
    Posts
    48
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by artcoder View Post
    Am I old school?
    If you are old school then I am too

    I do think it depends on code complexity though... I've always uploaded to a test directory on my web server and work through it till I'm happy its working as I expect... then I push it out to my team of testers who will then give it a once over and report back. Having an FTP connection open as I update means I've always found it to be pretty fast to upload, test, tweak, upload, test again until I'm happy.

    Until recently I hadn't had to work on a real head-banging piece of code and theres certainly some tools mentioned here that I might look into as a result.

    Joe

  19. #19
    SitePoint Zealot
    Join Date
    Jul 2007
    Location
    Macomb, MI USA
    Posts
    138
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I would have to agree. If the code / project you are working on is small and will stay small, it may make more sense to simply deploy into a "sandbox" and cycle through a code-and-test model. However, once you start getting into a larger project, this methodology will suck up much more time.

    If you are writing code or a project that you are expecting to get large, getting automated tests in place early on will save a lot of time down the road. Imagine if a year from now you need to modify a widget or object you created today to make it faster. A small bug in that object could cascade into a number of new "bugs" that may not really be bugs, but results of the change in that earlier object you modified. With automated tests in place, you would be able to identify the root bug easily and not spin your wheels wasting time with its side effects.

    -Bing
    inClick Ad Server - Start Your Own Performance Based Ad Network
    Key Features | Download inClick Now | Free Ad Server Hosting Offer

  20. #20
    SitePoint Member
    Join Date
    Oct 2008
    Location
    Rotonda West, Florida
    Posts
    13
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I have used MS Expression Web 2 to develop PHP pages. It's intelesense feature will help with PHP coding and you can test it locally using any browser that you have installed. It does not, however, have any debugging capability. You may have to resort to metering your code with echo statements which you can remove after you have figured out what is going on.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •