Using MacOS X, Apache, PHP, MySQL, Dreamweaver UltraDev, and Phakt

•  Introduction
•  Choosing your Mac OS X Operating System
•  Installing Apache and PHP
•  Installing MySQL
•  Installing the required JDBC drivers
•  Installing the Phakt PHP Server Model
•  Setting up UltraDev and Phakt to talk to MySQL
•  Potential Problems







Page 2 -- The Apache and PHP part

MacOS X comes complete with an Apache web server and the PHP scripting engine. If you just recently updated your MacOS from version 10.0.x to 10.1.x, then it's possible that your Apache server isn't running properly or at all. This is a known issue as Apple slightly changed the Apache configuration. If you find that this is the case, then please read this article at stepwise.com to fix the problem before continuing.

MacOS X version 10.1.2 comes with the latest version of the PHP scripting engine, v4.0.6., although it is not enabled my default. It is very lean installation and doesn't contain a lot of the features that a full-blown installation of PHP would have. However, this lean installation will most likely reduce the overhead involved in running a "fatter" version and make your Web server more efficient. However, if you need many of the features that a full installation of PHP offers, you may consider upgrading it to accommodate using the links in the next paragraph.

One of the best resources that I have found for MacOS X-specific Web installations is Marc Liyanage's Web site at http://www.entropy.ch/. He has an amazing collection of articles and such to make your installations quick and painless. Marc creates his own OS X installation packages for the some of the most popular web applications, including PHP, MySQL, and PostreSQL. An installation package in MacOS X would be comparable to a RedHat RPM file or a Microsoft MSI file. If you need to install the latest of these products on your MacOS X computer, or require additional features that the stock installation doesn't have please click the links above for more information.

Ya gotta be "root"

Once you have updated your PHP installation (if necessary), you will need to enable it in your Apache configuration file. To do so, you will need to log in as the "root" user. The root user, for those who aren't Unix-savvy, is the God of all users. Even higher than your Mac's Administrator account. There is nothing that the root user can't do on the machine. This is why this user is also very dangerous. So you'll need to be very careful running the computer as the root user. You can irreparably harm your operating system if you do something that you aren't supposed to!

By default the root user is disabled. In most cases, there is no need to go there, so Apple disabled it. However, if you must do this, then there is a set of steps to go through to do so:

  1. Navigate to Macintosh HD : Applications : Utilities and double-click NetInfo Manager.
  2. From the menus, select Domain > Security > Authenticate. You will be prompted for your username and password. This user will need to have Administrative privileges. It will be the account that was first created when you installed MacOS X.
  3. From the menus, select Domain > Security > Enable Root User. If this is the first time that this has been done, you will be prompted for a password for use with the root user. Don't forget it! Only the root user knows the root user's password! Even your Administrator account can't get to it if you forget it!

Once you have created your root account, you'll need to log out and log back in as root. To do this, you'll need to change your log-in setting a little bit. By default, OS X lists the users who have accounts on the computer and a nice little picture beside the name that you would click on. Then you would be prompted for your password. The root user is not included in this list, however.

To log in as root, you'll need to be able to type in the username and password yourself. To do this, set your Login options to allow name and password entry fields:

  1. From the Apple menu, select System Prefs...
  2. Click the Login control panel, then the Login Window tab
  3. In the section labelled "Display Login Window as:" select Name and password entry fields.
  4. Close the Login control panel and quit System Preferences

From the Apple menu, select Log Out... In a short period of time, you should be presented with a login screen. Use "root" (without the quotes) as the username and use the password you created above. Voilá! You're logged in as root!

Update the Apache Configuration File

Now we've got to make those updates to the Apache configuration file we talked about earlier:

  1. From your Sharing Control Panel, turn Web Sharing off
  2. From the Finder menu, select Go > Go To Folder...
  3. Type /etc/httpd in the box and click OK.
  4. In this folder you will see a file called httpd.conf. This is the file we need to update.
  5. Make a backup copy of this file!
  6. Open this file with a text editor such as TextEdit or BBEdit. Do not open this file with Microsoft Word, WordPerfect, OpenOffice, or any other word processor!
  7. Ensure the following lines in the file are not prefixed with a pound sign (#):

    LoadModule php4_module libexec/httpd/libphp4.so
    AddModule mod_php4.c                          
    AddType application/x-httpd-php .php
    AddType application/x-httpd-php-source .phps

  8. Save the file, ensuring that it is strictly a text file. TextEdit has a Save option that ensures that the file is not being saved with Rich Text.

For more information about the steps above outlining the configuration file, please refer to the article at stepwise.com mentioned above.

Remain logged in as root, and we'll move on...

Let's do the MySQL part!

 

 
Copyright ©2001 Christopher Owens. The logos above are copyrighted by their respective owners, organization, and corporations.