Delicious Bookmark this on Delicious Share on Facebook SlashdotSlashdot It! Digg! Digg



PHP : Installation and Configuration : Installation on Windows systems

Chapter 4. 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 using one of the official windows packages from » http://www.php.net/downloads.php is the best choice to have your system secure and optimised.

Windows Installer (PHP 5.2 and later)

The Windows PHP installer for later versions of PHP is built using MSI technology using the Wix Toolkit (» http://wix.sourceforge.net/). It will install and configure PHP and all the built-in and PECL extensions, as well as configure many of the popular web servers such as IIS, Apache, and Xitami.

First, install your selected HTTP (web) server on your system, and make sure that it works. Then proceed with one of the following install types.

Normal Install

Run the MSI installer and follow the instructions provided by the installation wizard. You will be prompted to select the Web Server you wish to configure first, along with any configuration details needed.

You will then be prompted to select which features and extensions you wish to install and enable. By selecting "Will be installed on local hard drive" in the drop-down menu for each item you can trigger whether to install the feature or not. By selecting "Entire feature will be installed on local hard drive", you will be able to install all sub-features of the included feature ( for example by selecting this options for the feature "PDO" you will install all PDO Drivers ).

Warning:

It is not recommended to install all extensions by default, since many other them require dependencies from outside PHP in order to function properly. Instead, use the Installation Repair Mode that can be triggered thru the 'Add/Remove Programs' control panel to enable or disable extensions and features after installation.

The installer then sets up PHP to be used in Windows and the php.ini file, and configures certain web servers to use PHP. The installer will currently configure IIS, Apache, Xitami, and Sambar Server; if you are using a different web server you'll need to configure it manually.

Silent Install

The installer also supports a silent mode, which is helpful for Systems Administrators to deploy PHP easily. To use silent mode:

msiexec.exe /i php-VERSION-win32-install.msi /q

You can control the install directory by passing it as a parameter to the install. For example, to install to e:\php:

msiexec.exe /i php-VERSION-win32-install.msi /q INSTALLDIR=e:\php

You can also use the same syntax to specify the Apache Configuration Directory (APACHEDIR), the Sambar Server directory (SAMBARDIR), and the Xitami Server directory (XITAMIDIR).

You can also specify what features to install. For example, to install the mysqli extension and the CGI executable:

msiexec.exe /i php-VERSION-win32-install.msi /q ADDLOCAL=cgi,ext_php_mysqli

The current list of Features to install is as follows:

MainExecutable - php.exe executable
ScriptExecutable - php-win.exe executable
ext_php_* - the various extensions ( for example: ext_php_mysql for MySQL )
apache13 - Apache 1.3 module
apache20 - Apache 2.0 module
apache22 - Apache 2,2 module
apacheCGI - Apache CGI executable
iis4ISAPI - IIS ISAPI module
iis4CGI - IIS CGI executable
NSAPI - Sun/iPlanet/Netscape server module
Xitami - Xitami CGI executable
Sambar - Sambar Server ISAPI module
CGI - php-cgi.exe executable
PEAR - PEAR installer
Manual - PHP Manual in CHM Format

For more information on installing MSI installers from the command line, visit » http://msdn.microsoft.com/library/en-us/msi/setup/command_line_options.asp

Upgrading PHP with the Install

To upgrade, run the installer either graphically or from the command line as normal. The installer will read your current install options, remove your old installation, and reinstall PHP with the same options as before. It is recommended that you use this method of keeping PHP updated instead of manually replacing the files in the installation directory.

Code Examples / Notes » install.windows

lukasz

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.


ratkinson

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.


ntadmin

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.


yellowducklings

Very readable article on installing php on windows
http://www.macromedia.com/devnet/mx/dreamweaver/articles/php_iis.html


bh jodo kast

Use WAMP.
WebServ is available at SourceForge.
Getting PHP to work in IIS is not worth the trouble (I left comments about this in the appropriate section).
Instead WAMP has everything you need with the WebServ package.  Installs great, works great, MySQL, PHP, ActivePerl.  It's a dream.


ungdi

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.


amoo_miki

Trying to get PHP run under IIS7 (on Vista) you might find that PHP crashes at startup.
The reason seems to be GD2 needs mbstring while the attempt to load GD2 is being made before mbstring is loaded. While it was clear that an attempt to load it was made by GD2, but it never got loaded causing the crash and error.
Simply moving mbstring to the top of the list solved the issue.
Load mbstring as the first extension in your php.ini.


spf

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.

niatech

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.


luis d

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.


john kerner

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


max dot floden

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/blog /2006/05/php5-with-iis6-on-windows-server-2003.html
(Updated with new/corrected url to original note by John Kerner on 20-Apr-2005 03:23
Had to put a space after blog in url to be able to post note - it does wrap fine due to all dashes but refuses to be submitted)


sean boulter

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.


ltomlin

The user (jlevy) is correct,  I had the same problem with version 5.2.1, once I removed the quotations, the isapi loaded gracefully

i_robot73

Running on Win2k3 x64 w/ IIS6.  Followed the BASIC setup (unzip, PHPRC, add extension to IIS) and still no go.
Wasn't until I enabled x86 that it 'popped':
cscript d:\inetpub\adminscripts\adsutil.vbs SET W3SVC/AppPools/Enable32bitAppOnWin64 1
No security issues that needed fixing.  Test .php file came up like a champ!


snapper

Regarding the "No input file specified." problem where 404 error pages aren't sent if the requested non-existent file ends in .php, this was helpful to me . . . http://www.phpbuilder.com/board/showthread.php?t=9212
In a nutshell:
In IIS Management Console (v5.1 in my case), select "Default Web Site", right-click and select "Properties", "Home Directory" tab, "Configuration..." under Application Settings, "Mappings" tab, select the line for the .php file extension, select "Edit" and check these two things:
1) ensure that executable C:\PHP\php5isapi.dll filename is not truncated
2) ensure there is a tick in the box next to "Check that file exists".
Click OK, OK, OK.
Cheers.


winterspan -

READ HERE If installing PHP 5.x on Windows Server 2003 / IIS 6.x ...
It was extremely frustrating getting this to work, so hopefully my struggle will allow others to do this the *easy* way.
BEFORE installing PHP 5 from a web tutorial (a good one found here: http://www.peterguy.com/php/install_IIS6.html)
You need to READ THESE TIPS:
#Necessary Permissions For WinServer 2003 / IIS6.0#
These are the permission settings I found to work well with good security:
NTFS permissions (right-click file or folder, select preferences, go to security tab)
1) PHP Install folder -> You need to give NT account: 'Network Service' read/execute permissions on the 'php' install folder (e.g., C:\\PHP). If you have a TMP or SESSION folder within the main PHP folder, you need to give account 'Network Service' read/execute AND write access on those folders.  *(You DO NOT need to give the anonymous internet user account: 'IUSR_[name]' ANY permissions on the PHP INSTALL files themselves. )*
2) You DO need to give account: 'IUSR_name' Read/execute
permissions on the actual WWW root folder and web .php files (if you want to apply to all sites) or each websites WWW root and .php files if running multiple sites.
3) Within the IIS 6.0 console itself, in the website's preferences (right click on ind. site or 'websites' node to apply to all sites -> select preferences) on the
'Directory Security' tab -> click edit, and if you wish to allow anonymous access to your site, check the anonymous access box and be sure to enter account: 'IUSR_name'.
4) *MOST IMPORTANT*
As mentioned by a few others, install php and configure the php.ini WITH NO EXTENSIONS AT FIRST. The reason being if one of the extensions fail, the error dialog will pop up OUTSIDE of a terminal services window (remote desktop). So you will NOT BE ABLE to click on the error, and the websites php file you are trying to load in your browser will hang indefinately (after having this happen for 12 hours I almost went insane trying to figure out the problem) LOL.
Then when you have successfully loaded a test php page in the browser, go back to the php.ini file and add extensions in one at a time.
If YOU have any tips I haven't included, email me. Again,
I am not a professional, still a student in learning. :)
Now that you have read that, go back to the link I placed near the top, and follow his tutorial for general installation/setup.


jcwebb

PHPv522 configuration considerations (php.ini) on Win3k(iis6)
cgi.force_redirect = 0
++ You MUST set this (its commented out by default)
two new settings are included...
session.save_path = "C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\php\session"
upload_tmp_dir = "C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\php\upload"
++ sessions will fail: $_SESSION['something'] unless you deal with permissions on the new location,
or simply comment out the session.save_path and go back to default "c:\windows\temp"


gary

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


imi

PHP 5.2.3 under IIS 5.1 (as ISAPI) and Windows XP
If you have trouble trying to get run the combination above using PHP installer please make sure that your executable path for .php file on IIS has been written correctly.
Start->Control Panel->Administrative Tools->Internet Information Services-> (then select your web site) ->Properties->Home Directory->Configuration->Mapping and then change the Executable Path for .php files from C:\PHP\php5is~1.DLL to C:\PHP\php5isapi.dll


claudio_jvt

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


donald

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.


cjbj

Notes on configuring IIS and PHP to use Oracle are at http://blogs.oracle.com/opal/2006/05/01#a24

chris

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.

cormierma_at_csdcso.on.ca

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".


thedeadraptor2000

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

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!


steve n

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


mark riordan

Jeremy Griffith's suggestion worked for me:
The PHP 5.2.3 installer configured my IIS to use an 8.3 filename for the .php DLL (namely PHP5IS~1.DLL).  Changing this to the full path to php5isapi.dll fixed my 404 problems.
I made the change in Internet Information Services (IIS) Manager, on the Home Directory tab, using the Configuration... button and searching through Application Extensions for .php.


micahsutton

i_robot on 22-Apr-2007 07:30 pointed out a very important point for those using the 64bit version of server 2003. You must enable x86 execution or you will get an error about php not being a valid win32 application.

mike

It's a hard way to get work php on win98/PWS... but with this comment-page I found it out how it works:
- 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.
- 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.
On my system it works now!


philip

Installation instructions for PHP+Windows with the Jigsaw web server can be found here:
* http://www.circle.ch/servers/


feroz zahid

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_]


fabrizio dot barbarino

In order to enable your x64 version of Windows 2003 Server executing the php*.dll through IIS, you can execute the script shown here:
http://technet2.microsoft.com/windowsserver/en/library/
36f8964c-cf86-44cf-94a4-2873ad0d175f1033.mspx?mfr=true
I've tested it with Windows 2003 Server x64 SP2 and PHP 5.2.3 and it works.
Good work,
Fabar


casper

In addition to osoto3 at hotmail dot com
I was having trouble with Win2003, I didn't have quotes but the name was truncated as C:\PHP\php5is~1.dll I just renamed to C:\PHP\php5isapi.dll and all was working fine.


greg heffernan

IIS6.0 (on Windows 2003 Server) kept displaying 404 Page Note Found... I performed both excellent tips from below dated 21-Jun-2007 04:46 (Jeremy Griffith) and 11-Jun-2007 06:56 (Klugg).
However, simply setting...
doc_root =
in php.ini did not work for my system?
So I tried commenting it out completely and restarting IIS and presto pages where being found and displayed!


yacahuma

IIS6 AND PHP5 on w2k3
1.download php and unzip to c:\php
  - also create c:\php\sessions
2.add c:\php to you path
  -right click mycomputer,properties,advance,env variables
2.On IIS Manager add web service extension
  -name: php isapi
  -req files: c:\php\php5isapi.dll
3.Now let iis know what to do with .php
 -On iis Manager,right click Web Sites, properties, home directory tab, configuration button, add button
    executable: c:\php\php5isapi.dll
    extension: .php
    limit to: GET,POST,HEAD
4. rename php.ini-recommended to php.ini
 you can copy php.ini to c:windows or modify the registry to look for php.ini in c:\php
  to use the registry create a php.reg file with the following inside. after this just double click. do not put the lines.
-------------------------------------------------
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\PHP]
"IniFilePath"="C:\\php"
-------------------------------------------------
5. modify php.ini with
short_open_tag = On
extension_dir = "c:\php\ext"
cgi.force_redirect = 0
6. the web sites are going to be using the default pool. this runs under network service. go to c:\php and give the network service  read& execute, list folder content,read
 -go to c:\php\sessions and add write and modify access network service


adam dot swick

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.

smugwimp

If you make changes to your PHP.ini file, consider the following.
(I'm running IIS5 on W2K server. I don't know about 2K3)
PHP will not "take" the changes until the webserver is restarted, and that doesn't mean through the MMC.  Usually folks just reboot. But you can also use the following commands, for a much faster "turnaround".  At a command line prompt, type:
iisreset /stop
and that will stop the webserver service.  Then type:
net start w3svc
and that will start the webserver service again.  MUCH faster than a reboot, and you can check your changes faster as a result with the old:
<?php>
phpinfo();
?>
in your page somewhere.
I wish I could remember where I read this tip; it isn't anything I came up with...


jeremy griffith

If you have installed using the msi file, allowed it to configure IIS6 for you using the default directory, and are receiving a 404 error (specifically 404 2 error in your log file), then you need to modify the "application extension" for .php to include the full quoted path.  The default uses the old 8.3 convention which is not considered the same by IIS, and therefor the web extension isn't allowed.

valdinei j.

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).


jp

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.


cam mcvey

If you are using Application Pool Isolation and you're trying to get PHP to run as CGI and you're getting 403 errors, try looking at this article (watch the word wrap):
http://www.servertastic.com/articles/2005/11/
unable-to-run-perl-or-php-in-application-pool-isolation/


jack hardie

If you are installing PHP on Vista just go to David Wang's blog. http://blogs.msdn.com/david.wang/
archive/2006/06/21/HOWTO-Install-and-Run-PHP-on-IIS7-Part-2.aspx

Magic!


nestor custodio

If the path to your PHP directory has spaces (e.g. "C:\\Program Files\\PHP") and IIS gives a 500+ error or responds with "The specified module could not be found." when you try to run a PHP script, try changing the ISAPI DLL's path in IIS (in the "Home Directory" tab, under "Configuration...") to the 8.3-equivalent path.

That is, use C:\\PROGRA~1\\PHP\\php5isapi.dll instead of "C:\\Program Files\\PHP\\php5isapi.dll".


ferchland

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.


klugg

If by any chance you tried to install PHP 5 and marry it with IIS (like me), you might get into quite a frustrating situation, where separately IIS works, PHP works, but together they spit at you a "no input file specified" without further information.
The solution: don't set doc_root in php.ini to "c:\inetpub"! Just leave it empty or comment it out.
Don't forget to restart IIS.
Also, the easiest way to restart IIS is through the "internet information services" control - right click on the computer name, select "All tasks", "Restart IIS..." and confirm.
No need to go through the cmd magic spells anymore!


cevher bozkur

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...


mach

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.


webmaster

I made the mistake of setting a 'wildcard application map' for PHP on a Windows 2003 / IIS 6.0 / PHP ISAPI installation.  
This resulted in "No input file specified" errors whenever I tried to load the default page in my site's directories.  I don't know why this broke things, but it did.
If anyone has the same problem, this may be the cause.


ananda sim

I installed php 5.2.3 using the msi package to Windows XP SP2. First time, ISAPI choice defaulted to installing php to c:\program files\php. The IIS Manager > Websites > Home Directory > Extensions used the short filename. Didn't work - message was "module not found". I then removed and installed to c:\php. That worked easily.

afitzs

I have found the following procedure to work correctly EVERY time for installing PHP version 5.x.x on Windows 2003 servers. (I have done over 100 of these on Web, Standard & Enterprise)
1. Download the current PHP Zip file to a folder of your choosing.
2. Download the old Installer.exe (I use 5.0.2)
3. Run the installer and accept the defaults in all cases except the IIS server, choose IIS 6.0 or later. The installer will complain that a script map is not registered and ask you if you want to register it. SAY YES!!!
4. Run the installer a *second* time, using the same settings as above. This time instead of the complaint that a script is not registered you should see a black dos box open and then close. This is your clue that the install was successful.
5. Copy your PHP .zip file to c:\php and extract and overwrite all files from the regular installer.
6. Edit c:\windows\php.ini to enable any extensions you may need and to set the extension directory to c:/php/ext
All should be good to go. Test by running an info() from the web server.
I have used this install on over 100 installs of 2003/IIS web servers. Generally they have been virgin installs, but a few have had existing sites on them. Using the above method I am able to install PHP in under 2 min. Of course, these are windows systems thus your mileage may vary.
Note: I just tried to use the new .msi installer without success. Resorted to the above procedure and now have 5.2.0 running on the new server.
Note2: PHP powers that be, please make a copy of the old installer available again somewhere easily found by people. I would be screwed if I had not kept an archive copy of the 5.0 installer.


davideatarkehostdotnet

i have encountered always the same problem installing php on windows 2003 (it always worked fine with w2k) "php has encountered an access violation at xxxx". tried php5.x and downgrade to php4.x without success. problem was solved only by giving r+w+e permission on php folder to user IIS_WPG

rich

I have been messing with PHP and IIS for months now. THE single thing that works for me to get PHP to work using the Windows installer is as follows.
Latest environment: Server 2003 standard; IIS6, PHP 5.2.4 Windows Installer package; ISAPI module.
The installer sets the Executable Path in the mappings for the php extension to, eg., "C:\PHP\PHP5IS~1.DLL"
I'm not sure if it's the case or the literal file name, but either IIS or PHP doesn't like it. When I change it to "C:\PHP\php5isapi.dll" it works.


christian dot ulbrich

I have an IIS 6.0 with PHP 5.2.0 as ISAPI-module. Installation went fine, using one of the numerous guides available, however I couldn't get my PHP to load any extensions!
It took me quite a while, to find the catch, it seems, that PHP 5.2.0 doesn't like the quotation marks " in some of its directory variables.
Thus, changing
extension_dir = "c:\php\ext\"
to
extension_dir = c:\php\ext\
did the trick for me...


php_user

I found a good article on how to configure php on IIS and i was able to run php without any issues after following it...
http://kursdnkissd.blogspot.com/2006/10/php-on-iis-6.html


paul_lynch67

Hi,
I've written a manual installation guide for PHP 5.x on Windows Server 2003 and IIS 6.0 which you can find here :
http://www.iisadmin.co.uk/?p=4
This is the same article which used to be hosted on the IIS Resources web site. I hope some of you find it useful.
Regards,
Paul Lynch [IIS MVP]


paul_lynch

Hi,
I've written a manual installation guide for PHP 5.1.6 on Windows Server 2003 which you can find here :
http://www.iis-resources.com/modules/AMS/article.php?storyid=615
I hope some of you find it useful.
Regards,
Paul Lynch


saurabh_12_23

Hi,
Hope my experiance can be help full for others. My setup is PHP Version 5.2.4 + Windows XP Pro SP2 + IIS 5.1. Now I executed installer(downloaded from www.php.net) and by selecting C:\PHP\ ---> IIS ISAPI module ---> default extension modules & extras; it is installed. For the configuration steps opened PHP.INI and making cgi.force_redirect=1. It is working!
Thank you
Saurabh Saxena


jneill

Here's how to run dual PHP instances with PHP 5.2 and any previous PHP on Windows 2003:
1. Right-click My Computer, go to Advanced tab, and click on Environment Variables.
Add the two installations and their EXT directories to the Path variable. For example, add:
c:\php;c:\php\ext;c:\TMAS\php;c:\tmas\php\ext;
Then, add the newer PHP version's directory as a variable called PHPRC. For example:
Variable:PHPRC
Value: C:\PHP
Click OK to close the Environment Variables window, and click OK to close System Properties.
2. In registry, under HKEY_LOCAL_MACHINE>SOFTWARE>PHP, add a REG_SZ key called iniFilePath and give it a value
of the directory where the older PHP is installed. For example:
C:\TMAS\PHP
3. In IIS, go to the Web Service Extensions. Add both versions' ISAPI module separately to the extensions
list, and allow both.
4. In IIS, go to each website utilizing the PHP versions. Set an ISAPI filter if needed. On the Home Directory
tab, click Configuration, and add .php, .php3, .phtml, and any other extensions needed (perhaps .html?) to
be filtered through PHP, and specify the ISAPI module version needed for each website.
You can now run two versions of PHP. This is because the order of where to look for the .ini file changed
between previous PHP versions and PHP 5.2, as documented at http://us2.php.net/ini:
---------------------------------------------------
php.ini is searched in these locations (in order):
   * SAPI module specific location (PHPIniDir directive in Apache 2, -c command line option in CGI and CLI, php_ini parameter in NSAPI, PHP_INI_PATH environment variable in THTTPD)
   * The PHPRC environment variable. Before PHP 5.2.0 this was checked after the registry key mentioned below.
   * HKEY_LOCAL_MACHINE\SOFTWARE\PHP\IniFilePath (Windows Registry location)
   * Current working directory (for CLI)
   * The web server's directory (for SAPI modules), or directory of PHP (otherwise in Windows)
   * Windows directory (C:\windows or C:\winnt) (for Windows), or --with-config-file-path compile time option
----------------------------------------------------


infortechpro

Hello,
I had trouble setting up PHP 5 to work IIS 5 (Windows 2000).
I keep getting a HTTP 500 error.
I checked the php5isapi.dll file path, the permissions and all that but the error did not go way.
The way I got it to work was by adding the IUSR_(machine name) and IWAM_(machine name) account to the administrators group and restarting the computer.
I hope this helps someone out there.
Cheers.


steve

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...


brian

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


phil

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!


doyouunderstand

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).


uday kari

First I got a HTTP 405 error, resolving which I got an HTTP 404 error...read on for how this was fixed...
Environment:  PHP 5.2.4, IIS 6.0 ISAPI, Windows Server 2003.  
Installation:  Simply downloaded the PHP 5.2.4 installer [22,002Kb] - 30 August 2007 and ran it doing next, next until Finish.
To get rid of 405 error, ensure that your php directory allows scripts.  Start->Control Panel->Administrative Tools->Internet Information Services-> (select website, navigate to directory with your php and right-click your directory) -> Properties -> Directory TAB -> Change Execute Permissions from "None" to "Scripts" (to allow PHP).
To get rid of 404 error, ensure that your executable mapping for the .php extension is properly coded.  Start->Control Panel->Administrative Tools->Internet Information Services-> (select web site) ->Properties->Home Directory->Configuration->Mapping and then change the Executable Path for .php files from C:\Program~\PHP\php5is~1.DLL (or whatever crazy path) to "C:\Program Files\PHP\php5isapi.dll"
(IMPORTANT: the quotes from c:\ to end of dll are important since the default install location, Program Files, has a space...in my youth I would yell "Stupid Microsoft"...but now I would more maturely just note that there is an inconsistency with the way that Paths are defined...in definingenvironment variables, for instance, such spaces are OK...).


wappa

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.

william keith

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!


sirichai

Another Tips:
1. I've tried many ways installing PHP on IIS5.1 (WinXP) Many resources on the internet recommended to use a zip package, but the fact is it doesn't work.(geeez) It is a lot easier to go for the MSI installer and be sure to check those IIS functions and other extensions in the installer wizard.
2. If you got an ERROR404 on any Virtual Directory on IIS5/IIS6, but html files are displayed correctly, just edit php.ini and empty doc_root
3. If the sourcecode of php file is printed instead of the compiled one, just change all short tag <? to full tag <?php
4. If you want to connect to mssql server on IIS platform, you HAVE TO add this in the registry
HKEY_LOCAL_MACHINE\SOFTWARE\M*icrosoft\ MSSQLServer\Client\ConnectTo]DSQUERY=DBNETLIB
 It is amazing that everybody MUST follow these rules above, but I didn't see any of them appeared on php official site nor  top google rankings.
cheers.


osoto3

Another tip that might save hours of aggravation (and cursing):
I was setting the Mappings in the IIS 5.1 Manager by going to
Default Web Site -> Properties -> Home Directory -> Configuration ->Mappings
I noticed that the ".php" extension that previously I added was the only one shown in quotes, which had been added automatically due to the fact that my PHP files are installed in directory "D:\Program Files\PHP", which contains a blank space in its name. All the other entries had no quotes and when I tried to take the quotes out, IIS responded that the path was invalid. I assumed (correctly) that the quotes were causing problems. So I copied php5isapi.dll to C:\windows (which does not have a space in the directory name) and reentered the path without quotes in the Mappings screen, and then ...
Finally, my browser was able to process and show my hello.php file correctly!
Hope this helps someone.


john@ellingsworth

Another cause of the "No input file specified" on systems with multiple hosts is that the doc_root setting in the php.ini file has been set to a specific directory.  When using IIS with multiple hosts in distinct top level directories you should comment the doc_root line out.

Change Language


Follow Navioo On Twitter
General Installation Considerations
Installation on Unix systems
Installation on Mac OS X
Installation on Windows systems
Installation of PECL extensions
Problems?
Runtime Configuration
eXTReMe Tracker