Manually installing the PHP package
Downloading PHP for Windows
You can find the binary of PHP at
http://www.php.net/downloads.php [
direct link]. The file is 5.2 MB, and is distributed as a single zipped file.
Installing PHP
Extract the zip file to a directory of your choice. I put mine at
H:php.
Some servers might crash if there's a space in the path name (i.e.
H:My
3l33t PHP Installation), so try to steer clear of that.
Copying required files
You'll need to copy the file
php4ts.dll to your
C:WINNTsystem32 folder (or
C:Windowssystem32 for Windows XP). Also copy the file
php.ini-recommended to your
C:WINNT folder (or
C:Windows for XP) and rename it to just plain ol'
php.ini.
And now for more file copying
Due to some changes in the working of Apache 2.0.39, the standard PHP DLL file
for Apache2 will no longer function "out-of-box." This can be solved
easily, by downloading
https://ubbdev.com/files/php4apache2.dll [
direct link]. Save
and copy that file to your
H:phpsapi directory, overwriting any
existing file. Life is good--for the moment, at least.
Editing your php.ini
Open up your newly copied and renamed
php.ini file. Search for
extension_dir
=
and change it to read
extension_dir = H:phpextensions
(making sure to modify it to reflect
your actual path). Search for
doc_root =
and change it to
doc_root = H:httpdocs
where the path is the same as the one you picked for your HTML files back
in step one. Sounds easy enough, right?
We'll leave the rest of the file alone for now, but if you'd like to modify
more on your own, read up at
http://www.php.net/manual/en/configuration.php.
Apache, meet PHP
We're going to run PHP as a module for Apache, instead of as a CGI binary,
because it's more transparent and secure. And you really care about that,
right? You're just waiting for me to get to the good stuff, so here we go.
Open up your
httpd.conf file again (it's the last time, I promise)
and search for
#LoadModule ssl_module modules/mod_ssl.so
. Directly
underneath that line, add
LoadModule php4_module H:/php/sapi/php4apache2.dll
.
To try to keep all the "scripting stuff" in the same spot of my
httpd.conf file, I put the remaining lines necessary for PHP near the line we modified
in order to use Perl before. Search for
AddHandler cgi-script .cgi .pl
and then add this block of code a line or two below that.
#
# To use PHP scripts:
#
AddType application/x-httpd-php .php .php3 .phtml
AddType application/x-httpd-php-source .phps
The final section around that block should look like mine, which is below.
#
AddHandler cgi-script .cgi .pl
#
# To use PHP scripts:
#
AddType application/x-httpd-php .php .php3 .phtml
AddType application/x-httpd-php-source .phps
#
# For files that include their own HTTP headers:
Restarting the server
After making the outlined changes to
httpd.conf, save and close the
file. Then, double-click the
Apache Service Monitor icon in the
tray to pop open--you guessed it--the Apache Service Monitor! Click the
Restart button and then wait a few seconds while Apache shuts down and starts back
up.
When the server comes back online, your screen should look like mine; also
take note of the text at the bottom of the window that reads
Apache/2.0.39
(Win32) PHP/4.2.2-dev. This just means that all is well in Apache land.
Your first PHP script
Copy 'n paste
[/code]into a new file in <kbd>Notepad</kbd> and then save it as<em> H:httpdocsphpinfo.php</em>. To recap, the entire file should read [code]
Now browse to
http://127.0.0.1/phpinfo.php and check to make sure
that what you see looks like my screen shot below.
If you can't see this screen, you hit a bump in the road somewhere along the
way. Your first move should be to visit
http://www.php.net/manual/en/install.apache.php.
Start by reading the newest comments (the ones at the very bottom of the page)
to check if your problem has already been encountered by another user.
Enabling compressed output
Optionally, you can choose to compress PHP output using
zlib compression.
This cuts down on your bandwidth and also helps pages to load faster. If you'd
like to turn zlib on, just follow the steps below.
According to the zlib Web site (
http://www.gzip.org/zlib/), zlib is "a
free, general-purpose, legally unencumbered--that is, not covered by any patents--lossless
data-compression library for use on virtually any computer hardware and operating
system." So there you have it, straight from the horse's mouth. Let's
turn it on already, shall we?
In
php.ini, search for
zlib.output_compression = off
and change it to read
zlib.output_compression = on
. All you have
to do next is search for
;extension=php_zlib.dll
and change the
line to read
extension=php_zlib.dll
. Browse to
http://127.0.0.1/phpinfo.php once more and then scroll down to the section about zlib. You should see what
I see.
Page 4:
Installing MySQL as a service