The following are instructions for setting up a development environment on a Mac that can be used for HTML, PHP and MySQL.

1. Install NetBeans
NetBeans is the IDE used for programming.
Install NetBeans for HTML5 & PHP from this link:

2. Install MySQL & MySQL Workbench
MYSQL is used for databases.
Follow the tutorial at this link:

Install MySQL on OS X 10.9 Mavericks.

Install Workbench from this link:

3. Activate the built-in Apache Server on the Mac
Apache will provide a local server we can use to test websites.
Follow the tutorial at this link:

Test that Apache is properly installed by navigating to “localhost” in Safari
The root of the Apache Web Server folder is: /Library/WebServer/Documents
Change the permissions on the above mentioned Documents folder by right clicking on it, then click Get Info, then in the opened dialog box: click on the icon of a lock and input password, then under the Sharing & Permissions tab at the bottom, provide Read & Write Privileges to everyone who appears in the box.

4. Enable PHP in the built-in Apache
PHP is needed to test PHP functionality in the web pages
Follow the tutorial at this link:

Restart Apache server in terminal using:
sudo apachectl restart
Test that the PHP server is functional by:
1. Navigate to /Library/WebServer/Documents
2. Copy the attached “index.php” file to this folder
3. In your web browser, navigate to: localhost/index.php
4. If you see a phpInfo page, then PHP is functional

5. Installing Xdebug
XDebug is needed to debug issues with code
XDebug is already installed in the computer, you simply need to enable it. To do that:
In Finder, in the top menu bar, click on the menu header: “Go”. From the drop down list, select: “Go to Folder”
In the dialog box that appears, enter: “/private/etc/“ (without quotes)
In that folder, open php.ini with Text Edit
Copy and paste the following lines of code to the end of the file


Now, test if Xdebug is working:
Restart Apache server using terminal:
sudo apachectl restart
In Safari, navigate to “localhost/index.php”, (as done in Step 4)
Scroll through the page and search for “xdebug”
If you find it, that is a good sign. Next, we are going to verify that Xdebug was installed properly.
Using Command+A, select everything on the page (all the text and images); (see “Select All Screenshot” for a visual)
Copy everything by using Command+C
Navigate to:
Click inside the large white box in the page, and paste using Command+V; (see “Paste Screenshot” for a visual)
Click the “Analyse my phpinfo() output” button
If XDebug installed provides a version number, it works!

6. Running a test page on NetBeans
Now, test if Xdebug is working with NetBeans:
Open NetBeans
Go to: NetBeans>Preferences in the top menu bar
Check that the Web Browser:
Under the PHP Tab, then the General tab:
Php 5 Interpreter should be: /usr/bin/php
Click okay. Preferences are complete. Now create a new project:
Go to File>New Project
Create a PHP Application Project
Click Next
Project Name: test
Sources Folder: /Library/Webserver/Documents/test
Click Next
Run As: Local Web Site (running on local web server)
Click Next and Finish
Paste the following code into the index.php page:


In the code, next to the line “echo phpinfo(); there is a number 3. Click on that number to set a break point for debugging. This will replace the number 3 with a red square.
Save the project
Right click on the project in the “Project” Section on the left and click “Debug”
If you see content under the Variables, Call Stack and Breakpoints tab, then it worked.
Your development environment is now complete.

7. Good to know
httpd.conf: /private/etc/apache2/httpd.conf
php.ini: /private/etc
xdebug.os: /usr/lib/php/extensions/no-debug-non-zts-20100525/
Root dir of Apache: /Library/WebServer/Documents
Apache Server Terminal Commands:
sudo apachectl start
sudo apachectl stop
sudo apachectl restart

facebook linkedin