PHP  
downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | my php.net 
search for in the  
<Compiling for MacOS X ClientManual Installation Steps>
view the version of this page
Last updated: Sun, 26 Mar 2006

Chapter 6. Installation on Windows systems

This section applies to Windows 98/Me and Windows NT/2000/XP/2003. PHP will not work on 16 bit platforms such as Windows 3.1 and sometimes we refer to the supported Windows platforms as Win32. Windows 95 is no longer supported as of PHP 4.3.0.

There are two main ways to install PHP for Windows: either manually or by using the installer.

If you have Microsoft Visual Studio, you can also build PHP from the original source code.

Once you have PHP installed on your Windows system, you may also want to load various extensions for added functionality.

Warning

There are several all-in-one installers over the Internet, but none of those are endorsed by PHP.net, as we believe that the manual installation is the best choice to have your system secure and optimised.

Windows Installer

The Windows PHP installer is available from the downloads page at /downloads.php. This installs the CGI version of PHP and for IIS, PWS, and Xitami, it configures the web server as well. The installer does not include any extra external PHP extensions (php_*.dll) as you'll only find those in the Windows Zip Package and PECL downloads.

Note: While the Windows installer is an easy way to make PHP work, it is restricted in many aspects as, for example, the automatic setup of extensions is not supported. Use of the installer isn't the preferred method for installing PHP.

First, install your selected HTTP (web) server on your system, and make sure that it works.

Run the executable installer and follow the instructions provided by the installation wizard. Two types of installation are supported - standard, which provides sensible defaults for all the settings it can, and advanced, which asks questions as it goes along.

The installation wizard gathers enough information to set up the php.ini file, and configure certain web servers to use PHP. One of the web servers the PHP installer does not configure for is Apache, so you'll need to configure it manually.

Once the installation has completed, the installer will inform you if you need to restart your system, restart the server, or just start using PHP.

Warning

Be aware, that this setup of PHP is not secure. If you would like to have a secure PHP setup, you'd better go on the manual way, and set every option carefully. This automatically working setup gives you an instantly working PHP installation, but it is not meant to be used on online servers.



add a note add a note User Contributed Notes
Installation on Windows systems
Brian
19-Apr-2006 10:09
I got a problem with PHP 5.1.2.

I got this annoying bug that I can't shake off and nobody helps me, or they just don't know how to fix the problem.

The problem is im getting a "The directory name is invalid." error.

I tried to reset permissions daily but then says the same error again. I also did the "Check that the file exists" checkbox but no luck.

I tried to allow permissions to PHP directory, and php.ini with no luck.

Also no matter what I do I cannot solve this problem.
ratkinson at tbs-ltd dot co dot uk
04-Apr-2006 03:28
When installing onto the Windows IIS platform, ensure you add the PHPRC Server Variable to point to your PHP.INI file.

Also, add '.INI' to the FILEEXT Server Variable. Failure to add these could stop the PHP engine being able to find your PHP.INI file, and none of your modifications will be read.

Rob.
Valdinei J.
21-Mar-2006 11:17
If you get problems with ISS 6 and PHP try this:
http://www.visualwin.com/PHP-ISAPI/
I've tried to install in a different folder than c:\php but when you add the application extension mapping the ISS does not accept a path with spaces (like c:\program files\php).
niatech
01-Mar-2006 06:36
Thought someone would save some time and headaches by using this post.

Our tech department is migrating to Windows 2003 Server and they have some complex security implementations between our Web Servers and our Application (COM) servers.

If you have this type of scenario and are receiving the "Warning (null)(): Unable to lookup.... Access is denied." error, it is because the "Identity" in the Web Server's application pool does not have sufficient permissions to connect to the Application (COM) Server.

To fix this:

- create a new Application Pool
- right click the new pool and select "properties"
- click on the "Identity" tab
- change the permissions from "Network Service" to a user on the Web Server who has access to call the Application (COM) server.
- right click the application pool
- click "start"
- right click your web site
- click on the "Home Directory" tab
- change the application pool to the new application pool you've just created.
- restart IIS

Hopefully this will save someone some time and headaches.
mach
28-Feb-2006 04:15
I've installed Apache + PHP on a Windows machine of which I'm not an administrator.

I found out it was necessary to change the permissions of the httpd.conf file on C:\Program Files\Apache Group\Apache\conf in order to have everything working. Since I'm also using cygwin this was simply done with: >chmod 755 httpd.conf.
lukasz at szostak dot biz
15-Jan-2006 05:50
You can have multiple versions of PHP running on the same Apache server. I have seen many different solutions pointing at achieving this, but most of them required installing additional instances of Apache, redirecting ports/hosts, etc., which was not satisfying for me.
Finally, I have come up with the simplest solution I've seen so far, limited to reconfiguring Apache's httpd.conf.

My goal is to have PHP5 as the default scripting language for .php files in my DocumentRoot (which is in my case d:/htdocs), and PHP4 for specified DocumentRoot subdirectories.

Here it is (Apache's httpd.conf contents):

---------------------------
# replace with your PHP4 directory
ScriptAlias /php4/ "c:/usr/php4/"
# replace with your PHP5 directory
ScriptAlias /php5/ "c:/usr/php5/"

AddType application/x-httpd-php .php
Action application/x-httpd-php "/php5/php-cgi.exe"

# populate this for every directory with PHP4 code
<Directory "d:/htdocs/some_subdir">
   Action application/x-httpd-php "/php4/php.exe"
   # directory where your PHP4 php.ini file is located at
   SetEnv PHPRC "c:/usr/php4"
</Directory>

# remember to put this section below the above
<Directory "d:/htdocs">
   # directory where your PHP5 php.ini file is located at
   SetEnv PHPRC "c:/usr/php5"
</Directory>
---------------------------

This solution is not limited to having only two parallel versions of PHP. You can play with httpd.conf contents to have as many PHP versions configured as you want.
You can also use multiple php.ini configuration files for the same PHP version (but for different DocumentRoot subfolders), which might be useful in some cases.

Remember to put your php.ini files in directories specified in lines "SetEnv PHPRC...", and make sure that there's no php.ini files in other directories (such as c:\windows in Windows).

And finally, as you can see, I run PHP in CGI mode. This has its advantages and limitations. If you have to run PHP as Apache module, then... sorry - you have to use other solution (the best advice as always is: Google it!).

Hope this helps someone.
phil at pelanne dot com
05-Jan-2006 07:22
For those of you trying to install PHP 4 and PHP 5 concurrently on a windows 2003 box, there is just one rule you need to adhere to in order to make it work: 

- Don't have either of them in c:\php\.
- Don't have a php.ini in your system32 directory.

Put PHP 4 into a directory called c:\php4\.  Put its php.ini in there, and make sure all the paths reflect the c:\php4 directory.

Likewise, put PHP 5 into a directory called c:\php5\.  Put its php.ini in there, and make sure all the paths reflect the c:\php5 directory.

Add them as allowed script mappings in your iis extensions area, and have fun!
cormierma_at_csdcso.on.ca
21-Dec-2005 11:34
Note to windows server 2003 users

If you install php5 ISAPI on windows server 2003 / IIS and keep getting a 404 when you try to view a php script don`t just activate "all unknown ISAPI extensions" but also activate "All Unknown CGI Extensions".
Cevher Bozkur
13-Oct-2005 04:37
I've installed php 5.0.5 with the ISAPI module, as the isapi dll file (php5isapi.dll) resides in the php root directory, I didn't have trouble in my installation (In php4 this dll file is in sapi directory and it should be moved to php root directory).

I changed some of my settings in php.ini file and restart IIS Web site,but my changes weren't applied.

Then I go to Control Panel>Administrative Tools>Services and restart the IIS Admin Service.

Everything worked like a charm...
william keith
29-Sep-2005 01:51
Dirt Simple Install Guide For PHP5/W2K Servers

For those of us out there who still have 2K servers, this is a great 3 min step by step to get you up and running.

http://www.onlamp.com/pub/a/php/2000/12/14/php_admin.html

Thanks to it's author, Darrell Brogdon!
thedeadraptor2000 at yahoo dot com
30-Aug-2005 06:02
Note regarding PHP4 Installation on IIS5 + Win2K

Tip: Don't install PHP4 on Directories with spaces in between.

I've had problems Installing PHP 4.0.0 on IIS5, Win2k's default web server, spanish version (I live in Colombia). I've had HTTP 500 Errors and I followed all instructions step by step, but nothing seemed to work.

I solved the problem eventually, and I think it had something to do with the fact that I have installed PHP4 manually and placed it in the directory "C:\Archivos de programa\php-4.4.0-Win32" ('Archivos de programa' stands for 'Program Files'), a directory with spaces in between.

When I added the application mappings for "C:\Archivos de programa\php-4.4.0-Win32/sapi/php4isapi.php", An error would ocurr and a message along with it: "Escriba una ruta de acceso valida", as in "Write a valid access rute", as in "I can't find the file".

I thought i had it when I encapsulated it with Doublequotes ("), but that didn't work either.

As a final long shot, I copied the php4isapi.dll to the windows/system32 directory and 'WALA!' It worked.

I'm not sure, but i suspect that it had to do with spaces in between directory names, so avoid those, or copy the isapi module to another directory.

Hope this helps someone!
Doug Brower
26-Aug-2005 05:44
Kudos to John Kerner's recommendation (above) to use:
http://www.tjitjing.com/code/article.php?subject=php5_iis6_install
for installation on Windows. I followed the instructions with Windows XP Professional on a dev machine, rather than Windows 2003 Server as described in the note. Only difference was to omit his step 4.a. Worked like a champ!
wappa at hotmail dotandthekangaroo com
05-Aug-2005 06:16
Don't forget if you are getting ACL exceptions to reading the test php page you have created you MUST share the PHP directory or the resources PHP uses to "everyone" but remember use restricted access for security.
jp at iticonsulting dot nl
23-Jul-2005 07:42
If you get 404 page not found on Windows/IIS5, have a look at C:\SYSTEM32\INETSRV\URLSCAN

There is a .ini file there that prevents some files from being served by IIS, even if they exist, instead IIS will give a 404. The urlscan logfile (same place) should give you some insight into what parameter is preventing a page from loading, if any.
Feroz Zahid
08-Jun-2005 11:41
In order to run php scripts with php.exe CGI instead of php4isapi.dll under IIS, following steps can be followed.

i) Add a web service extension for PHP using IIS manager. Choose a web service extension name like 'PHP' and add your php.exe path in the 'file location' while adding the required file e.g. 'C:\php\php.exe' in the Add extension dialog box. Don't forget to 'Allow' the extension file.

ii) Open php.ini file located at %systemroot%. Set the following variables to the shown values.

cgi.force_redirect = 0
cgi.redirect_status_env = ENV_VAR_NAME

iii) In your websites, add Application Mapping for '.php' and set the executable path to your php.exe file path.

You can test whether PHP is running or not and other PHP settings using the following simple PHP script.

<?php>
phpinfo();
?>

Feroz Zahid
ferozzahid [_at_] usa [_dot_] [_com_]
steve at lonetree dott com
03-Jun-2005 03:56
Hello all. Well, I'm an experienced iis admin, but I tell you, I had a devil of a time getting it to run correctly. My issue was that I was trying to do everything via term services...use this link
http://www.peterguy.com/php/install_IIS6.html
to view some seriously interesting notes on this. This guy's info was SPOT ON and worked perfectly for me. Don't forget to give Network Service group read/execute access to your web content...
donald at netriver dot net
04-May-2005 11:21
On the Windows 2003 & IIS6 platform, you can run different websites on different versions & copies of PHP. This is useful in at least two cases:

  1. You want one website on your box to have register_globals on, but since you're running IIS, you cannot specify that in an .htaccess file. And you definately don't want register_globals on for the rest of the websites.
  2. You want to run different versions of PHP for different websites, or even just different extensions. Say you wanted one site to use 4.0.5 and a different site to use 4.1.11.

Its simple, just:
  1. Move your php.ini file from your c:\windows\ directory directly to your php directory (by default that would be c:\php\)
  2. Make sure you don't have a php.ini file in any other location that would supercede the c:\php\php.ini file. Using phpinfo(); is useful here.
  3. Have your alternate version of php (either a different version or a different php.ini) have its own install directory, like c:\php4RG\ or c:\php405\.
  4. In the Home Directory Configuration for your website, specify the .php extension to use a different script, pointing it at the alternate directory.
gary at garyslittlecompany dot com
26-Apr-2005 11:57
php compiled with eapi on windows.  Spend hours trying to find something that would work for the

"Loaded DSO /..../php4apache.dll uses plain 1.3 API, this module might
crash under EAPI! (please recompile it with -DEAPI)".

Finally compiled it.

If you would like the binaries or instructions on how I did it email me.

Gary
John Kerner
20-Apr-2005 01:23
This is a great instruction for installing php 5 on a windows 2003/iis 6 server. There are many other instructions out there (several listed here) but this is by far the easiest to follow and the only one I found that actually works with php 5 and iis 6.

http://www.tjitjing.com/code/article.php?subject=php5_iis6_install
philip
04-Mar-2005 08:51
Installation instructions for PHP+Windows with the Jigsaw web server can be found here:
* http://www.circle.ch/servers/
doyouunderstand at gmail dot com
04-Mar-2005 02:31
For those having trouble installing PHP 5+ ISAPI for IIS 6 (on Windows 2003 server), who have tried everything on this site and all over the net, with no success (like I did) - try the following before throwing your server out of a 3rd story window.

http://www.benmardesign.com/IIS_PHP_MYSQL_setup/php_setup.html

It was the only thing that worked out of all the many solutions I tried.

Probably some other solutions would've worked as well, but in my frusterated state of mind, this explanation was the clearest. 

My problem was that in addition to adding the the Web service extension, I was not adding the ISAPI extensions for the websites in IIS Manager manaully.  ALSO, remember to reboot after the changes on the site listed above.  It's the only thing he forgot to mention, and depending on your setup, you may need to reboot to register the dll moves and changes made.  (IIS restart will not re-register dlls).
Steve N
02-Feb-2005 06:33
Just a note following on from Luis D regarding adding the pgp4ts.dll as a Web Server Extension.

I just used the latest php-4.3.10-installer.exe from php.net and had the problems where .php files could not be found.

In order to get them to work I added and allowed the php.exe as a Web Service Extension and not the php4tx.dll.

Cheers,

Steve
claudio_jvt at hotmail dot com
14-Jan-2005 02:38
One very helpfull note to Win2003 iis6 users:
If you'd like to use isapi in the web service extensions and you're in a development server (or even if your php.ini config file changes frequently), here's what you can do:

Php.ini runtime changes:
Create a new application pool in iis:
iis->select server->application pools->new application pool
                 Use default settings;
     go to the application pool you've created, properties->
   check the "Recycle worker process" option, and give it a small value (10 is nice :) ).

Now go to your site (or virtual directory site)-> properties->
change the application pool to the newly configured appPool.

At this moment, is good to make a iss restart (note this is the only resart needed).

Your site is now semi-runtime changed :)
You can try it with the usal php info() test. Change something in the php.ini and check the number of requests it takes to use the new configuration.

The downside of this approach (wich is still better than to use php-cgi.exe): the process is recycled, so all the configuration in php.ini is read every N requests - with php-cgi.exe, this would happen for every request, so.. is a good solution.

Again, be carefull when using this in a production environment, since the load can increase (not sure how much, but it will certainly increase).

And keep in the new appPool JUST the php sites that require runtime changes in php.ini !

------
You've helped me, so I help you ;)
Tks
chris at move dash media dot com
10-Jan-2005 02:39
Note to windows users, if you are trying to install php5 ISAPI on windows server 2003 / IIS and getting a 404 when you try to view a simple php script, even though everything else seems to be right...  click into "web service extensions" from IIS and either add a new web service extension, or click onto "all unknown ISAPI extensions" and click allow.
ntadmin at aplus dot net
27-Aug-2004 09:53
When configuring application pools with configurable
accounts instead of NETWORK SERVICE or LOCAL SYSTEM
remember to add the user to the correct security contexts found here:

Note: Watch for wordwrap
http://www.microsoft.com/resources/documentation/
WindowsServ/2003/standard/proddocs/en-us/Default.asp?
url=/resources/documentation/WindowsServ/2003/standard/
proddocs/en-us/sec_acc_wpenable.asp

Otherwise you will recieve 403 errors.
Sean Boulter
16-Apr-2004 12:00
This fixes the "The directory name is invalid" error.

In IIS 5.1 on Windows XP Pro, Go into the Internet Information Services, and into the properties of the virtual directory where the problem occurs.  On The 'Virtual Directory' tab, click on the 'Configuration...' button.  Select the '.php' extension, and press 'Edit'.  On the bottom, Check the 'Check that file exists' checkbox.
Luis D
27-Mar-2004 02:49
This is just to clarify on a posting on this page that states the nescesity of allowing all unknown cgi Extensions in Windows 2003 IIS 6. Although this will work and it should be consider as a quick option for an itranet solution with no web access at all.

This poses a very serious security problem and its not the best course of action, in my opinion.  The proper way of making this work will be to actually enable the extension that you want to execute.  After verifying that the .php extension is present, simply go to "Web Service extensions" in the IIS Manager and click on "Add a new web service extension";

Once the "new web service extension" opens:

1- Add the "extension name" field, please enter "PHP" (or what ever you wanna call it) Other more conservative admins will say call it what it is and always input ".php".  Its up to you!
2-Click on the "add" button and browse to the php4ts.dll file on your c:\PHP (default)  and then click open --> OK and set the checkmark under "set extension status to allowed" click OK and thats it!!!

If you missed the checkmark moment cause you are just so impatient, like me, then simply select the extension on the web service extensions windows and click ALLOW.

This is a very simple process and it will work everytime.

I hope this helps, as I have found several things in this forums that are incredibly helpfull!!

PS: For the non programmer, it is a good practice to install mysql and a free php forum like bb2 to test how well your php IIS and mysql is working.
brian at schau dot com
09-Mar-2004 03:57
Guys,

I've just updated my page "Compiling Apache, PHP and foreign modules on a Win32 platform" to cover the process for Microsoft Visual Studio .NET 2003 users.

The page is located at:

http://www.schau.com/apachephp/apachephpwin32/index.html

Enjoy.

Kind regards,
Brian
ferchland at computer-kontor dot de
06-Feb-2004 06:51
If need a php4apache.dll compiled with EAPI _and_ you run Apache with mod_ssl, use the Apache from
http://hunter.campbus.com/

This is already a binary for win32, but the *.lib and headers are included.
ungdi at hotmail dot com
21-Jan-2004 11:36
Under a Windows 2003 and IIS 6.x installation of PHP, it is interesting to note that by default in most cases, the "DefaultAppPool" for the "Default Web Site" is running under the security context of "Network Service" which maybe too restrictive. This results in a 403: Forbidden error every time you try to access a PHP page.

You have several options to remedy the problem:
an obvious one is to make it run as the "Local System", but that may be too much power for some administrators' tastes.

The other option is at the IIS Manager,
go to the computer's "Application Pools" folder,
and go to the properties dialog box of the "DefaultAppPool",
and then to the "Identity" tab, and select the "Configurable" identity of "IWAM_[COMPUTER_NAME]" as the security context. This will make the application pool run the way it did in the previous versions.

This solved the repeated problems of the 403 errors. However, do not forget to give permission to "IUSR_[COMPUTER_NAME]" and "IWAM_[COMPUTER_NAME]" appropriate directory permissions for your web directories as stated above.
yellowducklings at hotmail dot com
15-May-2003 06:29
Very readable article on installing php on windows

http://www.macromedia.com/devnet/mx/dreamweaver/articles/php_iis.html
spf at users dot sf dot net
19-Aug-2002 06:55
To allow acWEB.sf.net win32-webserver and Eserv 2.98 (www.eserv.ru) web-server run PHP 4.2.2 without problems with FORCE_REDIRECT you should set "cgi.force_redirect = Off" in php.ini in windows directory.
adam dot swick at pantellos dot com
15-Mar-2002 07:36
IIS 5: If you change the application mappings for PHP (for example, from CGI to ISAPI module), reboot after the change is made.  The PHP Application Mapping change may cause a conflict if ISAPI applications are cached.
mike at schild dot com
01-Aug-2000 08:44
It's a hard way to get work php on win98/PWS... but with this comment-page I found it out how it works:<br>
- error 403: give read/write rights to the directory. You can do this by clicking the right mouse key on the directory in the explorer.<br>
- html file in a dos box: 1) clean the "doc_root" line in the php.ini file.  2) start personal web-manager / go to 'advanced' / make for your web-default-directory a virtual directory with all possible rights.<br>
On my system it works now!

<Compiling for MacOS X ClientManual Installation Steps>
 Last updated: Sun, 26 Mar 2006
show source | credits | sitemap | contact | advertising | mirror sites 
Copyright © 2001-2006 The PHP Group
All rights reserved.
This mirror generously provided by: Playfuls.com
Last updated: Wed 19 Apr 2006 11:13:08 AM EEST EEST