Having written part of Vista (the weather gadget), you would think that I knew everything there was to know about the operating system. Of course the answer to that is "no way!"
Yesterday I had a bit of fun (interspersed with periodic cursing and much gnashing of teeth) trying to get my Vista box to serve up PHP pages. I thought I would share the experience and what I learned in the process.
Enable Internet Information Server IIS7
Enable ISAPI Extensions
Download PHP
Go to www.php.net/downloads.php to get the latest binary release. Choose the .ZIP version as we won't be running an installer.
Extract the PHP .zip file to c:\php
Copy php.ini-dist to c:\windows\php.ini
Start / Run / cmd (you can also use the little Windows Key + R, then cmd)
From the command line, do the following:
cd \php
copy php.ini-dist c:\windows\php.ini
If you want to enable MySQL, Edit c:\windows\php.ini
(Otherwise skip to this step)
Since you're still in a command window, just type:
notepad c:\windows\php.ini
In notepad, Ctrl+F to find the following line:
;extension=php_mysql.dll
remove the semi-colon (to uncomment it)
Now, Ctrl+F to find the following line:
extension_dir = "./"
change it to
extension_dir = "c:\php\ext"
and save the file.
Copy php_mysql.dll to c:\windows\system32
Since you still have an open command window, go there and type:
cd \php\ext
copy php_mysql.dll c:\windows\system32
I used a new window for the sake of screenshot clarity.
Configure IIS7
Launch InetMgr (Start / Run / Inetmgr)
Click on Handler Mappings
Click on "Add Module Mapping"
Click on "Add Script Map"
Add a Script Map
Request path: *.php
Executable: C:\PHP\php5isapi.dll
Name: PHP
Click Yes on the warning dialog that follows
At this point, actualy, you are done getting PHP to work with IIS7. However, if you are also interested in getting mySql working, there are a few more steps.
Before we download and install mySql, we need to open a port.
Modify the Windows Vista Firewall
Start / Control Panel / Windows Firewall (using classic view)
(HINT) A quick way to get to the Firewall is to use the quick search box above the Vista icon as follows:
Open port 3306 for mySql
Choose "Change Settings"
Click the Exceptions tab
Click the "Add port..." button
Create the following entry
Name: mySql
Port number: 3306
Protocol: TCP
Download the MySQL Installer
I used MySQL 5.1 located at: http://dev.mysql.com/downloads/mysql/5.1.html#win32
Run the Installer
You should be good to go!
Create a test File
To test that all of this effort has been worth the, well, effort, create the following file:
notepad c:\inetpub\wwwroot\phpTest.php
And put the following contents in it:
<?
phpinfo();
?>
Now, test using the following hyperlink:
http://localhost/phpTest.php
Bob's your uncle!
Shannon Norrell
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment