IIS Web Server
PHP Tutorials
Follow these steps to install the PHP interpreter:
-
Start the installer. It brings up a window that looks like Figure A-3. Click Next. Agree to the PHP license on the next page and click Next to continue.
-
As shown in Figure A-4, select the Standard installation. Click Next to continue.
-
As shown in Figure A-5, install PHP into the default folder (C:\PHP). Click Next to continue.
-
As shown in Figure A-6, enter information that the PHP interpreter uses when sending email messages: the address of your ISP's mail server and what will appear as the From address on those email messages.
-
As shown in Figure A-7, select what kind of web server you are using.
-
As shown in Figure A-8, click Next on the final screen to start the installation.
Figure A-3. Installing PHP
Figure A-4. Choosing standard PHP installation
Figure A-5. Choosing the PHP installation folder
Figure A-6. Setting PHP mail configuration
Figure A-7. Selecting your web server
Figure A-8. Starting the PHP installation
When you choose Apache as your web server in the PHP installation process, you get the disappointing message shown in Figure A-9.
Figure A-9. Installing PHP with Apache
You must configure Apache yourself so that it can work with PHP. First, make sure you followed the Apache installation procedure in Section A.4.1.1. Then, add these lines to the very end of your Apache configuration file:
Alias /fcgi-bin/ "c:/php/" FastCgiServer "c:/php/php.exe" -processes 5 AddType application/x-httpd-fastphp .php Action application/x-httpd-fastphp /fcgi-bin/php.exe
Restart Apache from the Apache Monitor. Now, files whose names end with .php are handled by PHP. With the default Apache installation directory of C:\Program Files\Apache Group, the document root of your web site is C:\Program Files\Apache Group\Apache2\htdocs. So, the file C:\Program Files\Apache Group\Apache2\htdocs\test.php is accessible at the URL http://localhost/test.php.
If you're using IIS, the PHP installer does the work for you. Make sure that IIS is running when you start the PHP installer. When the installer is completed, IIS is configured to pass URLs that end with .php to the PHP interpreter. The default document root for IIS is C:\Inetpub\wwwroot. So, the file C:\Inetpub\wwwroot\test.php is accessible at the URL http://localhost/test.php.
A.2.1.2. EasyPHP
The EasyPHP package makes it a snap to set up your Windows machine with everything you need for web development. You just need to download a single file to install the PHP interpreter, the MySQL database program, the Apache web server, and the PHPMyAdmin database administration program.
To use EasyPHP, download it from http://www.easyphp.org/telechargements.php3 and then follow the installation instructions at http://www.canowhoopass.com/guides/easyphp/.
A.2.2. Installing on Linux and Unix
Most Linux distributions come with PHP already installed or with binary PHP packages that you can install. For example, if you're using Fedora Linux (http://fedora.redhat.com/), install the php RPM and the RPMs whose names begin with php-. If you're using Debian Linux (http://www.debian.org/), install the packages whose names begin with php4- and libphp-.
If those packages are out of date, you can build PHP yourself. From http://www.php.net/downloads.php, download the Complete Source Code .tar.gz package. From a shell prompt, uncompress and unpack the archive:
gunzip php-5.0.0.tar.gz tar xvf php-5.0.0.tar
This creates a directory, php-5.0.0, that contains the PHP interpreter source code. Read the file INSTALL at the top level of the source code directory for detailed installation instructions. There is also an overview of PHP installation on Linux and Unix at http://www.php.net/manual/install.unix. Instructions for installing PHP with Apache 1.3 are at http://www.php.net/manual/install.apache. Instructions for installing PHP with Apache 2.0 are at http://www.php.net/manual/install.apache2.
