How To: Install PHP5 on Windows Vista
A lot of people asked me how to install a web server on Windows Vista, well guess what installating PHP on IIS is now easier then ever! Here’s how to do it:
Download and Install PHP
- If you haven’t done it yet, download PHP from http://www.php.net/downloads.php; I used the zip package for this tutorial.
- Unzip the file in C:\PHP. You can unzip anywhere as long as there are no spaces in the path.
- Copy C:\PHP\php.ini-recommended and rename it to php.ini
- Go to Control Panel » System » Advanced Settings » Environment Variables. In the System Variables click Path and then Edit and enter “C:\PHP; “(or “;C:\PHP” if you put it at the end).
- Still in Control Panel » System » Advanced Settings » Environment Variables » System variable; Click New, in Variable Name enter “PHPRC” and in Variable Value enter “C:\PHP”
Note: Instead of doing Step 4 and 5 you could simple copy all non-php dll files to C:\Windows\System32 but It will be harder to uninstall / upgrade
Now that PHP is installed, we need to make some modification to the configuration file (php.ini) to make sure it will work on Windows Vista.
- Create a Session State directory and edit php.ini to point to it. insert session.save_path = “C:\PHP\SessionFolderName” in php.ini
- Modify the PHP Extensions directory. search for extension_dir and set its value to “C:\PHP\ext”
- Enable extensions you plan on using. To do this simply uncomment (remove the semicolon “;”) the ones you want
- php_gd2.dll This will be useful if you plan on manipulating images.
- php_mysql.dll This one is required for MySQL functionality.
There is a lot of extensions, enable whatever you need…
By default, IIS is not installed on Windows Vista, but is available freely… If you don’t know how to install it just follow this link. While installing, make sure you select the ISAPI Extension component or the CGI component. You will need one of these to run PHP on the server. Let’s teach IIS how to handle PHP files.
- Go to Control Panel » Administrative Tools » Internet Information Services (IIS) Manager
- Click on “Handler Mappings”
- Click on the “Add Script Map”
- Fill the dialog box then click OK
- Request Path: *.php
- Executables: C:\PHP\php5isapi.dll
- Name: PHP
- On the “Add Script Map” dialog box, click yes
- Test it!
- Just create phpinfo.php with <?php phpinfo(); ?> in it in c:\inetpub\wwwroot
This entry was posted on Saturday, July 12th, 2008 at 12:16 pm and is filed under Developement, PHP. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.