corner imagecorner image
FeaturesPluginsDocs & SupportCommunityPartners

Configuring PHP Development Environment in Mac OS X

This tutorial shows you how to set up PHP on Mac OS X. For your convenience, the tutorial has you install the XAMPP AMP (Apache, MySQL, PHP) package, which includes a web server, a database server, and other utilities for developing in PHP.

Contents

Content on this page applies to NetBeans IDE 6.5

To follow this tutorial, you need the following software and resources.

Software or Resource Version Required
NetBeans IDE PHP download bundle 6.5
A PHP engine Version 5. Included in XAMPP Mac OS X.
A web server Apache HTTP Server 2.2 is recommended.
Included in XAMPP Mac OS X .
A database server MySQL Server 5.0 is recommended.
Included in XAMPP Mac OS X.
A PHP debugger (optional) XDebug 2.0 or later

Typically, development and debugging is performed on a local web server, while the production environment is located on a remote web server. Setting up a remote web server is described in Deploying a PHP Application on a Remote Web Server Using the NetBeans IDE. This tutorial has you set up a local web server. PHP support can be added to a number of local web servers (IIS, Xitami, and so on), but most commonly Apache HTTP Server is used. Apache HTTP server is included in the XAMPP AMP package used in this tutorial. For information on installing and configuring Apache HTTP server standalone, click here.

Installing and Configuring XAMPP

In this section you install and configure the XAMPP AMP (Apache, MySQL, PHP) package, which includes all the utilities you need to create PHP applications.

  1. Download the latest version of XAMPP Mac OS X .
  2. After the download is completed, run . dmg file. The Installer panel opens. Click the XAMPP for MacOS X.pkg icon. This starts the Install XAMPP for Mac OS X wizard.
  3. Click Continue on the Introduction page.
  4. In the Select a Destination panel, select Macintosh HD.
  5. In the Easy Install on "Macintosh HD" panel, click Install.
  6. In the Authenticate panel, enter your user name and password, then click OK.
  7. In the Finish Up panel, click Close.
  8. Locate the xampp application and run XAMPP Control Panel. In the Authenticate dialog box, enter your name and password, then click OK.
    Mac OS X applications
  9. In the XAMPP Control Panel, click the Start button next to Apache, to start Apache HTTP server.
    XAMPP Mac OS X Control Panel
  10. To start the MySQL database server, click Start next to MYSQL.
  11. To check the active PHP engine version, click PHP version. The PHP version tab opens.

Checking XAMPP Installation

After you install XAMPP, check that all its components are installed and configured correctly.

  1. Run your browser and enter the following URL: http://localhost. The XAMPP for MacOS X welcome page opens:
    XAMPP Welcome Page indicates that Apache is runnning
  2. To check that PHP and MySQL are running, click phpMyAdmin on the left-hand panel menu on the XAMPP welcome page. The phpMyAdmin page opens:
    The page shows that phpMyAdmin is running

Installing and Enabling the XDebug Debugger

Because XAMPP does not contain the XDebug debugger, you need to install and set up the XDebug as a component.

  1. Download and compile XDebug source files. The download link for source files is listed under Releases.
  2. Install XDebug into the ../xampplite/php/ folder.
  3. Because Zend optimizer blocks XDebug, you need to disable Zend optimizer first. In the ../xampplite/php/php.ini file, locate the relevant lines and remove them or mark as comments.
  4. Run the XAMPP Control Panel and restart the Apache web server.
  5. Find more information on configuring XDebug here.


Find more information about installing and configuring XAMPP Mac OS X here.

To send comments and suggestions, get support, and keep informed on the latest developments on the NetBeans IDE PHP development features, join the mailing list.

Back to the PHP Learning Trail

Companion
Projects:
MySQL Database Server   GlassFish Community: an Open Source Application Server   Open Solaris  Open JDK: an Open SourceJDK   Mobile & Embedded Community     Sponsored by 
Sponsored by Sun Microsystems