Tag Archives: Open Source

How to Setup the LAMP Stack on Mac OS X

Install Apache MySQL, & PHP on Mac OS X Yosemite

Setup LAMP on Mac OSX

LAMP is an acronym for Linux, Apache HTTP Server, MySQL relational database management system, and PHP server-side programming language.   This web service solution stack is a model for building dynamic web applications and web services.  Web developers can now implement this model on their Mac OS X Yosemite computers to support the development of web-based applications and web services.

Please use caution when installing new software on computer systems. A Best Practice includes creating system backups before changes.

How to Enable Apache Web Server on Mac OS X

The Apache HTTP Server Project is an effort to develop and maintain an open-source HTTP server for modern operating systems.

Apache Web Server is already included with Mac OS X Yosemmite.  This server can be started with the following steps.

Open a terminal window and log in as the root user:
$ sudo su –
(enter root password at the prompt)

Start Apache with the following command:
$ apachectl start

Verify the Apache Web Server is running on your Mac OS X by opening a web browser and navigating to http://localhost

 How to Enable PHP for Apache

PHP is a popular server-side scripting language designed for  web development.

Enabling PHP for the web server on Mac OS X requires an edit of the Apache configuration file.  A copy of the current version of this configuration file can be saved before the edit by running the following command in the terminal.

$ cp /etc/apache2/httpd.conf  /etc/apache2/httpd.conf.bak

The Apache configuration file can be edited by running the following command in the terminal.

$ vi /etc/apache2/httpd.conf

This will open the configuration file in the terminal window.  Edit this file by pressing “i” key.  Enable PHP for Apache by uncommenting (remove #) the following line.

Enable Virtual Hosting by uncommenting the following line.

Enable Mod Rewrite by uncommenting the following line.

Save and close this configuration file by pressing the “escape” key, then entering the following command.

$ :wq

How to Create Virtual Hosts in Apache

The term Virtual Host refers to the practice of running more than one web site on a single machine.  We enabled virtual hosting by allowing Apache to load the httpd-vhosts.conf file in the previous step of editing the httpd.conf file by uncommenting the following line.  Include /private/etc/apache2/extra/httpd-vhosts.conf

How to Define a Virtual Host in Apache

The site we are creating in the example is “mobile” with “dev” as the top-level domain (TLD).  This will give us http://mobile.dev as the URL.  I use “dev” as the TLD to help me remember the site is running on my local development environment, but you can use any value for the TLD.  You can also use any value for the site.  The next few steps will also include defining a local project directory for your new web project.  You can change these values to match your needs, just make sure your values match the values you define in the Virtual Host entry in Apache.

NOTE: If you plan on accessing your virtual host with a mobile device, then do not use “local” as your TLD.

Create a folder on your local file system for the DocumentRoot of your new site.


Create a backup of the httpd-vhosts.conf file by running the following command.

$ cp /etc/apache2/extra/httpd-vhosts.conf /etc/apache2/extra/httpd-vhosts.conf.bak

Edit the httpd-vhosts.conf file with the following command.

$ vi /etc/apache2/extra/httpd-vhosts.conf

Add the following markup to the httpd-vhosts.conf file.

Note how the <Directory> definition is slightly different for Apache 2.4. This Apache 2.4 configuration will prevent the Forbidden error that is accompanied by the Apache error message, “You don’t have permission to access / on this server.”

This next step assumes the owner defined in Apache config is _www. Replace “_www” with the name of Apache Server owner. Open a Terminal Window and navigate to the parent folder of the new site directory, then enter the following commands:
# Move into the new site directory
$ cd /1/projects/mobile/www/
# Change ownership of all files to the Apache Server process owner
$ sudo chown -R :_www DocumentRoot
# Change permissions of all site files
$ sudo chmod -R g+w DocumentRoot

 How to Define Virtual DNS

In order to access your new site by name, you will need to edit your system’s hosts file.
# Open /etc/hosts file
$ vi /etc/hosts
# Add the following line towards the bottom of the /etc/hosts file. mobile.dev
# Save and close file, then flush the DNS with the following command:
$ discoveryutil udnsflushcaches
# Restart Apache
$ apachectl restart

How to Create a PHP Test Page

The PHP test page for your new site can be created with the following commands.
# Create file
$ vi /1/projects/mobile/www/DocumentRoot/php.php
# Press the “i” key to edit this new file and enter

# Press the escape key to exit editing mode, then save file
$ :wq
# Open a web browser and go to the following URL


How to Install MySQL on Mac

MySQL is the world’s most popular open source database.

  1. Download the MySQL DMG for Mac OS X here.
  2. Install MySQL
  3. Install Preference Pane
  4. Start MySQL from Mac System Preferences Panel

Add MySQL to System PATH with the following commands.
# Modify/Create the .bash_profile file
$ touch ~/.bash_profile
$ vi ~/.bash_profile
# Add the following line to the bottom of ~/.bash_profile
export PATH=”/usr/local/mysql/bin:$PATH”
# Activate ~/.bash_profile update
$ source ~/.bash_profile
$ echo “/usr/local/mysql/bin” >> /etc/paths.d/mysql.path

Connect PHP and MySQL
$ cd /var
$ mkdir mysql
$ cd mysql
$ ln -s /tmp/mysql.sock mysql.sock

How to Install phpMyAdmin

phpMyAdmin is a free software tool written in PHP, intended to handle the administration of MySQL over the Web.  Download phpMyAdmin here.

Download phpMyAdmin to the system’s default web directory, “/Library/WebServer/Documents/”; then run the following commands from the Terminal Window.

# Move into default web directory
$ cd /Library/WebServer/Documents/
# Unpack phpMyAdmin download
# NOTE: Use actual phpMyAdmin download file name
$ tar -xvf ~/Downloads/phpMyAdmin-
# Rename unpacked phpMyAdmin folder
# NOTE: Use actual phpMyAdmin download folder name
$ mv phpMyAdmin- phpmyadmin
# Move into the new phpmyadmin directory
$ cd phpmyadmin
# Create the phpmyadmin config file
$ mv config.sample.inc.php config.inc.php

Launch the phpmyadmin dashboard by opening a web browser and navigating to the following URL: http://localhost/phpmyadmin

How to Start the Virtual Environment

This Mac OS X Apache MySQL PHP development environment can be started with the following steps.

# Make sure the MySQL database is running
Open MySQL Panel from Mac OS X System Preferences
# Open Terminal and switch to root user
$ sudo su –
# Use Terminal Command to start Apache
$ apachectl restart
# Use a Web Browser and Navigate to Website

How to Create Additional Virtual Environments

Additional virtual environments can be easily be created by just repeating the steps outlined in “How to Define a Virtual Host in Apache” section of this tutorial.


Following these steps provides the web developer with a development environment for creating web applications and web services using open-source technology.

How to Install Apache Tomcat Web App Server in 10 Minutes

How to Install Apache Tomcat on Mac OS X Snow Leopard

This tutorial will guide the user through the steps of installing Apache Tomcat on Mac OS X.

Prepare the Mac OS X to use the cURL command as Wget : Open a Terminal Window (Applications -> Utilities -> Terminal) and add wget as an alias for curl to the bash_profile file with the following command. Close the Terminal Window when complete.

Apache Tomcat Web App Server

Apache Tomcat is developed in an open and participatory environment and released under the Apache License version 2. Apache Tomcat is intended to be a collaboration of the best-of-breed developers from around the world. There is an open invitation to participate in this open development project. To learn more about getting involved, click here.

Apache Tomcat powers numerous large-scale, mission-critical web applications across a diverse range of industries and organizations. Some of these users and their stories are listed on the PoweredBy wiki page.  Learn more here.

Mac OS X Snow Leopard

Mac OS X is renowned for its simplicity, its reliability, and its ease of use. So when it came to designing Snow Leopard, Apple engineers had a single goal: to make a great thing even better.  Learn more here.

7 Steps for Installing Tomcat on Mac OS X

Open a Terminal Window and follow these seven steps to install and configure Tomcat on Mac OS X. Application developers can download Tomcat and configure it with various editors, but the method described here can save time and reduce mistakes. This method also supports remote installation. The steps described here, with a modification to step six, can be used to remotely install Tomcat on Unix based systems. This is helpful in “Cloud Computing” environments.

Apache Tomcat App Server Successfully Installed on Mac OS X

Open a web browser and navigate to http://localhost:8080 Application developers should see the main Tomcat page displayed in their web browser.

How to Access Tomcat Virtual Host Manager

Application developers should also configure authorization for the Tomcat Virtual Host Manager.

How to Access Tomcat Application Manager

Application developers should also configure authorization for the Tomcat Application Manager.

How to Configure Authorization for Tomcat Administrators

Go back to the Terminal Window and edit “tomcat/conf/tomcat-users.xml” to add roles and users to “tomcat-users” that can access the Tomcat Administrator areas.

Apache Tomcat Web Application Manager

Authorization has now been configured for the Tomcat Application Manager.

Apache Tomcat Virtual Host Manager

Authorization has now been configured for the Tomcat Virtual Host Manager

Tomcat Mac OS X Resources

How to Setup a Virtual Web Server in 10 Minutes

Virtual Hosting

Virtual hosting is a method for hosting multiple domain names on a computer using a single IP address. This allows one machine to share its resources, such as memory and processor cycles, to use its resources more efficiently.


This article will walk the reader through a few simple steps on how to setup a virtual web server in 10 minutes.  The steps outlined here describe how to install Apache Web Server with the MySQL Database, PHP, & Perl.  This is a tutorial on how to setup a virtual web server on the Apple Macbook Pro, but the same steps apply for a Microsoft Windows computer with a few simple modifications.

The Apple Macbook Pro OS X already comes bundled with a web server.  This Mac OS X web server can be enabled by following the steps outlined in this article, “How to set up a Web Server in Mac OS X Leopard“.

This tutorial will show how to install and configure a virtual web server for web development that can be removed at will.  Web developers experimenting with cutting edge technologies and custom configurations usually need multiple environments.

Please use caution when installing new software on computer systems.  A Best Practice includes creating system backups before changes.

1. How to Install Open Source Software

The good people at Apache Friends have made this step extremely easy.  People can download an Apache distribution containing MySQL, PHP and Perl in the XAMPP package.  Download and install XAMPP by following the steps defined at http://www.apachefriends.org/en/xampp.html

2. Edit the Local Host File

The entries in this file start with something like this:

add the new server name to the bottom of the list here

Press control-o to save the file, then enter, and control-x to exit the editor.
Flush the DNS Cache to activate changes

3. Update the Virtual Host File

This file will look very similar to the text below. Delete everything in this file and add the virtual host information.

New Virtual Host File

4. Update the HTTPD Config File

Remove the comment from #Include /Applications/xampp/etc/extra/httpd-vhosts.conf
Original line

Updated line

Create a test file for the “Document Root” folder identified in the new virtual host and save it as “index.php”.

5. Viewing The Virtual Environment

Navigate to “/Applications/XAMPP” and run XAMPP Control

Start the database and web server from the XAMPP Control

Open a web browser and navigate to http://localhost and see the default XAMPP page.

Open a web browser and navigate to http://localhost/phpmyadmin/ and see the MYSQL database manager.

Open a web browser and navigate to http://virtualserver1.dev/index.php and see the test page from the new virtual web server.

Adding Additional Virtual Web Servers

Additional virtual web servers can be created by repeating steps 2 & 3.  The new virtual web servers will need unique names, for example: “virtualserver2″, “virtualserver3″, “virtualserver4″, or “mydevserver”.

Fixing MySQL error 13 on Mac OS X 10.6.x: This error usually occurs when the curly quotes are used in the configuration files, which happens when copying and pasting code from the web.  This error can be fixed by changing these “HTML quotes” to normal “quotes”.


Setting up virtual web servers in the development environment is a very simple task.  Local instances of web server software allows web developers to experiment with features of web applications like WordPress blog software.  The new features can be tested locally before implemented in a production environment.  Each of these virtual environments can be configured to meet custom needs.  Learn more about Apache Web Server Name-based Virtual Hosting here.

Note: The “Document Root” is outside of the web server software installation, which allows replacing the current web server software with something like “Zend Server” without disrupting current web site files.

Why I Hate Open Source!

Working with #opensource: Upgrading

I manage a Social Media Platform created from Open Source software and here are the INSANE steps I go through for updates.

Step 1

Click on “upgrade automatically”.


Step 2

Enter connection information.


Step 3

Click on “activate plugin”, which returns me to a page showing “Plugin Activated”.


Can you see why I hate Open Source?

I hate open source software, because it’s too easy! In the past, this type of process would take a specialized team of people hours upon hours to complete.  This task was completed in less than 10 minutes, thanks to Open Source and the brilliant members of #opensource communities.

Now I have the the time and money to go shoe shopping with my wife, thanks a lot #opensource?!?!  My wife overheard me and my associates talking about moving this platform into the cloud.  The cloud computing solution will save us even more money and time.  My wife is so excited, she added an additional page to the “honey do” list.

Special Thanks!

A special “Thank you!” to members of open source development communities.  I understand most of you have full-time jobs, families, and other interests.  You volunteer your time during lunch breaks, weekends, and the midnight hour to solve problems and share solutions.  My colleagues and I, plus countless people around the world have more time to focus on relationships with people around us because of your tireless dedication.  Thank You!

I also appreciate the work of Matt Mullenweg creator of WordPress and founder of Automatic.  Thanks to Andy Peatling and the BuddyPress Community.  You should see this article by Andy: “Give a Little“.

BuddyPress: Social networking in a box

Build a social network for your company, school, sports team or niche community all based on the power and flexibility of WordPress.

Visit BuddyPress.org
Visit BuddyPress.org

Cloud Computing with Amazon E2C

Amazon Elastic Compute Cloud (Amazon EC2) is a web service that provides resizable compute capacity in the cloud. It is designed to make web-scale computing easier for developers.

Visit Amazon Elastic Compute Cloud
Visit Amazon Elastic Compute Cloud