Javascript debugger
Website design
↑
This section contains notes and hints specific to IIS (Microsoft Internet Information Server).
By using the CGI setup, your server is open to several possible attacks. Please read our CGI security section to learn how to defend yourself from those attacks.
0
inside php.ini
. Read the
faq on
cgi.force_redirect for important details. Also, CGI users
may want to set the
cgi.redirect_status_env directive. When using directives, be
sure these directives aren't commented out inside php.ini
.
php.exe
while in PHP 5 it's
php-cgi.exe
. In PHP 5, php.exe
is the CLI, and not the CGI.
PATH
environment variable to
include the PHP directory. This way the PHP DLL files and PHP executables
can all remain in the PHP directory without cluttering
up the Windows system directory. For more details, see the FAQ on
Setting the PATH.
php.ini
, docroot, and the
session tmp directory.
php.ini
. These directives depend on the system
that PHP is being installed on. In PHP 4, the extension_dir is
extensions
while with PHP 5 it's
ext
. So, an example PHP 5 extensions_dir value is
"c:\php\ext"
and an example IIS doc_root value is
"c:\Inetpub\wwwroot"
.
php_mysql.dll
and
php_curl.dll
, are found in the zip package of the
PHP download (not the PHP installer). In PHP 5, many extensions are part
of PECL and can be downloaded in the "Collection of PECL modules"
package. Files such as php_zip.dll
and
php_ssh2.dll
.
» Download PHP files here.
PHP may be installed as a CGI binary, or with the ISAPI module. In either case, you need to start the Microsoft Management Console (may appear as 'Internet Services Manager', either in your Windows NT 4.0 Option Pack branch or the Control Panel=>Administrative Tools under Windows 2000/XP). Then right click on your Web server node (this will most probably appear as 'Default Web Server'), and select 'Properties'.
If you want to use the CGI binary, do the following:
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.
php.exe
/ php-cgi.exe
.
To use the ISAPI module, do the following:
php4isapi.dll
/
php5isapi.dll
.
C:\php\php5isapi.dll
Supply .php
as the extension. Leave 'Method
exclusions' blank, and check the 'Script engine' checkbox. Now, click
OK a few times.
With IIS 6 (2003 Server), open up the IIS Manager, go to Web Service
Extensions, choose "Add a new Web service extension", enter in a name such
as PHP, choose the Add button and for the value browse to either the ISAPI
file (php4isapi.dll
or
php5isapi.dll
) or CGI (php.exe
or
php-cgi.exe
) then check "Set extension status to
Allowed" and click OK.
In order to use index.php
as a default content page,
do the following: From within the Documents tab, choose Add. Type in
index.php
and click OK. Adjust the order by choosing
Move Up or Move Down. This is similar to setting DirectoryIndex with
Apache.
The steps above must be repeated for each extension that is to be
associated with PHP scripts. .php
is the most common
although .php3
may be required for legacy applications.
If you experience 100% CPU usage after some time, turn off the IIS
setting Cache ISAPI Application
.
PWS 4 does not support ISAPI, only PHP CGI should be used.
pws-php4cgi.reg
/
pws-php5cgi.reg
file (look into the SAPI folder
for PHP 4, or in the main folder for PHP 5) to reflect the location of
your php.exe
/ php-cgi.exe
.
Backslashes should be escaped, for example:
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\w3svc\parameters\Script
Map] ".php"="C:\\php\\php.exe"
(change to
C:\\php\\php-cgi.exe
if you are using PHP 5)
Now merge this registery file into your system; you may do
this by double-clicking it.
The recommended method for configuring these servers is to use
the REG file included with the distribution
(pws-php4cgi.reg
in the SAPI folder for PHP 4, or
pws-php5cgi.reg
in the main folder for PHP 5).
You may want to edit this file and make sure
the extensions and PHP install directories match your
configuration. Or you can follow the steps below to do it
manually.
These steps involve working directly with the Windows registry. One error here can leave your system in an unstable state. We highly recommend that you back up your registry first. The PHP Development team will not be held responsible if you damage your registry.
HKEY_LOCAL_MACHINE /System
/CurrentControlSet /Services /W3Svc /Parameters
/ScriptMap
.
New->String Value
.
.php
php.exe
in the value data field. ex:
C:\php\php.exe "%s" %s
for PHP 4, or
C:\php\php-cgi.exe "%s" %s
for PHP 5.
The following steps do not affect the web server installation
and only apply if you want your PHP scripts to be executed when
they are run from the command line (ex. run
C:\myscripts\test.php
) or by double clicking
on them in a directory viewer window. You may wish to skip these
steps as you might prefer the PHP files to load into a text
editor when you double click on them.
HKEY_CLASSES_ROOT
New->Key
.
.php
phpfile
.
New->Key
under
HKEY_CLASSES_ROOT
and name it
phpfile
.
phpfile
and in the
right side pane, double click the "default value" and enter
PHP Script
.
phpfile
key and select
New->Key
, name it Shell
.
Shell
key and select
New->Key
, name it open
.
open
key and select
New->Key
, name it
command
.
command
and in the
right side pane, double click the "default value" and enter
the path to php.exe
. ex:
c:\php\php.exe -q %1
. (don't forget the
%1
).
PWS and IIS 3 users now have a fully operational system. IIS 3 users can use a nifty » tool from Steven Genusa to configure their script maps.