05.05.2013 Views

Programming PHP

Programming PHP

Programming PHP

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

You must also enable execution of scripts in each directory in which you want to run<br />

<strong>PHP</strong>. The exact method of doing this varies between versions of PWS—it may be an<br />

option when you right-click on the directory from the Explorer or a Control Panel<br />

option, or it may be done through a separate PWS configuration program.<br />

Manually configuring Apache<br />

Apache uses a single configuration file, httpd.conf, rather than the system registry.<br />

This makes it a little easier to make changes and switch between CGI and SAPI module<br />

configurations.<br />

Add this to httpd.conf to configure <strong>PHP</strong> as a SAPI module:<br />

LoadModule php4_module c:/php/sapi/php4apache.dll<br />

AddType application/x-httpd-php .php<br />

To execute <strong>PHP</strong> scripts via CGI, add the following to the httpd.conf file:<br />

AddType application/x-httpd-php .php<br />

Action application/x-httpd-php "/php/php.exe"<br />

Other installers and prepackaged distributions<br />

There are also a variety of prepackaged Windows distributions of <strong>PHP</strong> available on<br />

the Web. These distributions can make it easier to get a web server and <strong>PHP</strong> running,<br />

and some offer more features or a smaller footprint. Table 15-1 shows some of<br />

the more interesting distributions available at the time of writing.<br />

Table 15-1. Prepackaged distributions of <strong>PHP</strong>-related tools for Windows<br />

Product URL Description<br />

<strong>PHP</strong>Triad http://www.<strong>PHP</strong>Geek.com Apache, <strong>PHP</strong>, and MySQL in a standard CGI distribution for Windows. Convenient<br />

for those who want to get up and running quickly and who don’t care<br />

about where things are located.<br />

Merlin Server http://www.abriasoft.com A complete web development and production server that includes a secure,<br />

SSL-supported release of Apache, MySQL, and PostgreSQL, plus development<br />

languages such as <strong>PHP</strong> and PERL. It also includes a complete open source ecommerce<br />

software platform and comes with a template-based web portal<br />

and news system.<br />

Adding Extensions to the Base Distribution<br />

<strong>PHP</strong> on Windows has out-of-the-box support for ODBC and MySQL. Most other<br />

extensions must be manually configured (i.e., you must tell <strong>PHP</strong> where to find the<br />

DLL files).<br />

First tell <strong>PHP</strong> which directory contains the extensions by adding this to your php.ini<br />

file:<br />

extension_dir = C:\php\extensions; path to directory containing php_xxx.dll<br />

354 | Chapter 15: <strong>PHP</strong> on Windows<br />

This is the Title of the Book, eMatter Edition<br />

Copyright © 2002 O’Reilly & Associates, Inc. All rights reserved.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!