(php 5.3.3 Page 6 of 7)
A Self Paced PHP5 Certification Course for under $15* per month! Enroll NOW!
Testing PHP 5.3.3 Installation Configuration:
httpd.conf file edits (manually config httpd.conf):
If you installed the Apache2.2.x Module option (available only in the thread safe .msi installer) you can skip these two changes as your setup should already be complete. However, if you selected to install Apache CGI, you will need to manually amend the apache httpd.conf file with the following two simple changes.
Change 1) With no forward slash at the end, and assuming your Php install path is "c:/php", use a text editor (like notepad, not Ms Word), find (search) the note that says "cgi-bin should be changed to whatever your ScriptAliased CGI directory exists" and locate the <Directory> tag directly below which includes a reference to "cgi-bin". It will look like the following:
<Directory "C:/Program Files/Apache Software Foundation/Apache2.2/cgi-bin">
then replace the directory path with the correct directory path to your php-cgi.exe directory (copy and paste the following over them if you like). This group will then look similar to the following after you have amended the first line:
Allow from all
Note: If you have a previously installed PHP as apache's CGI, this might already exist correctly in the .conf file. The entry would have to be manually removed when you uninstall PHP to get rid of it. It doesn't hinder your use of the module type installation if you find you need to switch back and forth between the two (in my experience).
Change 2) Move to the very end of the httpd.conf file. Find the last few entry lines which start and end with reference to being #PHP INSTALLER EDITS. These lines may be missing if you used the Non Thread Safe installer. (This step adds scriptalias, registers the .php extension and locates the Cgi Interpreter for Apache). And in either case, copy, paste and replace (or add) the following 5 lines so that they are the final instructions in your httpd.conf file.
#BEGIN PHP INSTALLER EDITS - REMOVE ONLY ON UNINSTALL
ScriptAlias /PHP/ "c:/PHP/"
AddType application/x-httpd-php .php
Action application/x-httpd-php "/PHP/php-cgi.exe"
#END PHP INSTALLER EDITS - REMOVE ONLY ON UNINSTALL
Testing your PHP 5.3.3 configuration:
And now, no matter which install method you have chosen, you are ready to test the configuration of your PHP 5.3.3 installation in Apache.
As previously mentioned, the first thing we do is re-start (or start) apache HTTP server so that Apache can now include any new configuration information. Apache should start without error. If you are unsure how to check/test your apache installation, or how to locate your home directory (the document root), please review the appropriate section(s) in our Apache Server 2.2.16 install guide.
Those of you who have the apache icon in the system tray (see Fig. 11) can do this by selecting the apache feather logo icon and asking apache to restart. The green triangle/start button is displayed over the logo when Apache is in its serving state.
The Apache System Tray Server Status Icons.
Most of you will encounter no issues here and so move directly into the final testing phase (Jump to troubleshooting if you have encountered a problem).
To test PHP 5.3.3 is installed, it is a good idea to create a simple php script that will load your PHP configuration data into your web browser. This is a simple but very useful script the Website Administrator can use to also confirm the success of his installation. Open a simple text editor (like Notepad) and copy/paste these next three lines into it;
Save this file in your Apache Document Root Folder (your home directory) as phpinfo.php
Next we simply call the file in our web browser. For example, if your home setup is a local setup, you would simply type one of the following into the location bar and depress the enter key...
This is the moment of truth that will tell you if you have been successful in your efforts and can now start to code in .php. If your .php script worked, you will be greeted with a bunch of data explaining your PHP 5.3.3 and server setup like so (Fig.12) (and dont forget that if you need to recall this file because it didnt work the first time, you might keep re-calling the cached error version, to avoid this, rename the .php file each time you test it, eg; phpinfo01.php, phpinfo02.php, etc. Use our TroubleShooter page!)...
PHP Version 5.3.3 Phpinfo Page .
(the list continues on and on...)
You can also upload this small file to your www folder at your website to learn the configuration of your hosting site (if php is enabled on that website). After you have uploaded the file to your website, you would view the information by typing www.MySite.com/phpinfo.php into your browser location bar.
This information is invaluable as a tool for checking or debugging various information as you load or add other items to your PHP configuration under Apache.
The Website Admin can now easily re-enter the Options Selector page (Fig. 10) at any time to add or remove components via the Installation Change / Repair / Remove menu (You would of course select change). Gain access to the menu by restarting the .msi installation file or by using Add/Remove Programs in Windows Control Panel to change your PHP 5.3.3 items configuration. This phpinfo.php script will confirm a successful option installation by adding a corresponding section to the list using that options name as the new header.
Bookmark this tutorial for future reference. Things to remember when seeking to add to your install is if your configuration is threadsafe or not and if you have integrated PHP CGI as an Apache Module or not.
That is it! You are now ready to start coding your .php files and scripts. And remember to save your files with php script in them as .php, not .html. You would need to add an apache handler if you wanted to save them as .html. All that is left to do now is to fine tune your php.ini to better suit your needs. And this comes as par for the course while you learn to master your PHP. If you need it, troubleshooting is on the next page. Enjoy.
And as a closing note, if you have no previous formal PHP or MySQL training and would like to attain some solid Web Developer skills, then you would be smart to enroll now on this inexpensive self paced study course on basics as well as some advanced uses of PHP and MySQL with popular servers. Innobuzz also deliver unique advanced courses on Ethical Hacking and other Security courses which would be of interest to the technical minded.