Configuring PHP Development Environment in Windows
Contributed by Barbara Mityashina
June 27, 2008
Contents
Required Software
To create, run, and debug your PHP projects you need the following software:
- The NetBeans IDE for PHP. Downloads are available here.
- A web server. Typically development and debugging is performed on a local web server, while the production environment is located on a remote web server. The current version enables using a local server. Using a remote server with FTP access will be supported in future versions. PHP support can be added to a number of web servers (IIS, Xitami, and so on), but most commonly Apache HTTP Server is used. Click here for information on how to install and configure Apache 2.2.
- The PHP engine. The supported version is PHP5. Downloads are available here.
- The PHP debugger. The NetBeans IDE for PHP allows you to use XDebug, but using a debugger is optional. The recommended version is XDebug 2.0 as it is compatible with PHP5.
- A database server. You can use various database servers while one of the most popular ones is the MySQL server. Downloads are available here.
Note: The recommended version of the product is MySQL Server 5.0. The provided documents describe the work with this version.
After the installation, you need to set up the environment that all the software components work properly with each other.
You can use an Package, that contains the required software, or install each component separately.
Using an AMP Package
To have all the configuration settings for the PHP engine, the Apache HTTP Server, and the MySQL database server specified automatically, use the WAMP or XAMPP-Windows package.
Installing and Configuring the XAMPP Package
The section describes how to download, install, and configure the XAMPP Lite package.
- Download the XAMPP Lite package.
- When the download is completed, run the file xampplite-win32-1.6.6a.exe.
- On the 7-Zip self-extracting archive panel, specify the XAMPP location in the Extract to edit box. Use the Browse button, if necessary. Then click Extract. This instruction suggests the C:/ root directory as the XAMPP location. You can choose any other folder and adjust your further steps accordingly.

The installer creates a subfolder xampplite at the specified location.
- After the archive is extracted, run the file setup-xampp.bat to configure the components of the package. The following message informs you that configuration has passed successfully:

- Run the file C:\xampplite\xampp-control.exe. The XAMPP Control Panel appears.
- To have the Apache server and the MySQL database server started upon the system startup, install the as services by switching on the Svc checkboxes next to them. Then click OK in the XAMPP Control dialog box that opens.
- To start the Apache HTTP server, click Start.
- To start the MySQL database server, click Start.
The Apache and MySQL servers are running.
- Click Exit to exit the XAMPP Control Panel.
Checking XAMPP Installation
- Run your browser and enter the following URL: http://localhost. The XAMPP welcome page opens:
- To ensure that the Apache and MySQL servers have been installed as system services, restart your operating system, run the browser, and enter the http://localhost URL again. The XAMPP welcome page opens.
Installing and Enabling the XDebug Debugger
Because XAMPP Lite does not contain the XDebug debugger, you need to install and set up the XDebug as a component.
- Download XDebug 2.0.
- To enable using XDebug, you need to disable Zend optimizer. In the ../xampplite/php/php.ini file, ocate the following lines and delete them or mark as comments:
[Zend]
;zend_extension_ts = "C:\Program Files\xampplite\php\zendOptimizer\lib\ZendExtensionManager.dll"
;zend_extension_manager.optimizer_ts = "C:\Program Files\xampplite\php\zendOptimizer\lib\Optimizer"
;zend_optimizer.enable_loader = 0
;zend_optimizer.optimization_level=15
;zend_optimizer.license_path =
- To attach XDebug to the PHP engine, add the following lines to the php.ini file:
zend_extension_ts="c:/xdebug/php_xdebug-2.0.2-5.2.5.dll"
xdebug.remote_enable=1
Note: Make sure the paths you specify match the location of the corresponding files as determined during your installation.
- Run the XAMPP Control Panel Application and restart the Apache server.
Click
here for more information on how to configure XDebug.
Installing the Components Separately
Apache HTTP Server
- Download the Apache2 HTTP server.
- Run the installation file .msi. The installation wizard starts. Follow the instructions.
- When the installation is completed, restart the Apache server.
- To check that the installation is successful, run the browser and enter the following URL:
http://localhost/
The Apache welcome test page opens:
Troubleshooting
By default, the Apache server listens to port 80. This port can be already used by other services, for example Skype. To solve the issue, change the port which the server listens to:
- Open the Apache web server configuration file httpd.conf. By default the file is located in C:\Program Files\Apache Software Foundation\Apache<version>\conf\
- Locate the line Listen 80 and change the port number, for example 8080. Save the file.
- Restart the Apache web server.
- To check that the web server works, run the browser and enter the URL and specify the port number explicitly:
http://localhost:8080
You can also stop the processes that possibly listen to port 80. In the Task Manager, select the relevant file name and click End Process.
Find more information on installing and configuring the server here.
PHP Engine
- Download the PHP5 engine.
- When the download is complete, run the .msi installation file. The installation wizard starts.
- On the Apache Configuration Directory panel, specify the directory where the httpd.conf file is located, the default setting is C:\Program Files\Apache Software Foundation\Apache<version>\conf\. The PHP processing will be enabled automatically.
- If you want to use the MySQL database server, choose the Complete installation option or select the MySQL and MySQLi items in the Extensions list.
- After the installation is completed, restart the Apache server.
- To check that the PHP engine has been installed successfully and PHP processing has been enabled in the Apache configuration:
Troubleshooting
If the page does not open:
- Restart the Apache server.
- Check that the Apache server configuration file httpd.conf contains the following lines:
AddType Application/x-httpd-php .php
LoadModule php5_module “c:/php/sapi/php5apache2_2.dll”
- If the lines are missing, add them, save httpd.conf, and restart Apache.
- Refresh the http://localhost:<port>/test.php page.
MySQL Database Server
Find detailed information on installing and configuring the MySQL database server.
XDebug
Download XDebug 2.0.
Setting Up the Environment
- If your installation follows the default settings, the PHP processing will be enabled automatically.
- To attach XDebug to the PHP engine, locate the php.ini file and add the following lines to it :
zend_extension_ts="c:/xdebug/php_xdebug-2.0.2-5.2.5.dll"
xdebug.remote_enable=1
Click here for more information on how to configure XDebug.
Note: Make sure the paths you specify match the location of the corresponding files as determined during your installation.
- To be sure that previously installed PHP engine supports using the MySQL database server:
- Click Start > Control Panel.
- On the Control Panel, choose Add or Remove Programs.
- On the Add or Remove Programs panel, select the PHP <version number> area and click Change. The PHP Setup Wizard starts. Click Next.
- On the Change, repair or remove installation panel, choose Change and click Next.
- On the Web Server Setup panel, choose the version of the Apache server - in our example it is Apache 2.2.x Module. Click Next.
- On the Apache Configuration Directory panel, specify the directory where the Apache configuration file httpd.conf is located. Click Next.
- On the Choose Items to Install panel, expand the Extensions node and choose the MySQL and MySQLi items. Click Next.
- On the Ready to change PHP <version number> panel, click Change.
- On the Completed the PHP <version number> Setup Wizard panel, click Finish.
Back to the PHP Learning Trail