(php 5.3.3 Page 4 of 7)
A Self Paced PHP5 Certification Course for under $15* per month! Enroll NOW!
Web Server Setup:
Our next window (Fig. 06) offers a healthy array of auto setup choices of various Website Servers for PHP 5.3.3. The Thread Safe and Non-Thread Safe installers display differing windows. Our Fig. 06 image is modified to show both available selections. You will only see either selection in your installer.
Apache users that downloaded the Non Thread Safe PHP5 .msi installer will simply select Other CGI and configure Apache's httpd.conf file (see: Testing Php 5.3.3). But first, we must complete the remaining setup options to install PHP 5.3.3 onto our hard drive.
IIS is the Microsoft Windows brand of website server software. CGI can be excruciatingly slow using the IIS server and so FastCGI was developed to provide some resolve to this issue.
The Thread Safe PHP5 installer is also able to auto-config NSAPI, Xitami and NetServe branded servers out of the box. You can also select other cgi or skip this part of the install to personally configure the CGI yourself. Our purpose is to use Apache as our server and this has two main choices. Either Apache2.2.x Module or Apache CGI. But before we configure PHP in our Apache Server, we must first resolve whether we want to run PHP as a module of Apache or not. So the hot question is really Apache Cgi Vs Apache Module, which one should we use?
Apache Cgi Vs Apache Module
When the PHP installer asks you to choose between PHP 5.3 as Apache-Cgi versus PHP 5.3 as an Apache Module, you address a question which is similar to the decision made between choosing a Threadsafe or Non Threadsafe option. This is because this decision also effects the way in which the programmer writes his code in the software.
Only the Thread Safe installer offers both options:
a) Apache-CGI or,
b) Apache2.2.x Module
The main point to undestand is that if you choose Apache-Cgi, your binaries run independantly of Apache. And if php is a module of apache, then of course apache is more aware of the Php environment and thus less secure in a shared server situation. Popular applications (MySql etc.) will run just fine under either setup method.
We can see then that Apache-CGI tends to be favored by those seeking a more secure environment. As Apache's CGI handler, PHP then goes about it's business with little care to others users who may be sharing your same server. For example, it is easier to obfuscate your passwords file and keep it's location unknown to other server users etc.
But running PHP as an Apache2.2.x Module has some distinct advantages. Some of these being that running the PHP interpreter as an Apache module is the easiest to setup, it is the most common type of setup used in pre-configured solutions and is very well supported in popular website server software and scripts. Best of all, this method is currently inclined to be much faster than the Apache-CGI option. The downside being that Apache2.2.x Module has special needs to increase security. See these notes for more on adding security when using Apache2.2.x Module.
How to determine if your Host runs Php as an Apache Module for CGI
Examine your purpose for installing PHP. If it is to setup a test system for developing scripts and then upload the scripts to a Web Host, you are possibly better advised by leaning your decision toward using the same PHP setup that this website host is using. You can get help to determine what Php setup your Host Site uses by running either .php script that can be found in this article Which is my Website, Apache Mod PHP or Apache CGI?.
Our purpose in this training guide is to have an effective working setup that is an excellent overall starting point from which we can begin to be productive. In most basic And no matter which combination you choose, it is quite easy to swap methods at a later date.
Selecting our Web Server Setup Type
Some of you have ended up here after losing many hours of searching and sifting through the confusion splattered all over the web asking, "Exactly how does one configure and install a working version of PHP under windows?". If you can understand and follow the steps as laid out in this guide and you should find yourself writing and testing your own PHP scripts in a very short amount of time. And strangely, the website administrator may not even need to touch a configuration file to get this done!
ThreadSafe users will select either the easy popular Apache 2.2.x Module method or the more secure Apache CGI and then select next to continue with the install process (which is the next step down the page as you will need to tell the installer where to find the Apache Configuration Directory).
Non-ThreadSafe Installer (-nts-) users will have only three options as shown on the right of the wizard window above. NTS Apache users would choose Other CGI and next. Also, for -nts- users only, your next wizard window is: Choose PHP 5.3.3 Items to Install.
The Apache Configuration Directory:
Next, the PHP5 installer needs the path to the Apache Configuration Directory. The advantage of using the .msi installer is that it will edit and add to the Apache config file for us. Either type the path or select browse (recommended) to locate this directory. In a default Apache 2.2 installation (refer our Apache2.2 Installation Guide), this will be found at C:\Program Files\Apache Software Foundation\Apache2.2\conf\.
The next three images show how we point the PHP5.3.3 installer to the Apache Configuration Directory /Folder (Fig07, Fig08 and Fig09).
First we select Browse to begin to locate the Folder for PHP 5.3.3
Locate the Apache CONF folder. It will be similar to our red highlight.
By double clicking the folders in the box, we can navigate to the path of the "conf" directory (highlighted in red is the default apache 2.2 location path). When you have located located the directory and its path is shown in "Folder name:" select OK.
The selected Directory now appears in the PHP 5.3.3 installer window.
Once selected, the correct path will appear in the window with the option of browsing for it again in case you made an error in selection. If correct, select next and to move the items selection part of the install procedure. And take note, if you skip the notes in the next section, you will most likely have errors in starting Apache so please read them carefully.