0

Configure Netbeans to Debug PHP Web Applications

Figuring out how to configure NetBeans, xdebug, PHP, and Apache to enable debugging did not come by easily despite the myriad references available online. However, most (if not all)  of them are outdated, and inaccurate. As a result, they tend to obscure a rather simple configuration or how-to.

Software Applications Used

  1. WinXPSP3 on a virtual machine (e.g., virtualbox)
  2. XAMPP 1.7.7
  3. Microsoft Visual C++ 2008 Redistributable
  4. Netbeans-7.0.1 For PHP
  5. Jdk 1.6 update 21

Install XAMPP, C++ binaries, JDK1.6u21, and Netbeans 7.

Step 1 – Configure PHP and start Apache

Add the following line  in php.ini:

 Step 2 – Create a PHP project in Netbeans

20111222-netbeans-create_proj1

Step 1 – Choose PHP Application

20111222-netbeans-create_proj2

Step 2 – Choose PHP5.3

20111222-netbeans-create_proj3

Step 3 – Local Web Server refers to our installed Apache

20111222-netbeans-create_proj4

We will use just one PHP page

 

Step 3 – Put some codes in index.php and place some breakpoints

20111222-netbeans-php5-inter1

Some PHP Codes

Step 4 – Test the code

20111222-netbeans-php5-inter2

Test Sample Codes

Step 5 – Configure NetBeans

20111222-netbeans-php5-inter3

Configure NetBeans

Step 6 – Debug Code

20111222-netbeans-php5-inter4

Debug some codes