Quoth the RaVeN

Google

(Updated: 08-15-08)

Installing PHP on Windows

I run a Windows 2k3 SBS with IIS very modified. I've had asp running for a while but wanted some options that I could only find with php. I also have mysql installed and since php has the libraries to connect to mysql I decided I wanted this as well for future use. I have found tons of information online on how to install and configure php and mysql but each site seemed to leave a little out, so on this site I will try to combine all the information that worked for me and hopefully keep someone from bumping their head as much as I did.

First, If you are not running a flavor of Windows Server or do not already have IIS installed, save yourself some headache and go here (http://www.wampserver.com/en/)  This is similar to Linux's LAMP server setup in that everything is preconfigured to work together. I personally have no experience with this package but it has come highly recommended. Or  if you are like me running a Windows Server and have IIS  up and functioning and want to install php visit http://php.net go to downloads and get the latest version zip package available. You will want the zip package because it includes alot of extra modules that the installer does not. For those who would prefer a video tutorial click here but the short of it is this:

  1. make a directory 'c:\php5'

  2. copy all the contents of the zip file to that directory

  3. Set the security on 'c:\php5' to include the Read&Execute, List Folder Contents, & Read rights for the users IIS_WPG & IUSR_servername and make sure to replace permission entries on all child objects with entries shown here that apply to child objects

  4. copy php.ini-reccommended to the 'c:\windows' directory renaming it to php.ini (we will edit this file later)

  5. copy php5ts.dll to 'c:\windows\system32'

  6. Open IIS manager...

    1. Right click on Web Sites... Properties... Home Directory (tab)... Configuration...

    2. Add... Browse to 'c:\php5\php5isapi.dll'

    3. under extension enter '.php'... click ok twice...

    4. go to the Documents (tab)... and add 'index.php' as a default content page (changing the order as you see fit)... click ok

    5. Right click on Web Service Extensions... Add a new Web service extension...

    6. Extension name 'PHP'

    7. Click Add... Browse... 'c:\php5\php5isapi.dll'

    8. Check the box 'set extension status to allowed'...  click ok...

  7. PHP should now be active. Create a test file 'index.php' in either your default web site or another of your choosing with only the following:
    <?php
    phpinfo();
    ?>

  8. View this page 'http://localhost/index.php' or wherever you placed it and you should see a php page listing the php version and miscellaneous stats. Success!!

Now for those who wish to use mysql as well either install the newest version from here http://dev.mysql.com/downloads/mysql/5.0.html#win32 and can follow install directions here http://www.iisadmin.co.uk/?p=5 or if you already have it installed as I did from a previous application (and can access the database from the command line or mysql front, etc) you need to enable the mysql extensions. To do this locate the Dynamic Extensions section of your ‘php.ini’ file and either uncomment or add the following lines to the top of the existing list of extensions :

extension=php_mbstring.dll
extension=php_mysql.dll
extension=php_mysqli.dll

Also locate the Paths and Directories section and modify the extension_dir setting

'extension_dir = "c:/php5/ext"'

Once you have done this save the changes in the ‘php.ini’file and then either recycle your PHP web site’s application pool or perform an IISReset for the changes to take effect. Now if you view the php page created earlier you will see that support for mysql is now enabled. One of the many sites I had browsed for help before writing this article left out enabling the php_mbstring.dll.

Hopefully this has helped.

javascript hit counter minutes of headache were saved because of this page.

View My Stats

©2008-9 RaVeN.rkwallace.com. All Rights Reserved.