Under Win2003, you don't need to restart the services, if you only add PHP to a new website with its own application pool.
Installation avec les serveurs IIS/PWS
Cette section contient des notes sur l'installation de PHP avec IIS ( Microsoft Internet Information Server).
En utilisant le mode CGI, votre serveur est ouvert à de possibles attaques sérieuses. Lisez attentivement notre section sur la sécurité en mode CGI pour apprendre comment vous défendre contre ces attaques.
Considérations générales pour toutes les installations de PHP avec IIS ou PWS
- Tout d'abord, lisez les instructions d'installation du manuel. Ne négligez pas cette étape, elle fournit des informations essentielles sur l'installation de PHP sur Windows.
- Les utilisateurs de CGI doivent définir la directive PHP cgi.force_redirect à 0 dans le php.ini. Lisez la faq sur cgi.force_redirect qui vous apprendra des détails importants. De même, les utilisateurs de CGI peuvent vouloir définir la directive cgi.redirect_status_env. Lorsque vous utilisez les directives, assurez-vous qu'elles ne soient pas commentées dans le php.ini.
- Le CGI de PHP 4 est nommé php.exe tandis qu'en PHP 5, il est nommé php-cgi.exe. En PHP 5, php.exe est le CLI et non le CGI.
- Modifiez la variable d'environnement PATH de Windows afin d'inclure le dossier de PHP. De cette façon, les fichiers DLLs de PHP, et les exécutables de PHP peuvent tous résider dans le dossier de PHP sans être dans le dossier système de Windows. Pour plus de détails, lisez la FAQ sur la façon de définir le PATH.
- L'utilisateur IIS (habituellement IUSR_MACHINENAME) a besoin de permission pour lire les différents fichiers et dossiers, comme le php.ini, docroot ainsi que le dossier temporaire hébergeant les sessions.
- Assurez-vous que les directives PHP extension_dir et doc_root soient correctement définies dans le php.ini. Ces directives dépendent du système sur lequel PHP est installé. En PHP 4, extension_dir vaut extensions tandis qu'en PHP 5, il vaut ext. Donc, un exemple de valeur pour extensions_dir en PHP 5 est "c:\php\ext" et un exemple de valeur pour doc_root pour IIS est "c:\Inetpub\wwwroot".
- Les fichiers d'extensions DLL de PHP, comme php_mysql.dll et php_curl.dll, peuvent être trouvés dans le paquet compressé de PHP (et non dans l'installeur de PHP). En PHP 5, beaucoup d'extensions font parties de PECL et peuvent être téléchargées dans le paquet "Collection de modules PECL". Les fichiers comme php_zip.dll et php_ssh2.dll. » Téléchargez les fichiers PHP ici.
- Lors de la définition de l'exécutable, la case "Vérifier que ce fichier existe" doit également être cochée. Pour un faible coût au niveau performance, IIS (ou PWS) vérifiera que le fichier de script existe et proposera l'identification avant d'appeler PHP. Cela signifie que le serveur web fourniera des messages d'erreur sensiblement identiques à des erreurs 404 au lieu des erreurs CGI stipulant que PHP n'a pu afficher aucune donnée.
- L'exécutable PHP est distribué en tant qu'application 32bit. Si vous utilisez une version 64bit de Windows, vous devez, soit recompiler l'exécutable vous-même, soit vous assurez qu'IIS est configuré pour exécuter des extensions 32bit. Vous pouvez activer ce comportement en utilisant le script d'administration d'IIS comme ceci : Cscript.exe adsutil.vbs SET W3SVC/AppPools/Enable32bitAppOnWin64 1
Windows NT/200x/XP et IIS 4 ou plus récent
PHP peut être installé en tant que binaire CGI ou en tant que module SAPI. Dans tous les cas, vous devez démarrer la console d'administration Microsoft (qui doit apparaître comme 'Internet Services Manager', soit depuis le menu des options Pack de votre Windows NT 4.0 ou le menu 'Control Panel=>Administrative Tools' sous Windows 2000/XP). Faites alors un clic droit sur le noeud du serveur web (ceci doit apparaître comme 'Default Web Server'), et sélectionnez 'Properties'.
Si vous voulez utiliser le binaire CGI, suivez ce qui suit :
- Sous 'Home Directory', 'Virtual Directory', ou 'Directory', faites ce qui suit :
- Modifier les permissions d'exécution en 'Scripts only'
- Cliquez sur le boutton 'Configuration', et choisissez l'onglet 'Application Mappings'. Cliquez sur 'Add' et définissez le chemin vers l'exécutable vers le fichier CGI approprié. Un exemple de valeur pour PHP 5 : C:\php\php-cgi.exe. Ajoutez .php en tant qu'extension. Laissez 'Method exclusions' vide, et cochez la case 'Script engine' checkbox. Maintenant, cliquez sur Ok plusieurs fois.
- Définissez la sécurité appropriée. (Ceci est fait dans 'Internet Service Manager'), et, si votre serveur NT utilise le système de fichiers NTFS, ajoutez le droit à l'exécution pour I_USR_ pour le dossier qui contient php.exe / php-cgi.exe.
Pour utiliser le module SAPI, faites ce qui suit :
- Si vous ne souhaitez pas faire d'identification HTTP en utilisant PHP, vous pouvez (et vous devez) ignorer cette étape. Dans les filtres ISAPI, ajoutez un nouveau filtre ISAPI. Utilisez PHP en tant que nom de filtre, et ajoutez un chemin vers les fichiers php4isapi.dll / php5isapi.dll.
- Sous 'Home Directory', 'Virtual Directory', ou 'Directory', faites ce qui suit :
- Modifiez les permissions d'exécution en 'Scripts only'
- Cliquez sur le bouton "Configuration" et ajoutez une nouvelle entrée dans "Application Mappings". Cliquez sur 'Add' et définissez le chemin d'exécution vers la bibliothèque DLL ISAPI appropriée. Un exemple de valeur pour PHP 5 est : C:\php\php5isapi.dll. Ajoutez .php en tant qu'extension. Laissez 'Method exclusions' vide, et cochez la case 'Script engine'. Maintenant, cliquez que Ok plusieurs fois.
- Arrêtez totalement IIS (NET STOP iisadmin)
- Démarrez IIS (NET START w3svc)
Avec IIS 6 (2003 serveur), ouvrez le gestionnaire IIS, allez aux extensions de services web, choisissez "Add a new Web service extension", entrez-y un nom comme PHP, cliquez sur le boutton 'Add' et pour la valeur, choisissez soit le fichier ISAPI (php4isapi.dll ou php5isapi.dll), soit le fichier CGI (php.exe ou php-cgi.exe), puis cochez "Set extension status to Allowed" et validez en cliquant sur OK.
Afin d'utiliser index.php en tant que page par défaut, faites ce qui suit : depuis l'onglet 'Documents', choisissez 'Add'. Entrez-y index.php et validez en cliquant sur OK. Ajustez l'ordre en choisissant 'Move Up' ou 'Move Down'. Ceci est similaire à la définission de 'DirectoryIndex' sous Apache.
L'étape ci-dessus doit être répétée pour chaque extension qui doit être associée aux scripts PHP. .php est le plus courant, cependant .php3 peut être requis pour certaines applications.
Si vous atteignez 100 % d'utilisation du CPU après quelques minutes, désactivez l'option de configuration Cache ISAPI Application de IIS.
Windows et PWS 4
PWS 4 ne supporte pas ISAPI, uniquement PHP CGI doit être utilisé.
- Éditez le fichier pws-php4cgi.reg / pws-php5cgi.reg (regardez dans le dossier SAPI pour PHP4 ou dans le dossier principal pour PHP 5) pour indiquer la localisation de votre fichier php.exe / php-cgi.exe. Les slash doivent être échappés. Par exemple : [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\w3svc\parameters\Script Map] ".php"="C:\\php\\php.exe" (modifiez en C:\\php\\php-cgi.exe si vous utilisez PHP 5). Maintenant, intégrez ce fichier de registre dans votre système ; vous devriez juste avoir à double-cliquer dessus.
- Dans le gestionnaire PWS Manager, faites un clic droit sur les dossiers qui supporteront PHP, et sélectionnez "Properties". Cochez l'option "Execute" et confirmez.
Windows et PWS/IIS 3
La méthode recommandée pour configurer ces serveurs est d'utiliser le fichier INF inclus dans la distribution (pws-php4cgi.reg dans le dossier SAPI pour PHP 4 ou pws-php5cgi.reg dans le dossier principal pour PHP 5). Vous pouvez éditer ce fichier, pour vous assurer que les extensions et les dossiers d'installation de PHP sont bien ceux de votre configuration. Ou alors, vous pouvez suivre les instructions suivantes pour le faire manuellement.
Ces instructions requièrent la manipulation du fichier de registre de Windows. Une erreur peut laisser votre système dans un état instable. Nous vous recommandons vivement de sauvegarder ce fichier en lieu sûr. L'équipe de développement et les traducteurs de cette documentation ne pourront pas être tenus responsable d'un quelconque dommage qui pourrait survenir dans votre registre.
- Lancez Regedit.
- Naviguez jusqu'à : HKEY_LOCAL_MACHINE /System /CurrentControlSet /Services /W3Svc /Parameters /ScriptMap.
- Dans le menu "edit", sélectionnez : New->String Value.
- Entrez l'extension que vous voulez utiliser pour les scripts PHP. Par exemple : .php
- Double-cliquez sur la chaîne, et entrez le chemin jusqu'à php.exe dans le champ "value data". Exemple : C:\php\php.exe "%s" %s pour PHP 4 ou C:\php\php-cgi.exe "%s" %s pour PHP 5.
- Répétez ces étapes pour chaque extension que vous désirez associer à vos scripts PHP.
Les étapes suivantes n'affectent pas la configuration du serveur web, et ne s'appliquent que si vous voulez que vos scripts PHP soient exécutés lorsqu'il sont exécutés en ligne de commande (par exemple, run C:\messcripts\test.php) ou en double-cliquant sur l'icône. Vous pouvez ignorer ces étapes si vous préférez que vos scripts PHP s'ouvrent dans un éditeur de texte, plutôt que de les voir s'exécuter lorsque vous double-cliquez dessus.
- Naviguez jusqu'à : HKEY_CLASSES_ROOT
- Dans le menu edit, sélectionnez : New->Key.
- Donnez le nom de votre extension à la clé. Par exemple : .php
- Sélectionnez le nom de la nouvelle clé dans le panneau de droite, et double-cliquez dans "default value", puis entrez phpfile.
- Répétez ces instructions pour toutes les extensions que vous avez associé aux scripts PHP.
- Créez une autre New->Key sous HKEY_CLASSES_ROOT et nommez-la phpfile.
- Sélectionnez la nouvelle clé phpfile et, dans le panneau de droite, double-cliquez dans "default value" et entrez PHP Script.
- Faites un clic droit dans phpfile et sélectionnez New->Key, appelez-la Shell.
- Faites un clic droit dans Shell et sélectionnez New->Key, appelez-la open.
- Faites un clic droit dans open et sélectionnez New->Key, appelez-la command.
- Sélectionnez la nouvelle clé command et dans le panneau de droite, faites un double-clic dans "default value", puis entrez le chemin jusqu'à php.exe. Par exemple : c:\php\php.exe -q %1 (n'oubliez pas le %1).
- Quittez Regedit.
- Si vous utilisez PWS sous Windows, redémarrez pour prendre en compte le nouveau registre.
Les utilisateurs de PWS et IIS 3 sont prêts à utiliser leur serveur. Avec IIS 3, vous pouvez utiliser un » outil bien pratique de Steven Genusa pour configurer votre carte des scripts.
Installation avec les serveurs IIS/PWS
26-Mar-2008 12:51
21-Feb-2008 03:51
Special thanks to tstirrat AT optusnet DOT com DT au.
Changing the identity setting for the application pool did the trick!
13-Feb-2008 06:04
i think the install steps are generally covered in the installation guideliness on this website, but this step by step guide and its explanations make the install on SBS2003 much easier to follow and implement. I spent about 3 hours searching threads and forums and not getting it all until i followed the steps at this link.
http://www.peterguy.com/php/install_IIS6.html#IISConfigure
31-Oct-2007 02:24
Make sure in IIS that when you set the permissions on C:\PHP that it inherits to the folders/files within that directory. I was doing a reinstall on a 2003/IIS 6 and whoever did the previous install took off inherit permissions. Fought with that for several hours!!
09-Sep-2007 09:40
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]
27-Jul-2007 06:38
After a few hours of trying everything under the sun to get PHP 5.2.3 to work on Windows Small Business Server 2003 with IIS6 with ISAPI starting from the msi install of from php.net. I found that the install correctly used the path C:\PROGRA~1\PHP\PHP5IS~1.DLL in adding the Mapping for .php but for the Web Service Extension it used C:\Program Files\PHP\php5isapi.dll. When I changed this to C:\PROGRA~1\PHP\PHP5IS~1.DLL. It worked right away. Before this change I would get a 404 error when accessing php pages. Moral of the story is avoid spaces in all paths.
09-May-2007 02:48
Has anybody succeeded in running PHP4 and PHP5 simultaneously using ISAPI? It's possible as CGI since they'll both pick up their php.ini from where the php.exe (or php-cgi.exe) is. But as ISAPI they'll both read the same php.ini file which points both versions to the extension folder of 1 version (eg both PHP4 and PHP5 will use the PHP5 extensions) and thus fail...
Please don't ask my WHY I want both versions, I simply have to. Don't mean to start a discussion here but would like to run both PHP4 and PHP5 as ISAPI module.
10-Apr-2007 06:11
Installing PHP 5.2.1 on a Windows 2K3 Server with SP1 and IIS 6.0
- was about to give me the head ache of the year! It is NOT - repeat - NOT possible to use the CGI on a server but ISAPI works perfectly. The documentation mentions both - but cgi/fastcgi is definetely a no go.
Using the PHP installer I used the IIS option, corrected the recommended php.ini file and added the extensions I wanted.
And at this point - too - you have to restart the server to make it work, a restart of only the IIS service is not sufficient.
So mark my words, use ISAPI and don't get any errors!
This one threw me for a loop; you CAN NOT put the PHP folder in Program Files if you're installing on IIS! I guess the space in "Program Files" throws it off, I was getting a "You must enter a valid file path" error when trying to add the PHP mapping manually.
06-Oct-2006 05:20
I had a big problem with this on my server, as I was not using IUSR I was using Network Service.
Even more difficult was the fact that it was the DC on a domain which meant I got told that it "is not from a domain listed in the Select Location dialog box, and is therefore not valid.".
The way I got around this was with the following command.
C:\Documents and Settings\Administrator>cacls C:\php /G "NT AUTHORITY\NETWORK SERVICE":F /E /T
Please note that this gives the user NETWORK SERVICE full access to the C:\php directory, but it did solve my problem!
07-Sep-2006 03:30
Found this PHP installer for IIS which uses fastcgi and apc;
http://www.iis-aid.com/iis_aid_php_installer
You get to configure your fastcgi and apc settings during installation, and it is meant to work with IIS 5.x and 6. It even setup the web server extension in IIS 6, and seems to be working ok for me so far on a dev box. Only drawbacks are it is only available with PHP 4.4.1 using fastcgi (no isapi yet).
28-May-2006 08:56
I have sucessfully installed PHP 4 and 5 on every windows server version since 2000 (not NT4) and XP. It is simple but there are a couple of pre-requisites that I've never seen mentioned.
1. Most of the problems folks are experiencing on the server side are .NET 2.0 induced. If you must run .NET 2.0 then you need dll's that were compiled with Visual Studio 8. The big push behind VS.8 and the Express editions is to get you off of PHP and onto C#. Keep that in mind when you develop apps.
2. You can run .NET 2.0 and Visual studio on XP with PHP and IIS if you install Visual Studio first. Visual studio installs its own dedicated version of IIS that works with .NET 2.0 but will not run php. After VS is installed go ahead and install the included XP version of IIS and configure your virtual sites with PHP. If you do it the other way around, VS will incorporate itself into the xp IIS and your PHP will probably not run.
3. Put the PHP ini file where windows wants it, in the (system root) "c:\windows" dir. If you do that, and you are using only the ISAPI dll's, you just need to change the ini file to point to the ext directory correctly and it will run fine. I usually do all the pathing recommendations and set phprc=(php directory) too. I also leave a copy of the current ini file in the php directory root just incase php forgets to consult with the OS before looking for something.
Most of the problems with permissions are comming from .NET 2.0. You should never have to weaken security to get PHP to run.
4. Slightly out of scope but important nonetheless. If you do not run .NET 2.0, the ordering of your extensions (ie..mysql.dll, etc.) becomes far less important. You may see a hang occasionally but its rare.
Hope this helps someone.
Steve
12-May-2006 06:07
How to solve the nasty "permission denied" under IIS (Windows xp)
From http://www.geocities.com/legolas.1558/php_iis_permission_denied.htm
1. Did you disable Simple File Sharing? From any folder click Tools -> Folder Options -> View (tab)-> (scroll the list and find "Simple File Sharing (reccomended)") UNTICK IT
2. Locate your localhost root directory, usually C:\InetPub\wwwroot\
3. Open the Properties of the whole directory, in our case wwwroot
4. Click the Protection tab(where to manage user rights)
5. Click Add and then click Advanced (button in the bottom-left part of the window)
6. Click Find (the only enabled button between Columns and Stop)
7. Pick the user that starts with IUSR_ (which is the IIS default user) from the list Windows has kindly found for you
8. push OK twice
9. the new added IUSR_ will be selected, from the Authorizations list check Edit (to allow file creation/deletion) and Write (to allow file modify)
10. click OK one more time to get back to your native folder
24-Mar-2006 04:39
After having recently gone through a long process of trial and error installing both php4 and php5 on a single machine under IIS. I eventually did get it working so I thought I'd share what I learnt.
Basically, as far as I can tell there is no way to get both versions working using the ISAPI dlls unfortunately. You can however get them working using one as ISAPI and the other as CGI. And probably both as CGI too, although I didn't try that.
You'll need to know how to do a manual install of PHP anyway, see the instructions for how to do that. Make sure you follow the steps about your PATH env variable and Allowing extensions on IIS 6. Keep your php.inis in the relevant php directory and make sure they are not in your windows or system32 folders. And all that other hoopla.
The crucial part is your php.ini files. The problem being that both versions will look at your PHPRC setting and get the ini file path from that. So you'll end up with both versions running off the same INI which is no good. The way around this is to use the CGI for one version and ISAPI for the other.
The ISAPI dll never seems to look in it's own directory for the ini file, but the CGI exe does. You can use that quirk to your advantage by naming the INI file for the ISAPI version 'php-isapi.ini' and setting the PHPRC environment variable to that path. Then for the CGI version keep the php.ini in the same directory as php.exe.
Then set your virtual server to use either the ISAPI module for one version, or the CGI module for the other version, and it should work. Test using phpinfo() to ensure each version is getting it's ini file from the correct place.
Basically it seems that the ISAPI module will look in the path set in PHPRC first, and choose the php-isapi.ini file. The CGI module will look in PHPRC first too, but it upon seeing no php.ini it will then move on to search it's own directory, where it finds php.ini.
24-Mar-2006 02:07
I have fixed the 404 with this message found at google groups:
-----------------------------------------------------------
I could not get PHP pages to display in IIS 6 with Windows 2003, using the
default install of the stable binaries from php.net.
Here is the solution I found.
The default install registers the .php extension as belonging to
c:\php\php.exe. This is correct, but it's faster to use the ISAPI
extension.
To do this,
1. Open the IIS Management console
2. Expand the server, right click on "Web Sites" and click Properties
3. Open the "ISAPI Filters" foldertab
4. Click Add
5. Enter PHP in the Filter Name box.
6. Click Browse and then Browse to your php4isapi.dll.
6. Click ok -> Apply -> ok
... Once this is completed, your PHP scripts still won't run. The problem
is that you have to define and enable PHP as a "Web Service Extension".
To do this,
1. Open the IIS Management console
2. Expand the server, and expand the "Web Services Extensions"
3. Click "Add a new Web services Extension"
4. Enter PHP in the Extension Name box.
5. In the required files box, Browse to your php directory and add
php4isapi.dll.
6. Click ok -> Apply -> ok
Last but not least, You may or may not need to do the following,
-Set the extensions path in the php.ini file if you are going to use any
extensions , i.e. php_mssql.dll
-I had to copy the php4isapi.dll from c:\php\isapi to c:\php, YMMV
-Give the webserver user (IUSR_MACHINENAME in most cases) read and execute
access to php4isapi.dll and php4ts.dll
Good Luck,
Ejay Hire
EjayH...@hotmail.com
----------------------------------------------------------
04-Oct-2005 04:58
PROBLEM
PHP $DOCUMENT_ROOT was not set in IIS.
ANALYSIS
A Google search turned up a suggestion re using ISAPI instead of CGI.
SOLUTION
I did the fix per these suggested steps from Google search:
1 Downloaded PHP5 zip
2 Added ISAPI filter PHP5ISAPI.DLL named PHP
3 Changed document type .php to point at the PHP5ISAPI.DLL file instead of PHP.EXE.
RESULT
This worked - the php pages started picking up $DOCUMENT_ROOT as expected.
General suggestion: Don't waste time with CGI, use ISAPI.
23-Sep-2005 02:29
PHP 5, IIS 5, Win XP:
One thing to note: if you run phpinfo() and the 'Configuration File (php.ini) Path' points to a directory and not the actual file (ie. C:\\windows instead of C:\\windows\\php.ini) this means that it is not using your php.ini file, it is using default settings.
After spending hours searching forums the only thing that got it to work for me was to create a new environment system variable called 'PHPRC' and set it to the path where your php.ini is located (ie C:\\PHP) - simply adding C:\\PHP to the system path variable didn't do it. You have to reboot after this change of course. I'm not sure why this isn't more documented as from my searching there are quite a few people who experience this problem... hope this helps!
16-Sep-2005 01:53
After installing PHP and running an http://localhost/test.php file in my browser, I encountered a COM Surrogate error. After some testing, I found that it was a result of un-checking the Cache ISAPI applications checkbox. Consequently, make sure that the Cache ISAPI applications checkbox has a check in it. To get to the checkbox go to:
Control Panel>Administrative Tools>Internet Information Services
When you are at the IIS window in the left navigational panel go to:
Local Computer>Web Sites>Default Web Site
Right-click on your default web site and select Properties. A Properties window appears. Select the Home Directory tab. Click on the Configuration... button. A Configuration window appears. Below the Mappings tab is the Cache ISAPI applications checkbox.
Again, make sure that the Cache ISAPI applications checkbox has a check in it. I hope this helps anybody else with a similar problem.
08-Sep-2005 06:14
"Click on the 'Configuration' button, and choose the Application Mappings tab. Click Add and set the Executable path to the appropriate CGI file. An example PHP 5 value is: C:\php\php-cgi.exe Supply .php as the extension. Leave 'Method exclusions' blank, and check the 'Script engine' checkbox. Now, click OK a few times."
When installing PHP 5 on IIS 6.0 and Windows 2003 I encountered problems with this instruction. I believe the root cause is that IIS requires the "scripts and executables" execute permission to be selected if the script engine has a .exe extension.
However, there may have been additional problems. Even when selecting the "scripts and executables" execute permission I continually received HTTP Header errors. The resolution was to follow the instructions for use of php5isapi.dll. The .dll extension can be run with the "scripts only" execute permission. Also remember IIS 6.0 requires that you identify Web Extensions and Allow execution of those extensions.
31-Mar-2005 08:43
Installing PHP 5 on Windows Server 2003/IIS6
It has come to my attention that the link to my PHP installation guide in my posting of 07-Feb-2005 11:49 is a Bad Link.
We don't like Bad Links.
Here's the correct one:
http://www.peterguy.com/php/install_IIS6.html
Enjoy!
-Peter
16-Mar-2005 10:50
The correct required NTFS ACL's are:
- for the folder holding your PHP files:
[Read] IUSR_servername
[Read] IWAM_servername
-for the folder holding the PHP executables:
[Read] IUSR_servername
25-Feb-2005 10:59
Supplementation to the previous hint
The environment is Windows 2003 Server/IIS 6/PHP 5.
About IIS 6 of Windows XP.
There is no 'IISEXT.VBS'.
It seems not to have to add it to the Web enhancing
(It is not an accurate intelligence ).
Moreover, when the method argument of iis6
isapimap add is omitted, it becomes an error.
Specify it following and specifying it.
iis6isapimap add .PHP C:\PHP\php5isapi.dll GET,POST,HEAD
Good Luck !
24-Feb-2005 10:34
Hint registered to IIS 6 as ISAPI without using GUI.
(It is a machine translation from Japanese to English. )
[Method of addition to Web enhancing]
'IISEXT.VBS' is attached to IIS 6.
<addition example>
iisext /AddFile C:\PHP\php5isapi.dll 1 PHP 1 "PHP: Hypertext Preprocessor"
<deletion example>
iisext /RmFile C:\PHP\php5isapi.dll
[Method of adding extension to Application Mappings]
To our regret, there is no good method in the standard. :-(
The source code of C# program that is registered and deleted is presented in the mapping.
(It is hoped that someone writes VBScript or the JScript version)
<addition example>
iis6isapimap add .PHP C:\PHP\php5isapi.dll
< deletion example>
iis6isapimap delete .PHP
C# source code
(Add 'System.DirectoryServices' to the reference)
------------------------------------------------------------
using System;
using System.Collections;
using System.DirectoryServices;
namespace IIS6ISAPIMAP
{
class StartClass
{
public static void print_man()
{
Console.WriteLine("IIS6ISAPIMAP [view|add|delete] <.ext> <ISAPI DLL PATH> (METHOD LIST)");
}
[STAThread]
static void Main(string[] args)
{
if ( args.GetLength(0) < 1 )
{
print_man();
return;
}
System.DirectoryServices.DirectoryEntry dent
= new DirectoryEntry("IIS://localhost/W3SVC/1/root");
ArrayList orglist
= new ArrayList( dent.Properties["ScriptMaps"] ) ;
if ( args[0].ToLower() == "view" )
{
foreach(string s in orglist)
{
Console.WriteLine(s);
}
}
else if ( args[0].ToLower() == "add" )
{
if ( args.GetLength(0) < 3 )
{
print_man();
}
else
{
ArrayList newlist = new ArrayList();
string ext = args[1];
string path = args[2];
string methods = args.GetLength(0) < 4 ? "" : args[3];
string newmap = ext + "," + path + ",5," + methods;
foreach(string s in orglist)
{
string [] tokn = s.Split(',');
if ( tokn[0].ToLower() != ext.ToLower() )
{
newlist.Add( s );
}
}
newlist.Add( newmap );
dent.Properties["ScriptMaps"].Value = newlist.ToArray();
dent.CommitChanges();
}
}
else if ( args[0].ToLower() == "delete" )
{
if ( args.GetLength(0) < 2 )
{
print_man();
}
else
{
ArrayList newlist = new ArrayList();
string ext = args[1];
foreach(string s in orglist)
{
string [] tokn = s.Split(',');
if ( tokn[0].ToLower() != ext.ToLower() )
{
newlist.Add( s );
}
}
dent.Properties["ScriptMaps"].Value = newlist.ToArray();
dent.CommitChanges();
}
}
else
{
print_man();
}
dent.Dispose();
}
}
}
07-Jan-2005 08:05
I had problems upgrading to 5.0.3 isapi on my IIS 6/Windows 2003 server. Most of the instructions I found said to give the IUSR account access to various files/folders. In my case I needed to give access to "Network Service" (not to be confused with just "Network").
1. In IIS Admin, go to Application Pools
2. Right click on the pool your site is running under and click properties.
3. Go to the Identity tab and see what user is selected.
4. Give that user permissions to your php files/directory.
Don't know if this will help anyone else, but thought I'd offer in case.
12-Oct-2004 01:19
Path references (e.g. for browscap.ini) in php.ini MUST be enclosed with double-quotes (") instead of single-quotes(') for PHP to load correctly under IIS
30-Aug-2004 10:43
There's a bug in IIS 5.1 which may prevent you from adding an Application Extension Mapping. If the OK button remains disabled after you've entered the Executable and the Extension, try this workaround provided by Microsoft:
1. Right-click the individual Web site or the Web Sites folder, and then click Properties.
2. On the Home Directory tab, click Configuration.
3. Under Application Configuration, click Add, and then click the Mappings tab.
4. With the Add/Edit Application Extension Mapping dialog box open, click Browse to select the .exe file or the .dll file from the local path on the Web server.
Note:
You must type the path to a valid file in the Executable text box or the OK button remains unavailable. The easiest way to make sure that you enter a valid path is to select the file by using the Browse button.
5. After the path appears in the Executable text box, click in the Executable text box to initialize the path.
6. Click in the Extension space, and then type the file name extension.
Note:
- You must enter the period (.) in front of the extension in the Extension text box, or the OK button remains unavailable.
7. When the OK button becomes active, click OK to continue.
Source: http://support.microsoft.com/?id=317948
-paul-
13-Aug-2004 04:55
If you use IIS6 you have to add a new Webextension for PHP to work, otherwise you will get a "404"-Page if you try to point your browser to a "*.php" file.
In order to do this you have to open the IIS-management console and open the "local computer".
Under "webextensions" you will find allready a list with different extensions all being blocked by default.
To get PHP to work you have to manually add a new webextension. I only have a german version of IIS in front of me so forgive me if i translate the buttons wrongly.
Click on "New webextension". Enter any name you like for your new extension. Click on "Add..." and then on "Search...". If you would like to add the DLL just browse to your PHP-directory and you will find the php5ts.dll. If you search for the php-cgi.exe you have to change the filetype at the bottom to "CGI-Exe-Files". Only after changing the filetype you can see the php-cgi.exe file and choose it for the extension.
If you check the checkbox at the bottom of the "New extension" Window it will allow the newly added extension to be executed. Certainly you can change the status any time you want by clicking on "Allow".
Only after that procedure you will be able to get in touch with PHP-files.
sincerely
Juergen Sommer
07-Jun-2004 04:57
Under IIS6 (and earlier)
After all the installation, do not forget to add "index.php" as default page, under the Documents tab in the Web Site's Properties.
1. Right-click Web Sites, choose Properties
2. Click Documents tab
3. Click Add...
4. Type index.php, click Ok
5. Choose "index.php" from the list and move it to the top using Move Up button.
6. Make sure "Enable default content page" is checked.
Ofcourse you can add other pages as default.
For those that do not know what is this for: If you do not provide full URL and you have several pages in the directory which are in this list, the server will return the topmost of them. In case you wish to open other page of them, you have to provide its full URL. Putting "index.php" on top will make sure no other pages will be returned as default.
02-Jun-2004 01:33
If you experience extreme high loading times, please have a look at this http://bugs.php.net/bug.php?id=28524
21-Apr-2004 05:14
I am running Active Directory & IIS6.0
I found that after looking through the tutorial below i was still unable to get into my site (authentication popup, 401.3 error). I set my permissions for read & execute for IUSR_(server) and IIS_WPG for both my document root and the php directory.. no luck.
However, here's how i solved the problem. (I believe this solution is relevant to fixing the active directory issue)
1. You want to give the IUSR_* and IIS_WPG read & execute permission to the PHP DIRECTORY ONLY. (I managed to remove the credentials from my document root and it still works.
2. Open IIS Manager and go to Application Pools, then to the pool which is relevant to your site (in my case DefaultAppPool).. on this item, right click and choose properties.
3. Now navigate to the identity tab.
4. My Worker process was set to Predefined: Network Service. I changed this to Configurable: IWAM_(server name) (which if you noticed is in the user group 'IIS_WPG')
Note: i also changed the passwords for my IUSR_* and IWAM_* accounts to be sure they werent set to something easy by default. Its probably a good idea to do this too.
Hope this solves someones frustration.
12-Feb-2004 02:32
If some extensions (such as OCI or Turck mmcache in FastCGI mode) have trouble functioning with PHP+IIS, make sure that "Allow IIS to Control Password" is unchecked in the preferences panel for anonymous user access.
For more detail on the issue, read articles 216828 and 218756 in the MS Knoweledge Base.
11-Feb-2004 09:24
Under IIS 6, don't forget that you have to add all the PHP modules you'd like to run to the PHP Web Service Extension part under the IIS management console.
12-Aug-2003 03:49
In the installation with IIS 6.0, after you add the isapi extension, you need to allow the extension in the Web Services Extensions, or you 'll get a 404 error.
11-Apr-2003 06:16
On Windows Server 2003 (formerly .net server) with IIS 6 (final RTM - build 3790)
I got PHP working by using one of the tips above (thanks!).
I noted however, that I did not need to 'allow unknown Isapi applications' , and I was able to keep the configuration at 'Scripts Only' instead of 'Scripts and Executables' - both settings are potentially more secure this way.
The only configuration that is different from how I normally configure PHP on IIS 5 is the addition of PHP as a Web Service Extension.
03-Nov-2002 05:50
Here's a quick fyi, to get PHP installed on .Net Server w/ IIS 6 you have to use the IIS manager to enable support for different web service extentions. CGI ,ASP, ISAPI are all prohibited by default. In IIS manager click on the Web Service Extentions Folder there's options to add a new extention , prohibit all extentions etc. I chose add new extention ,in the dialog box I named it PHP , click add , in the next dialog browse to path of 'php4isapi.dll' hit ok then mark checkbox "Set extention status Allowed" hit ok and all is good. This was done after I followed the install.txt for IIS 4 or newer .
23-Jan-2001 06:12
When using WindowsNT 4.0 and IIS, the WWW home directory needs to have Read AND Execute access rights.
