Whatterz


Setting up PHP on Mac OSX 10.6 (Snow Leopard)

by Simon. Average Reading Time: about a minute.

Since Apple launched Mac OS X 10.5 (Leopard), PHP has been installed by default, albeit disabled. Here is a quick run through of what you need to do to get it up and running:

  1. Enable the PHP5 module in Apache:
    LoadModule php5_module libexec/apache2/libphp5.so

    This will normally involve simply removing the hash symbol (#) at the beginning of the line.

  2. Restart Apache via the command line:
    sudo apachectl restart -t

    The -t is used to run a syntax check on the Apache file, to ensure you haven’t broken anything.

  3. Locate the php.ini.default file in the /etc/ directory and rename it to simply php.ini by running the following commands:
    cd /etc
    sudo cp php.ini.default php.ini
    sudo chmod 666 php.ini
  4. Create a file in the web server’s document root, in this case an index.php file, with the following text included:
    <?php phpinfo() ?>

    When you browse to that file, it will display information regarding your PHP installation. (Be sure to remove this after use and certainly don’t include it in a production environment.)

That is all you need to do. Easy huh?

As a point to note, if you need to make changes to either the http.conf file or php.ini, you will need administrative access and will need to restart the Apache server for the chances to take effect.

This article has been tagged

, , , , , , , , ,

Other articles I recommend

Configuring Your First Local Apache Website

Apache is controlled by a series of configuration files but the one we will be dealing with here is httpd.conf. This file contains instructions on how Apache should run. Several companies offer GUI-based Apache front-ends, but it’s easier to edit the configuration files by hand.

Configuring ColdFusion 8 with Apache

After installing ColdFusion 8 and Apache successfully you may still see an “HTTP 500 Internal Server Error” when navigating to a ColdFusion page. All is not lost, you simply need to configure, or check the configuration of Apache. Apache requires very little post installation modification, but it is always good practice to check the httpd.conf file to ensure that the ColdFusion “install” scripts did what they were supposed to do.

Configuring PHP with Apache on Windows Vista

Installing PHP with Apache on Windows Vista is a relatively simple task until you try an configure the settings in php.ini. Problems can occur and stem from the fact that when you install PHP and edit the php.ini file, you need to not only be logged in as Administrator, but run the installer and Notepad text editor as Administrator. The php.ini file also needs to be located in the Windows directory.