Installation on Mac OS X


The Macintosh was always a user-friendly computer, frequently used by Web developers for graphic design and HTML coding. Now, thanks to OS X, the Macintosh is a programmer's computer as well.

OS X, in version 10.4 (aka Tiger) at the time of this writing, has a Unix base with a glorious Macintosh interface. The Unix aspect of the operating systempredicated upon Free BSDallows the use of standard Unix tools, such as PHP, MySQL, and Apache, with remarkable ease. In fact, Tiger comes with Apache and PHP already installed (but the latter is not enabled by default).

Like any other Unix technology, you can download the source code for these packages and manually build them (I've done it myself many a time, and it's not too strenuous). However, I would recommend you take the easy way out and use Marc Liyanage's precompiled systems, available at www.entropy.ch/software/macosx. Marcwho ought to receive an award for the amount of OS Xspecific work he doesprovides up-to-date, easy-to-use installers for many different technologies. In this appendix, I'll install MySQL using the package provided by MySQL and PHP using Marc's precompiled module. The instructions will demonstrate this process using Mac OS X 10.3 (Panther), but the steps will be similar with Tiger or Jaguar (10.2).

As an aside, these instructions are particular to Mac OS X, the basic version of the operating system. Mac OS X server has Apache, PHP, and MySQL preinstalled.

To install and start MySQL

1.

In your Web browser, go to http://dev.mysql.com/downloads/.

This page displays all of the available MySQL products. You'll want to select the Generally Available (GA) release of the MySQL database server. This will be marked as recommend.

2.

In the resulting page, scroll down to the Mac OS X section and click the Standard Installer package for your version of Mac OS X (Figure A.13).

Figure A.13. Be certain to download the Standard Installer package version of MySQL for Mac OS X.


You will then be asked to select a mirror, and then the download will begin.

3.

On your computer, double-click the downloaded file to mount it.

The downloaded file is a disk image that must then be mounted. The Disk Utility application will automatically do this once you double-click the .dmg file.

4.

Open the disk image and double-click the mysql-standard... package (Figure A.14) to begin the installation process.

Figure A.14. The mounted disk image contains several files. I have highlighted the actual installer in this image.


5.

Follow through the installation process.

There are a few, very obvious steps, like agreeing to the license and selecting a destination disk (Figure A.15). Behind the scenes, the package will install all of the necessary files into the /usr/local/mysql-<version> directory. It will also create a symbolic link from /usr/local/mysql to this directory so that the MySQL files can be more easily accessed. Any existing MySQL files are backed up to /usr/local/mysql.bak, including any existing data. Finally, the installer runs the mysql_install_db script, which creates the mysql and test databases (the former being required for users and permissions).

Figure A.15. If you have multiple hard drives or partitions, install MySQL on the one with your operating system.


6.

Install the MySQL preference pane by double-clicking the MySQL.prefPane file in the disk image (see Figure A.14).

These next steps will install a System Preferences pane so that you can easily start and stop MySQL.

7.

At the prompt (Figure A.16), decide for whom the pane should be installed.

Figure A.16. Install the MySQL preferences pane for yourself or for all users.


8.

Open System Preferences and click MySQL, under Other.

The new MySQL preferences pane will be available the next time you open the System Preferences. If System Preferences was open when you installed the MySQL pane, you'll need to quit and reopen System Preferences.

9.

Use the new pane to start and stop the MySQL server (Figure A.17).

Figure A.17. The MySQL preferences pane can be used to control the MySQL database server.


Tips

  • See the "MySQL Permissions" section later in this appendix for guidelines on creating users.

  • If upgrading MySQL from a previous version, be certain to stop the existing MySQL server before installing the new version.


To install PHP

1.

In your Web browser, head over to www.entropy.ch/software/macosx/php.

2.

Download the appropriate version of PHP for your operating system (Figure A.18).

Figure A.18. There are several different PHP installers available at www.entropy.ch.


This will download the PHP installer to your computer.

3.

On your computer, double-click the downloaded file in order to mount it.

4.

Double-click the PHP package in the mounted image (Figure A.19) to begin the installation process.

Figure A.19. The PHP installer for Mac OS X.


5.

Follow through the installer.

The installer is really easy to use. You'll need to click Continue a couple of times, select a destination disk (this should be the same hard disk or partition that also has your operating system), and enter the administrative password.

Tips

  • See the "Testing Your Installation" section later in this appendix for guidelines on confirming the results of installing PHP and MySQL.

  • Apple's software updates will frequently alter your PHP installation because they may replace the existing httpd.conf file or PHP module.

  • Aaron Faby also provides many free installers for OS X at www.server-logistics.com.

  • It is recommended that you not replace or significantly alter the Apache installation, as it's so integral to the operating system as a whole.

  • Another alternative is to use the all-in-one installer available at http://wserverxkit.sourceforge.net. It will install MySQL, PHP, Apache, and even phpMyAdmin.




    PHP and MySQL for Dynamic Web Sites. Visual QuickPro Guide
    PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (2nd Edition)
    ISBN: 0321336577
    EAN: 2147483647
    Year: 2005
    Pages: 166
    Authors: Larry Ullman

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net