2.2. Obtaining PHP

At the time of this writing, two versions of PHP are available: PHP 4 and PHP 5. When PHP 6 is released, three versions of PHP might be available for a period of time. If you're installing PHP for the first time and creating your first Web site, you should download PHP 5, or PHP 6 if it is available at the time you read this book. You should install an older version of PHP only if you need to maintain or modify an existing Web site with existing code. Code that's written for one version of PHP might need to be modified to run on another version of PHP. If you have a lot of code, you might want to update the code over a period of time.

2.2.1. Downloading from the PHP Web site

PHP for all operating systems is available on the PHP Web site at www.php.net. You can download source code to compile on your operating system. Compiling and installing source code isn't difficult on Linux and the Mac OS, but requires expert knowledge and software on Windows.

Binary files — compiled, ready-to-run files that just need to be copied to the correct location — are available only for Windows. You can obtain binary files for Linux and the Mac OS from other Web locations, but not from the PHP Web site.

2.2.2. Obtaining PHP for Windows

You can easily install PHP from binary files that you can download from the PHP Web site at www.php.net. You can download a Zip file that contains all the necessary files or an installer that you can run to install all the PHP files. The PHP documentation recommends that you install PHP from the Zip file for better understanding of the installation and easier addition of extensions later. The directions in this chapter provide instructions for installing PHP from the Zip file.

Although Windows users can compile and install PHP from source code, also available from the PHP Web site, it is difficult and should only be attempted by advanced users. It requires advanced knowledge and special software.

To download the Windows Zip file, take these steps:

  1. Download the Zip package for the most recent version of PHP.

2.2.3. Obtaining PHP for Linux

Most recent versions of Linux include PHP. If you need to install PHP or upgrade to a more recent version, most Linux distributions provide software on their Web site that you can download and install on your specific Linux system. In addition, most Linux systems provide utilities specifically for downloading and installing software. For instance, Fedora provides the yum utility that downloads and installs software from the Fedora Web site. See the documentation for your Linux distribution for information on how to download and install software on your Linux distribution.

In some cases, you might need to install PHP manually. The software provided by the Web site might not be the most recent or might not be configured to your needs. To install manually, you need to download the source code from the PHP Web site at www.php.net.

You can easily compile and install PHP from the source code. This process isn't as technical and daunting as it sounds. Instructions for installing PHP from source code on Linux are provided in this chapter.

2.2.4. Obtaining PHP for the Mac OS

PHP comes already installed on most recent versions of Mac OS X. If you need to install PHP because it's not installed or an older version is installed, the easiest way is to install from a binary file. The PHP Web site doesn't provide a binary file, but binary files are provided for some versions of OS X at www.entropy.ch/software/macosx/php. The information needed to download and install the binary file is provided at this Web site. Check the support and extensions provided in the binary file to ensure that you have the features you need.

If the binary file doesn't provide the features or extensions you need, you can download the source files from the PHP Web site to compile and install on your Mac. Instructions for installing PHP from the source code are provided in this chapter.

2.2.5. Obtaining all-in-one installation kits

You can obtain some kits that contain and install PHP, MySQL, and Apache in one procedure. These kits can greatly simplify the installation process. However, the software provided might not include the features and extensions that you need.

XAMPP is a popular all-in-one installation kit that contains Apache, PHP, and MySQL. It also installs phpMyAdmin, a utility for managing your MySQL databases. XAMPP has stable versions available for Windows, including Vista, and for several versions of Linux. In addition, versions of XAMPP are available for Mac and Solaris, but these versions are currently new and less well tested and developed. XAMPP is available at www.apachefriends.org/en/xampp.html. Instructions for installing your software using XAMPP are provided in Chapter 5 in this minibook.

WAMP5 is a popular installation kit for Windows that provides recent versions of Apache 2.2, PHP 5, and MySQL 5. Like XAMPP, WAMP5 also installs the phpMyAdmin utility. The WAMP5 Web site states that it's compatible with Windows Vista. WAMP5 doesn't run on Windows 98/Me. WAMP5 is available at www.en.wampserver.com.

MAMP is an installation kit for Mac that installs Apache, PHP, and MySQL for Mac OS X. This free package installs a local server environment on your Mac PowerBook or iMac. MAMP was created primarily as a PHP development environment for your local computer and should not be used as a production server for the Internet. You can obtain MAMP at www.mamp.info.

2.2.6. Verifying a downloaded file

The PHP Web site provides methods to verify the software after you download it, as a security precaution to make sure that the file hasn't been altered by bad guys. You can verify using either the MD5 method or the PGP method. The MD5 method is simpler and is described in this section.

On the download Web page, a long string called a signature is displayed below the file you downloaded. Here's an example:

MD5: 6112f6a730c680a4048dbab40e4107b3

The downloaded PHP file needs to provide the same MD5 signature shown on the download page. You use software on your computer to check the MD5 signature of the downloaded file. Your Linux or Mac system includes software to check the MD5 signature. On Windows, you might need to download and install MD5 software. You can find software that checks MD5 signatures at www.fourmilab.ch/md5.

You can check the MD5 signature of the downloaded file at a command line prompt, such as the command prompt window in Windows. You may need to be in the directory where the downloaded file resides. To check the MD5 signature, type:

md5 filename

Use the name of the file that you downloaded, such as md5 php-5.2.1-Win32.zip. In Windows, you might need to copy the downloaded file to the directory where the MD5 software (such as md5.exe) is installed, change to this directory, and then type the preceding command.

A signature displays. The signature here should be the same signature displayed under the filename on the download page of the PHP Web site.

winMd5Sum is a simple, open source (free) Windows program with a graphical interface that allows you to check MD5 signatures by clicking buttons and dragging filenames, rather than by typing commands in a command prompt window. You can obtain it at www.nullriver.com/index/products/winmd5sum.

You can verify the downloads for Apache and MySQL with a similar procedure.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.224.44.100