Setting Up Apache and PHP
Apache Version 1 is already installed under Panther and doesn't need to be upgraded to use this book; you don't need the latest version, Apache 2. However, by default, it isn't running, it won't serve PHP requests, and it only serves standard, non-secure requests. In this section, we discuss how it's set up on your machine, how to get it started, and how to modify it so that it can serve secure and PHP requests.
PHP 4.3.2 is installed with Panther. It includes most of the features you need to work with this book, except that the PEAR installer doesn't work without an additional step. In this section, we show you how to upgrade to the latest stable release using a package. Fixing the PEAR installer is discussed in Section C.4.
Starting Apache
Let's start by getting Apache running. To get it started, you can do one of two things:
- Automatically start Apache each time your machine starts.
To do this, launch System Preferences from Applications→ System Preferences. Then, select Sharing from beneath the Internet & Network heading. At the left of the window, select Personal Web Sharing by ticking the box. Quit System Preferences. Apache will now start and will also start each time you start up your computer.
- Manually start Apache using Terminal.
Start by opening Terminal, which is located in Applications→ Utilities. In the Terminal window, log in as the root user and start Apache using:
%
su
%apachectl start
You should see a message such as:
/usr/sbin/apachectl start: ...
Get Web Database Applications with PHP and MySQL, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.