FeaturesPluginsDocs & SupportCommunityPartners

Configuring PHP Development Environment in Mac OS X

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.

To have the Apache local web server, the PHP engine, and the MySQL database server installed and configured, use the XAMPP Mac OS X package.

Installing and Configuring XAMPP

  1. Download XAMPP Mac OS X 0.7.2.
  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. On the Select a Destination panel, choose Macintosh HD.
  5. On the Easy Install on "Macintosh HD" panel, click Install.
  6. On the Authenticate panel, enter your user name and password, then click OK.
  7. On 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. On 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 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

  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. To enable using 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.
  2. Run the XAMPP Control Panel and restart the Apache web server.
  3. Find more information on configuring XDebug here.
Find more information about installing and configuring XAMPP Mac OS X here.

Back to the PHP Learning Trail

Companion
Projects:
MySQL Database Server   Open JDK: an Open SourceJDK   GlassFish Community: an Open Source Application Server    Mobile & Embedded Community    Open Solaris   java.net - The Source for Java Technology Collaboration   Virtual Box - full virtualizer  Open ESB - The Open Enterprise Service Bus Powered by