Appendix A Installing PHP and MySQL
Adding PHP to Your Apache Configuration
You may need to edit one of Apache’s configuration files.Open the
your favorite editor.This file is typically located in the
directory.Look for the following lines:
LoadModule php5_module c:/php/php5apache.dll
AddType application/x-httpd-php .php
Action application/x-httpd-php “/php/php.exe“
If you don’t see these lines,add them to the file,save it,and restart your Apache server.
Adding PHP and MySQL to Microsoft IIS and PWS
This section covers how to add PHP and MySQL support to IIS with the ISAPI
) module. (You can also install it as a CGI,but we strongly recommend
you use the ISAPI module because it is faster.) This section assumes that you have fol-
lowed the steps in the preceding sections.The main difference is that the
figuration directive is likely to be
Next, you need to open Internet Information Services.If you have Windows 2000 or
XP,you can find it in the Control Panel under Administrative Tools.If you don’t see this
option,you may need to install IIS from your original Windows CDs before continuing.
When IIS is open,you should see a tree view of services on the left side.Right-click
the web server (usually called Default Web Server) and select Properties.
The resulting Properties dialog box contains quite a lot of information,but you need
to change only a few things.Under Home Directory,click the Configuration button.
Under Application Mappings,select Add to add PHP.You must then supply an exe-
cutable.Supply the full path to the location of
). In the Extension box,you should type
.You also need to
check the Script Engine box if it isn’t already checked.Click OK.
If you want to be able to do HTTP Authentication (which we cover in this book),
you should also look under ISAPI Filters. Select Add.You need to supply a filter name
(in this case,type
) and an executable (here,supply the full path to the
file as just shown).Click OK.Finally,close the Properties dialog box by
You should now stop the web server (or check that it is stopped) and then restart it.
You can do this from the Internet Information Services window by right-clicking on
the web server and choosing Stop.You can restart in the same way by selecting Start.
Testing Your Work
The next step is to start your web server and test to ensure that you have PHP working.
file and add the following line to it:
<? phpinfo(); ?>