Enable Apache,PHP in Mac OS X

Mac OS X comes with Apache,PHP pre-installed but is not enabled by default. Just when you get on to your new Mac OS X you definitely want to enable these. The following steps should help you enable PHP over Apache and you can start rolling. Enable PHP module in httpd.conf   * We first need to enable PHP module in Apache’s configuration file i.e. httpd.conf. This configuration file,httpd.conf, is stored in /etc/apache2 folder which is hidden by default. * You can directly jump into this folder by clicking on Go > Go To Folder and type /etc/apache2 . * From this folder open httpd.conf  in your favorite text editor. I am using Text Wrangler for this example. * Since this file requires root permission to edit, you can unlock this before editing. text wrangler file unlock Enable Apache,PHP in Mac OS XAlternatively, if you are not using TextWrangler, then you can open this file in OS X’s default editor called Text Edit, using this  command, sudo open -t /etc/apache2/httpd.conf * In the config file, search for the line which says “#LoadModule php5_module libexec/apache2/libphp5.so” . Notice, that it has a hash sign (#)  at the start, this means that it is commented. Just uncomment this line, by removing the hash sign (#) from the start and save the file. For my httpd.conf  the line no. is 111, you can search for string “php5” to quickly search this line. * With this step we have enabled the PHP5 module on Apache server. Creating the default php.ini Next we need to create a default php.ini file for PHP to run successfully. A default php.ini exists in the /etc  folder with the name php.ini.default . You first need to duplicate this file and simply save it with the name php.ini . If you are an advanced user or need to make any changes to the default php configuration, you can do it now or later in this very file.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s