(php 5.3.6 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.6. 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 HTTP Server users that downloaded the Non Thread Safe PHP5 .msi installer will simply select Other CGI and configure Apache's httpd.conf file (see: Check httpd.conf changes). But first, we must complete the remaining setup options to install PHP 5.3.6 onto our hard drive.
IIS is the Microsoft Windows brand of web 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 (Module or Binary)
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 may also effect the way in which the programmer writes his code in the software.
Only the Thread Safe installer offers both options:
a) Apache2.2.x Module or,
If you choose Apache-Cgi/Other-Cgi, your binaries run independantly of Apache. Alternatively, if php is a module of apache, then of course apache and Php run under the same environment and thus is less secure in shared server situations. Popular applications (MySql etc.) will run just fine under either setup method.
We can see then that Apache-CGI (or Other-CGI if using the -nts- install) 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 other 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 when running small and simple scripts. 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
Again we stress that you should examine your purpose for installing PHP. If you are working with another site that already has php setup for your self or your client, then use that same setup with your test system. You can get help to determine what Php setup your Host Site uses by running either of the .php scripts that are found in our article Which is my Website, Apache Mod PHP or Apache CGI?.
Our purpose in studying 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. And no matter which combination you choose, it is quite easy to swap methods at a later date. We have doctored the next image (Fig. 06) for you so that you can see the Web Server Setup selections available from either the TS or NTS downloads.
Selecting our Web Server Setup Type
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 (-nts-) users will have only three options as shown on the right of the wizard window above. Non-ThreadSafe Apache users would choose Other CGI and then next. Also, for -nts- users only, your next wizard window is: Choose PHP 5.3.6 Items to Install.
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.
Other-CGI installers are not asked for the location of httpd.conf as you will need to edit this file your self. It is only one or two very simple steps and both of which are given later in this guide.
The Apache Configuration Directory:
Next, for those who have selected apache-module, 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 you. You can 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 to point the PHP5.3.6 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.6
Locate the Apache CONF folder. It will be similar to our blue highlight.
Double click the folder boxes and navigate to your "conf" directory (we have highlighted the default apache 2.2 location path in light blue). Select OK when the Folder name box displays the correct path to the conf folder.
The selected Directory now appears in the PHP 5.3.6 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.