This document provides instructions on how to configure a NetBeans PHP project for WordPress. Such a project can be useful to developers who develop WordPress or its extensions, or to those who want to debug or just inspect the WordPress code.

Note: The scenario described in this document assumes that all resources -- web server, database, PHP sources -- are available on a local development machine. The project configuration might be different in the case of a remote development.

Getting WordPress sources

The WordPress sources are available at Just point your browser to and download the latest available version (v2.6 as of this writing).

Download the .zip or .tar.gz bundle and unpack it somewhere (e.g. /home/<yourname>/sources/). The sources will be extracted into the wordpress subdirectory.

Installing NetBeans

Download and install NetBeans IDE 6.5 for PHP. You can get the latest development build from

or use the Beta (Milestone 2) when it becomes available.

Download the .zip or .tar.gz bundle and unpack it on your drive (e.g. /home/<yourname>/sources/).

Configuring the Web Server and PHP

Make sure you have Apache web server installed and running on your system. You'll also need to configure the PHP runtime and the XDebug extension. The configuration steps will vary depending on your development platform. Please refer to the Configuring Your Environment for PHP Development section of the PHP Learning Trail.

Configuring MySQL

Make sure you have the MySQL server installed and running on your system. If you don't have it yet, please refer to the MySQL web site for detailed information on how to get and set up the database server on your development platform.

Once you have the server running, you will need to create a database for WordPress. You will also have to create a user that can create tables, and insert and select data in that database:

    CREATE DATABASE wordpress;
    GRANT ALL ON wordpress.* TO 'wordpress'@'localhost' IDENTIFIED by 'secret';

In this example, we created a database called wordpress and a user called wordpress with secret as the password. You are free to choose different names and password for your project.

Setting Up a Project in NetBeans

Now you should have everything ready and set up create a WordPress project in NetBeans.

  • Start NetBeans. When the IDE comes up, create a new PHP project (File | New Project -> PHP; PHP Application with Existing Sources).

}}center Image:new-php-project-step-0_ConfiguringNetBeansProjectForWordPress.png }}

  • Click Next.
  • In the Sources Folder field, enter or select the directory where you previously extracted the WordPress sources (/home/honza/sources/wordpress).
  • Choose a project name (WordPress).
  • We don't want to mix the original source files with project meta data created by NetBeans, so select the Put NetBeans metadata into a separate folder option and enter the path to that folder (/home/honza/NetBeansProjects/WordPress).

}}center Image:new-php-project-step-1_ConfiguringNetBeansProjectForWordPress.png }}

  • Click Next.
  • In the Run Configuration step, select 'Run As Local Web Site'
  • Enter the URL to open the main WordPress page in the browser (http://localhost/blog/).
  • We also want to copy the files to the location under the local web server's document root. Select the 'Copy files' check box and enter to root directory of the WordPress application. (Note: In this example, the local document root is /home/honza/www/ and the WordPress files are to be copied to /home/honza/www/blog. Make sure to set use the web root path that matches your environment.)

}}center Image:new-php-project-step-2_ConfiguringNetBeansProjectForWordPress.png }}

Completing the WordPress Installation

  • In NetBeans' Projects view, expand the Source Files folder, find the wp-config-sample.php file, create its copy in the same folder (right-click | Copy, right-click | Paste), and rename it to wp-config.php.
  • Open the wp-config.php file in the NetBeans editor.
  • You should see a file with several PHP constants.

}}center Image:wp-config-in-netbeans-crop_ConfiguringNetBeansProjectForWordPress.png }}

  • You need to modify some of the constants to match your system and project setup. At the least, you'll need to customize the values of the following constants:
    define('DB_NAME', 'wordpress');     // The name of the database
    define('DB_USER', 'wordpress');     // Your MySQL username
    define('DB_PASSWORD', 'secret');    // ...and password

Use the database name, user name and password that you selected in one of the previous steps.

  • You should also follow the guidelines in wp-config.php and enter unique phrases for AUTH_KEY, SECURE_AUTH_KEY and LOGGED_IN_KEY.
  • Save the file (Ctrl+S) and Run the WordPress project (F6, or select Run in the project's context menu), the WordPress installation page should appear in your web browser:

}}center Image:wp-properties-crop_ConfiguringNetBeansProjectForWordPress.png }}

  • Choose the title for your blog and enter your email address. Click the Install WordPress button.
  • An admin password will be generated for you, note it somewhere.
  • Navigate to your blog URL. You should see something like this:

}}center Image:blog-title-page-crop_ConfiguringNetBeansProjectForWordPress.png }} Now the blog setup has been completed. To change your Admin password, click on the Site Admin link, log in using the password generated in the previous step, and then follow the Users in the upper right corner of the page. Change the properties of the admin user.

Now you can start experimenting with the project in NetBeans. You can inspect WordPress code, step through it in the NetBeans debugger, make changes, or start developing your own WordPress extensions or themes.

Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo