Join Jon Peck for an in-depth discussion in this video Using the exercise files, part of Debugging PHP: Advanced Techniques.
In this course I'll be developing in a Sandbox PHP environment. The recommended configuration for the host environment is PHP 5.3 or above and Apache 2 or above. Other Web servers such as Nginx or IIS will not be covered in this course. Setting up a Web server stack is beyond the scope of this course. If you do not already have a development server, I recommend using a local development server running on your workstation. The Up and Running with Linux for PHP Developers course here in the lynda.com Online Training Library will allow you to have an optimized virtual server running like any other program in your existing operating system.
I will be demonstrating using a server created using this technique. Alternatively, you can use a Web server solution stack package in your native operating system. XAMPP from apachefriends.org has distributions for Linux, Windows, Mac OS X, and Solaris. WampServer from wampserver.com is explicitly for Windows and MAMP from mamp.info is for Mac OS X only. Each of these packages will allow you to execute the exercise files found in this course. Installing additional software within your native operating system is covered in the course, Installing Apache, MySQL and PHP with David Gassner, here in the lynda.com Online Training Library.
Regardless of the location of your Web server, you will need access to the commands line with administrative credentials in order to install and configure server software. For Mac and Linux, the terminal allows you to access the command line, which includes access to the SSH command if the site is hosted remotely. For Windows, you can use the free program PuTTY, to connect via SSH to remote servers available from the official PuTTY website. I will be demonstrating writing code and debugging interactions using the NetBeans 7.2 IDE bundle for PHP.
NetBeans is a free, open-source and cross-platform integrated development environment from netbeans.org that also supports the Xdebug PHP extension. The goal of the course is to teach debugging techniques, not how to use NetBeans. I recognize that different IDEs implement Xdebug interactions in different ways, but the base principles remain constant across some implementations. The exercise files for this course are contained in folders by chapter and movie. On my workstation, I have them in a folder named sandbox that my virtualized Linux server can access.
Depending on your web server configuration, you may need to store these files in a different place, such as a remote Web server or in a folder accessible by a local Apache and PHP stack. Included in the exercise files are a number of free PHP libraries, including ChromePHP, FirePHPCore, PHP_Debug and Webgrind. No configuration is necessary and usage will be described during the course. A final note, as different Web hosts and configurations serve content from different URLs, the address you see in my browser may not exactly match what you see on your workstation.
Additionally, the location shown in the command prompt demonstrations will differ depending on the location of site files and the configuration of your server. The software configuration will be very similar, if not identical across platforms.
This course covers installation of Xdebug on Apache as well as working with the NetBeans IDE (integrated development environment). Jon then introduces native web browser developer tools for Firefox and Chrome, and demonstrates browser independent web debugging tools. Best practices for debugging and profiling web application failures and performance issues are also covered.
- Configuring PHP error reporting
- Logging errors to file
- Gracefully handling fatal errors
- Installing Xdebug
- Understanding the principles of remote debugging
- Remote debugging with NetBeans
- Extending your browser with Firebug, FirePHP, or ChromePHP