How to install PHP 4, MySQL 4 and Apache2 on almost any Windows computer. Easy to follow and works!

Download Apache2 (This tut was written for 2.0.x And will not work with 1.3.x or 2.2.x) We want the Win32 Binary (MSI Installer)
http://httpd.apache.org/download.cgi
Download MySQL (This tut was written for with 4.0.x) but should worth with MySQL 4.x OR 5.x) We want the ZIP files without the installer!
http://dev.mysql.com/downloads/
Download PHP 4 (This tut was written for 4.4.x, but should work with 4.0.x also) We want the ZIP files without the installer!
http://www.php.net/downloads.php
Install Apache2
I usually install Apache to C:apache. If you want to follow this tutorual to a T then install it into C:apache also. Click to apache file you downloaded to begin the install. You will be prompted with Server Information. Enter this for now:
Next it will ask you if you want Typical or Custom. For the purpose of this tutorial you must select Custom.
Now it will ask you where you want to install Apache to. We want it in C:apache so lets change the directory. In the directory tree, select the first item in the tree and change it's directory to C:apache.
Next we will change the 2nd item in the directory tree, also to C:apache.
We leave all the rest alone. Click next and finish installing apache.
Installing PHP 4
Unzip the contents of php-4.4.x-Win32.zip to C:php. Make sure you don't have C:phpphp-4.4.x-Win32. This is important.
Navigate to C:phpsapi and COPY the php4apache2.dll file and place it in C:php. In C:php you should see the files php4ts.dll and now php4apache2.dll (amung other things). Take special note of the file name: php4apache2.dll.
Now COPY (Not cut) both php4ts.dll and php4apache2.dll to C:WINDOWSSystem32. This may not be needed but for some it fixes everything, so why not just do it? It will not hurt anything.
Navigate back to C:php and rename php.ini-reccomended to php.ini and COPY it to C:WINDOWS
Adding PHP to Apache as a module
Navigate to C:apacheconf and open httpd.conf in notepad. Search for the string "LoadModule". After you search for "LoadModule" you should see a few things like this:
LoadModule access_module modules/mod_access.so
LoadModule actions_module modules/mod_actions.so
Below the list enter this (Make sure you do not have a pound (#) before it.):
LoadModule php4_module "c:/php/php4apache2.dll"
Now lets do another search for "DirectoryIndex". You should see this:
DirectoryIndex index.html index.html.var
We want it to look like this:
DirectoryIndex index.html index.html.var index.php
Now lets search for AddType, you should see things like below just a little ways down:
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
Add: Make sure you do not have a pound (#) before any of these.
AddType application/x-httpd-php .php
AddType application/x-httpd-php .php3
AddType application/x-httpd-php .phtml
AddType application/x-httpd-php-source .phps
Now PHP Should be installed as an Apache Module.
Installing MySQL
Unzip mysql-noinstall-4.1.x-win32.zip to C:mysql. Again, make sure the path is correct. We don’t want anything but C:mysql.
Now go to Start > Run and type "c:mysqlbinmysqld --install mysql --defaults-file=C:mysqlmy-medium.ini" without the quotes.
Next go to Start > Run and type "net mysql start" without quotes. This will start mysql. if you get an error most likely you did not install mysql to C:mysql.
Lets test it out!
Navigate to C:apachehtdocs and move all the current files into a temp folder, or delete them. Just move them outa the way for now. Create a new index.php file with the contents of:
<?
phpinfo();
?>
Open IE/Firefox and navigate to http://localhost/, If the php info screen is displayed then all is good. You can modify your php.ini file (In C:WINDOWS) to your liking.
Additional Information
You change your document root in apache buy doing the following:
Navigate to C:apacheconf and open httpd.conf in notepad again. Search for DocumentRoot and edit the variable to where ever your website resides. Make not of how the slashes are, you must use a back slash "/" between directorys.
A little ways below that you should see <Directory "C:/apache/htdocs">, edit the variable with the same thing you entered in DocumentRoot just like it says. Make sure you use backslashes also…..
This tutorial will show you how to connect to your MAS90 database via ODBC with PHP.

Click Start, point to Control Panel, double-click Administrative Tools, and then double-click Data Sources(ODBC).
Click the System DSN tab, and then click Add.
Select "MAS 90 32-Bit ODBC Driver" and click next.
Enter in the Data Source Name, in this case, I name it MAS90PHP. Then enter a brief description of the database and the database directory. This is the local directory where your main MAS90 files are located.
Next click the logon tab. In the Company Code field, type in the company code. Your company code is usually a three letter string that is used to uniquely identify the company in MAS90. You will want to create a username and password in MAS90 for PHP to access. This user should be granted permissions for which you want your PHP script to have access too. I won't explain how to do that but you should enter that users username and password here. Also, you should type in a Session ID.
In the options tab, enter in the following information, of course replace with your relevant information. This information should be relatively easy to find.
In the last tab, you'll want to debug your connection string and then debug any errors. If your string comes back looking something like below, your good to go.
Here is some sample PHP code for connecting to your MAS90 database via PHP
// *************************
// Establish Database Connection
// *************************
$db=odbc_connect("DSN=MAS90PHP;","","");
// *************************
// SQL Statement, use general SQL statements here.
// *************************
$sql="SELECT
ItemNumber,
ItemDescription
FROM IM1_InventoryMasterfile
";
// *************************
// Run Query
// *************************
$query=odbc_exec($db, $sql);
while(odbc_fetch_row($query)){
$items['ItemNumber'][]=trim(odbc_result($query, "ItemNumber"));
$items['ItemDescription'][]=trim(odbc_result($query, "ItemDescription"));
}
// *************************
//Print Results
// *************************
print_r($items);


