©
Dokumen ini menggunakan Manual laman web PHP Cina Lepaskan
本章包含有在 Microsoft Windows 中手工安装和配置 PHP 的指示。有关如何使用 PHP 安装程序在 Windows 下安装和配置 PHP 以及 web 服务器,请参阅 Windows 安装程序(PHP 5.2 及更新版本)一章。
从 » PHP for Windows: Binaries and Sources 页面下载 PHP 的 zip 二进制发行包。有几个不同版本,根据所用 web 服务器选择合适的版本:
如果是用于 IIS 则选择 PHP 5.3 VC9 Non Thread Safe 或者 VC6 Non Thread Safe;
如果是用 IIS7 或更高版本以及 PHP 5.3+,则应选择 VC9 的包;
如果是用于 Apache 1 或 Apache 2 则选择 PHP 5.3 VC6 或者 PHP 5.2 VC6。
Note:
VC9 版本是用 Visual Studio 2008 编译的并且在性能和稳定性上都有所提高。VC9 版本需要用户系统中安装有 » Microsoft 2008 C++ Runtime (x86) 或者 » Microsoft 2008 C++ Runtime (x64)。
将 zip 包解压缩到自己选择的目录,例如 C:\PHP\。此目录和文件结构类似于:
Example #1 PHP 5 压缩包的结构
c:\php | +--dev | | | |-php5ts.lib -- php5.lib 的非线程安全版本 | +--ext -- PHP 扩展库的 DLL 文件目录 | | | |-php_bz2.dll | | | |-php_cpdf.dll | | | |-... | +--extras -- 空 | +--pear -- PEAR 的初始版本 | | |-go-pear.bat -- PEAR 安装脚本 | |-... | |-php-cgi.exe -- CGI 可执行文件 | |-php-win.exe -- 无窗口执行脚本的可执行文件 | |-php.exe -- PHP 命令行可执行文件(CLI) | |-... | |-php.ini-development -- 默认的 php.ini 设置 | |-php.ini-production -- 推荐的 php.ini 设置 | |-php5apache2_2.dll -- 非线程安全版本中无此文件 | |-php5apache2_2_filter.dll -- 非线程安全版本中无此文件 | |-... | |-php5ts.dll -- PHP 核心 DLL(php5.dll 的非线程安全版本) | |-...
以下是 PHP zip 包中包含的模块和可执行文件列表:
go-pear.bat - PEAR 安装脚本。更多内容参见» 安装 PEAR。
php-cgi.exe - CGI 可执行文件,可用于 IIS 上以 CGI 或者 FastCGI 方式运行 PHP。
php-win.exe - PHP 可执行文件,可运行 PHP 脚本而不打开命令行窗口(例如使用 Windows 图形界面的 PHP 程序)。
php.exe - PHP 可执行文件,用于命令行界面运行 PHP 脚本(CLI)。
php5apache2_2.dll - Apache 2.2.X 模块。
php5apache2_2_filter.dll - Apache 2.2.X 过滤器。
解压缩 PHP 的包之后,将 php.ini-production 拷贝为 同一目录下的 php.ini。如有必要,也可以将 php.ini 放到其它地方,但是需要更多配置步骤,具体见配置文件。
php.ini 文件决定 PHP 如何配置自身以及如何在其工作环境下运行。以下 php.ini 文件中的配置指令有助于使 PHP 更好地运行于 Windows 之中。有一些是可选项。还有很多其它指令也可能与用户环境有关,更多信息见 php.ini 配置选项列表。
必须的指令:
extension_dir = <指向扩展库目录的路径> - extension_dir 需要指向存放 PHP 扩展库文件的目录。可以是绝对路径(如 "C:\PHP\ext")或相对路径(如 ".\ext")。在 php.ini 文件中要加载的扩展库都必须在 extension_dir 所指定的目录之中。
extension = xxxxx.dll - 对每个需要激活的扩展,都需要一行相应的 "extension=" 语句来说明 PHP 启动时加载 extension_dir 目录下的哪些扩展。
log_errors = On - PHP 有错误日志的功能可以将错误报告发送到一个文件中,或者系统服务中(例如系统日志),与下面的 error_log 指令配合工作。在 IIS 下运行时, log_errors 应被激活,并且配合有效的 error_log 。
error_log = <指向错误日志文件的路径> - error_log 需要指向一个具有绝对或相对路径的文件名用于记录 PHP 的错误日志。Web 服务器需要对此文件有可写权限。最常用的位置是各种临时目录,例如 "C:\inetpub\temp\php-errors.log"。
cgi.force_redirect = 0 - 在 IIS 下运行时需要关闭此项指令。这是个在许多其它 web 服务器中都需要激活的目录安全功能,但是在 IIS 下如果激活则会导致 PHP 引擎在 Windows 中出错。
cgi.fix_pathinfo = 1 - 此指令可以允许 PHP 遵从 CGI 规则访问真实路径信息。IIS 的 FastCGI 实现需要激活此指令。
fastcgi.impersonate = 1 - IIS 下的 FastCGI 支持模拟呼叫用户方安全令牌的能力。这使得 IIS 可以定义请求方的安全上下文。
fastcgi.logging = 0 - FastCGI 日志在 IIS 下应被关闭。如果激活,则任何类的任何消息都被 FastCGI 视为错误条件从而导致 IIS 产生 HTTP 500 错误。
可选指令:
max_execution_time = ## - 此指令设定任何脚本所能够运行的最长时间。默认值是 30 秒。如果 PHP 程序需要更多时间运行则增大此值。
memory_limit = ###M - PHP 进程能够占用的内存,单位为兆字节。默认值是 128M,对大多数程序都够用了。某些复杂程序可能需要更多。
display_errors = Off - 此指令设定 PHP 是否将任何错误信息包含在返回给 web 服务器的数据流中。如果设定为 "On",则 PHP 将任何由 error_reporting 指令所定义的错误信息作为错误数据流发给 web 服务器。为安全起见,建议对在线服务器设为 "Off" 以避免泄露任何可能包含在错误消息中的安全敏感信息。
open_basedir = <指向目录的路径,由分号分隔> - 例如 openbasedir="C:\inetpub\wwwroot;C:\inetpub\temp"。此指令指定了允许 PHP 进行文件系统操作的目录。任何对这些目录之外的文件操作都会导致错误。此指令在共享主机环境中特别有用,可以阻止 PHP 脚本访问任何其网站根目录之外的文件。
upload_max_filesize = ###M 和 post_max_size = ###M - 分别是上传文件的最大大小和 POST 方法提交数据的最大大小。如果 PHP 程序需要上传大型数据例如照片和视频文件,则应提高这两项的值。
至此已在系统中安装了 PHP。下一步是选择一种 web 服务器并且使其能够运行 PHP。在目录中选择 web 服务器。
除了可在 web 服务器中运行 PHP 之外,PHP 还可以在命令行运行,如同 .BAT 批处理脚本一样。详见 Windows 下的 PHP 命令行方式。
[#1] 5622477 at qq dot com [2015-09-01 06:34:31]
System: windows 10 x64
php: php-5.6.12-Win32-VC11-x86
apache lounge: httpd-2.4.16-win32-VC11
PHP installing as an Apache handler.
'extension_dir=<path to extension directory>'
The path must be absolute (i.e. "C/php/ext"), if you use relative (i.e."./ext") this effect on command line environment, but don't effect in Apache environment.
[#2] Michael W [2015-06-26 19:18:51]
May seem silly, but to follow up on Aditya's helpful tip make sure to download Visual C++ that corresponds to the version of PHP you installed or else you will have failure. http://www.microsoft.com/en-us/download/details.aspx?id=30679. The link he posted took me to a 64-bit version of the install ( I assume it was 64 bit because my OS is 64 bit).
[#3] Tramb [2012-12-06 13:54:59]
Symptoms:
MySQL is enabled in php.ini, console run of phpinfo() shows that MySQL is enabled, phpinfo() under IIS shows no MySQL.
Solution:
For 32-bit Windows - copy libmysql.dll to WINDOWS\System32\ directory.
For 64-bit Windows, when IIS is running 32-bit application pool, instead of copying libmysql.dll to WINDOWS\System32\ directory, copy it to WINDOWS\SysWOW64\ directory.
[#4] MattH [2012-04-16 06:26:22]
Just a quick note that the visual C requirements for PHP under a windows 64 bit environment aren't for the x64 version, but for the x86 version. Tried installing PHP 5.4 on Server 2008 R2 after installing the x64 version and got:
The application has failed to start because its side-by-side configuration is incorrect. Please see the application event log or use the command-line sxstrace.exe tool for more detail.
Which is basically saying that it can't find the correct C++ package, so after installing the x86 version this error went away. YMMV.
[#5] v_moral at hotmail dot com [2011-02-24 16:13:25]
Problems setting up PHP as an Apache module under Windows?
To install php+apache+win32+mysql with PHP as an Apache module consider the following hints :
- download the 'VC6 x86 Thread Safe' zip file from http://windows.php.net/download/ .
Couldn't make the Non Thread Safe version to work as a loadable module from Apache.
- if you set extension=php_mysql.dll and still have problems, copy the file libmysql.dll (shipped with php's zip) to your WINDOWS\System32\ directory.
The apache-mysql module fails trying to find this library.
[#6] pragal86 at gmail dot com [2011-02-02 03:36:27]
step 1 : clear port 80. ( my computer->manager ->services and application ->services ->iis ->disable )
step 2 : install Apache by exe.
(check if green color is display near apache otherwise some problem in Apache installation).
step 3 : Copy php folder and past it into 'c directory' .
step 4 : Give class path = c:\php;c:\php\ext;
(mycomputer->properties->advance->environmentalproperties->path = c:\php;c:\php\ext; ).
step 5 : Open httpd.conf, that is located in Apache web server installation folder, under conf directory i.e.,
Apache Installation folder > conf > httpd.conf
Add these lines....
LoadModule php5_module "c:/php/php5apache2_2.dll"
AddType application/x-httpd-php .php
PHPIniDir "C:/php"
Step 6: goto php installation directory, there u'll find a file named php-ini-recommended, rename it to, 'php.ini'.
Step 7: Now time to modify php-ini, file... open the file in notepad, look for extension=php_mysql.dll,
uncomment it, i.e., delete ";" thats prefixed...also look for "extension_dir=" append "C:\php\ext"
incase ur php installation directory is php else "C:\%installation dir%\ext"
sterp 8 : find directory index in http.conf and add index.php with index.html
Step 9: Copy libmysql.dll to c:\windows\system32
step 10 : run mysql exe to install it.
step 11 : download phpmysql and place that in htdocs and rename it to phpmyadmin.s
check php and apache installation by give 'local host' in address bar in any browser, If 'Its work' is displayed then its installed correctly and
check the green color in Apache.
Php and apache installation is done ......:):)
[#7] jp at pulgadascubicas dot com [2010-12-05 00:43:01]
Trying to install PHP 5.3.3 VC9 Non-Thread-Safe on Windows 2008 Server running IIS 7.5.
Followed the instructions carefully but still got a 500 error trying to open the classig phpinfo page. After a lot of searching I discovered that everything worked fine after changing the php.ini directive fastcgi.logging from 0 to 1, contrary to what the directions said. I wonder if it was a typo on the instructions or if something changed after a few versions.
Hope this saves someone a couple of hours of searching.
[#8] dkflbk at nm dot ru [2009-06-19 06:46:30]
There is a way to install PHP with nginx-server under windows (current version is 0.7.60)
Step-1 (install nginx server)
Just extract nginx-0.7.60.zip in C:\nginx-0.7.60
In C:\nginx-0.7.60\conf\nginx.conf uncomment and edit following lines
location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME C:/nginx-0.7.60/html$fastcgi_script_name; #this is the one line for edition
include fastcgi_params;
}
and run C:\nginx-0.7.60\nginx.exe (the server is started)
Step-2 (install PHP5)
Just extract php in C:\PHP5
Create (or modify) php.ini
extension_dir="ext/" ;for extensions
And run C:\PHP5\php-cgi.exe -b 127.0.0.1:9000
[#9] txyoji [2009-04-17 07:36:02]
php 5.1.6 zip package for windows does not include a module for apache2.2.
Use apache2.0.x or 1.3.x instead.
[#10] dee at example dot com [2009-02-04 13:57:46]
I did a clean install of Apache 2.2 and PHP 5.2.6 due to conflicts with the old httpd.conf file I had and ran into the "Call to undefined function mysql_connect()" error when trying to run a script that connects to MySQL.
To resolve it I had to copy libmysql.dll from my PHP installation directory to the "bin" folder of my Apache install directory.
I checked the forums.mysql.com as someone else suggested which lead me to this site with the missing step I needed (http://www.artfulsoftware.com/php_mysql_win.html). I spent a good part of the afternoon trying set this up. Hopefully it helps someone out.
[#11] chhabra_gurpreet at yahoo dot com [2009-01-11 11:34:36]
Hi everyone, well i've been trying to configure, install, this setup i.e., Apache, php and mysql, well the prb wat i faced was that most of the installation instructions were quite outdated as they used quite old softwares... well these are the simple steps install and configure this entire setup, hope it will help u....(this is for windows)
Software versions:
Apache - 2.2.11
Mysql - 5.1.30-community
Php - PHP Version 5.2.8
Step 1: Default installation of Apache
Step 2: Default installation of mysql
Step 3: Download php zip file, extract it to ur C: drive under c:\php
Step 4: Add these paths to ur classpath, "C:\php", "C:\php\ext", incase ur installation directory is php, else watever is the name of ur php installation directory use that instead of php
Step 5: Open httpd.conf, that is located in Apache web server installation folder, under conf directory i.e.,
Apache Installation folder > conf > httpd.conf
Add these lines....
>LoadModule php5_module "c:/php/php5apache2_2.dll"
>AddType application/x-httpd-php .php
Step 6: goto php installation directory, there u'll find a file named php-ini-recommended, rename it to, php-ini.
Step 7: Now time to modify php-ini, file... open the file in notepad, look for extension=php_mysql.dll, uncomment it, i.e., delete ";" thats prefixed...also look for "extension_dir=" append "C:\php\ext" incase ur php installation directory is php else "C:\%installation dir%\ext"
Step 8: Copy libmysql.dll to c:\windows\system32
done.......... ;)
[#12] philmee95 at gmail dot com [2008-07-27 02:52:49]
64 bit windows issues. PHP is 32 bit, and w3svc can only run under 32 or 64...not both. You will have to set 32 bit compat mode.
http://www.iisadmin.co.uk/?p=14
[#13] supportatradiormidotcom [2008-03-12 16:44:56]
Im running Win 2003 PHP 5 with the isapi.dll thanks to this sipmle tutorial hope it will help someone.Cerdit goes to Peterguy.
http://www.peterguy.com/php/install_IIS6.html
Follow the instructions, PHP install made easy
[#14] bill at onemeg dot com [2008-02-19 15:48:03]
Your PHP.INI file is not required to be in the C:\WINDOWS folder in XP. The trick is to make sure that the PHP.INI can be found. If you fail to reboot after adding the PHP folder to the path and creating the PHPRC environment variable, the file will likely not be found. If you can't reboot, then try creating the registry entries as described in the following document:
http://www.php.net/manual/en/configuration.php
When you execute "phpinfo();" pay special attention to the data returned in "Loaded Configuration File". If it does not show a path and a the PHP.INI file name, the file is not being loaded. The path of C:\WINDOWS in the Configuration File Path section is the default location where PHP looks for the INI file and does not mean that the file must be located there; in fact, the following document suggest that you leave the configuration file in the C:\PHP folder:
http://www.php.net/manual/en/install.windows.manual.php
[#15] ik2008 at sipvantage dot com [2008-01-18 00:34:31]
In windows XP, the php.ini file must be in c:\windows directory. Or else most of the functions will work except mysql functions. The very first mysql command mysql_connect will fail with the following message "Call to unsupported or undefined function mysql_connect(); "
[#16] fgabrieli at gmail dot com [2007-07-09 20:55:13]
Problem:
Error in my_thread_global_end(): 1 threads didn't exit
It seems that php 5.2.3 libmysql.dll does not work as expected, because Apache shows this error in the logs when we use mysql_*() functions
Solution:
I found it here:
http://forums.mysql.com/read.php?10,153077,155121#msg-155121
which is to replace 'libmysql.dll' file in your PHP installation directory (also in winnt/system32 if you copied it there) with the Dll from PHP 5.2.1
You can download the second one from here:
http://www.php.net/get/php-5.2.1-Win32.zip/from/a/mirror
Regards,
Fernando Gabrieli
[#17] sam b [2007-06-29 13:53:55]
I ran across the same problem listed below, using IIS6 instead of Apache on Windows Server 2003.
It seemed that I could run a PHP script on the command line just fine, and lines such as:
<?php if(function_exists("mysql_connect")) echo "MySQL is present."; ?>
ran without error, and printed as expected.
Loading the file via IIS (using Firefox from my Ubuntu workstation), it wouldn't print anything, indicating that the MySQL extension hadn't been loaded.
Fix: rename/delete all "libmysql.dll" except for the one in "C:\PHP\ext" or equivalent.
... Same fix as listed below, but I wanted to point out: it's relevant to IIS as well.
[#18] adozolj at yahoo dot com [2007-06-28 09:41:39]
I got the 'Fatal Error: call to unindentified function mysql_connect()' and resolved it after many hours of troubleshooting. The problem has to do with the libmysql.dll file residing in multiple directories. It SHOULD only be in the php directory. So, erase the copy in mysql bin and the apache bin and restart apache. I hope this helps someone. if this doesn't help check out forums.mysql.com and search "Call to undefined function mysql_connect". (i got the solution to this problem from here)
[#19] Shivan at Freenet dot de [2007-06-27 13:57:02]
I had the same problem on IIS6 with php 5.2.3, that I got a blank page and nothing more, but the phpinfo(); worked.
The cause wasn't the not-set doc_root, but after enabling "show errors" I got an error message, that my script used more than 8 MB... ;)
After enlarging memory it worked :))))
[#20] dr dot juanc at yahoo dot com [2007-04-17 19:18:09]
Installing PHP5.2.1 in IIS 6.0 bring me some troubles too.
First i need to use full tag to make it your php script works and second the IIS didn't want to load the extension in the ext folder. I cheked the configuration a couple of thousand of time and everything seen to be ok.
I fixed up given read access in the "ext" folder to de "IUSER/PCNAME" user or to everyone/PCNAME user to the same folder. Just in case i did the same in the rest of the folder inside the php folder.
I wish nobody loose an all day in the same thing, like me.
excuse my english please
[#21] shane [2007-03-20 02:17:06]
IIS Windows 2003 server.
You have upgraded to PHP5 from PHP4. phpinfo- works fine. You cannot however communicate with mysql (for example) through phpMyAdmin as it throws up an error stating it cannot load the mysqli extension and/or you get the 'bad handshake' warning.
Solution: update your libmySQL.dll file in your system32 folder. This requires you to stop all internet services on your computer i.e IIS. Full details below.
#############################
Background: my server is set up as follows:
php files folder == C:\PHP
I have configured my php.ini file opening up the required extensions etc
I have mapped the necessary extension to IIS
I have configured my website extension(s)
I have mapped my windows path ';C\PHP;C\PHP\ext'
I have registered my ini file
I have tested my phpinfo() and it works
I have installed phpMyAdmin and it refuses to work
I have tried simple mysql connection scripts ...nada
I have checked everything 50 times
I am bald.
Then I did this:
##############################
1) Copy 'libmySQL.dll' from C:\PHP (or the folder where you have loaded php into)
2) Open 'Windows\system32' folder. Do nothing at the moment, just have this window 'to hand'.
3)Open IIS manager snap in(control panel - administrative tools - IIS manager)
Right click server name as shown below:
- Internet Information Services
- My Computer (local computer) - right click
Select 'all tasks' then 'Restart IIS...'
Use drop down then select 'stop internet services on XXXXX' and click 'OK'
4) Return to your 'Windows\system32' folder. Paste 'libmySQL.dll' (it is already in your clipboard from step 1). It will warn you about overwrite the current one. Select YES.
5) Return to IIS manager. Follow steps as in '3' above except now choose 'Restart Internet Services on XXX' (the default option), click OK.
#############################
I hope this works for you.
[#22] hkhasgiwale at gmail dot com [2007-02-05 22:26:07]
I wasted a lot of time trying to figure out the problem of not being able to display my 'test.php' demo script to work, the file lay in my IIS 5 " C:\inetpub\wwwroot" folder.
The file contents of test.php were:
<?php>
phpinfo();
<?>
Windows php installer version was 5.2.0
Problem lay in the minute dumb feature of windows explorer being used t change(rename) text file extension from 'test.txt' to 'test.php'.
The resultant name looked by the IIS was still 'test.php.txt'.
I used command line to change the filename to 'test.php' and it displayed in my browser.
http://localhost/test.php, worked right away.
[#23] Daniel [2006-12-01 21:11:27]
Re: Manual Configuration, pathing errors in IIS and ISAPI setup
Chris @ 11-Oct-2006 and phpmanual at pbb dot dds dot nl @ 07-Oct-2004 are both correct.
Problem is not with PHP but with IIS (mine is v5.1).
Installed PHP into C:\Program Files\PHP, and set environment variable PATH to path as stated.
When selecting the installation of php5isapi.dll via IIS Administrator, IIS would insert the path as:
"C:\Program Files\PHP\php5isapi.dll" (note the quotes and space in directory name)
All scripts ran and produced a HTTP 500 error.
Replaced ISAPI path in IIS with:
C:\PROGRA~1\PHP\php5isapi.dll (note the removal of the quotes and spaces, and the replacement of the path with 8.3 format names)
All scripts ran w/o problems.
Thanks to all! I hope someone can report if a similar problem exists with IIS6/7.
[#24] Chris [2006-10-11 19:58:12]
RE: phpmanual at pbb dot dds dot nl @ 07-Oct-2004 11:29
You are correct. I just had the same issue; I was following the PHP installation instructions and some very helpful WIMP instructions.
I was trying to keep things tidy by putting my PHP directory in C:\Program Files\PHP. I set the PATH variable, ISAPI filter config and extension in Application Configuration, but was getting the "Specified module could not be found" error.
Changed the PHP directory to C:\PHP and reconfigured everything, did an iisreset, and it started working immediately.
Good catch, and thank you!
[#25] mega-squall at caramail dot com [2006-07-23 02:19:50]
Remember to enter FULL PATH in the extension_dir parameter in php.ini ! Using only "./ext/" or any relative path will have your PHP failing to load extensions when called by Apache. That's quite tricky 'cause extensions are working when PHP is used through command line ...
[#26] Jason Greene [2006-05-04 06:06:42]
If you are running websites within an Application Pool (which is now the default for IIS6 under 2K3) you need to make sure that your PHP directory (e.g. C:\PHP) has read permissions for the user assigned to the Application Pool.
1. In the IIS snap-in, choose Application Pools
2. Right-click on DefaultAppPool (or other, if you have one defined) and choose Properties
3. Click the Identity tab
4. Make a note of the user name set as the security account for this application pool (e.g. "Network Service")
5. Browse to your PHP directory and grant that user read permissions for the entire directory.
In my case, I had to add permissions for the user "NETWORK SERVICE" to get PHP scripts to work. Otherwise I received 401/403 authorization errors when trying to load them in a remote browser.
Note also that first tried adding IUSR permissions to the PHP directory, but that had no effect.
[#27] Ben [2006-04-06 15:17:43]
In the Note Titled "Windows Server 2003 (x64 bits) + IIS 6.0" in step 1 when adding your new .php extension, it will not work unless after you click on the "Home Directory" you make sure that your "Execute permissions:" are set to "Scripts Only".
By default, on my machine, the permissions were set to "None" not allowing php to run.
Also, for more security it might be wise to Add the new extension just to your default site instead of the whole Web Sites folder in IIS. This would only apply if you were hosting multiple sites and had a site you didn't want scripts to run on.
[#28] Windows Server 2003 (x64 bits) + IIS 6.0 [2006-01-31 15:16:15]
1. Add new extension (.php)
* Expand the local computer in the left pane
* Right-click on "Web Sites" in the left pane, then click "Properties" in the menu that pops up
* Flip top the "Home Directory" tab
* Click "Configuration"
* Flip to the "Mappings" tab
* Click "Add..."
* Enter the full path to php5isapi.dll in the "Executable" textbox (Browse... to find it more easily if you need to)
* Enter ".php" in the "Extension" textbox
* Select radial button "Limit to", enter "GET,POST,HEAD"
* Click "OK" all the way out
2. Verify php5isapi.dll is allowed
You must verify that the versions of php5isapi.dll that you want to use are allowed.
2.1. In Internet Information Services (IIS) Manager, in the left-hand column, click the Web Services Extensions node and verify php5isapi.dll is allowed and all other Web Service Extensions are prohibited.
2.2. If the version of php5isapi.dll that you want to use does not appear in the list, follow the instructions to enable it and then repeat this procedure:
Go into IIS
Below all of the websites is a folder: Web Service Extensions
In blue, to the lower left, is a choice: Add A New Web Service Extension
Add PHP/PHP5ISAPI.dll
Choose To ALLOW it.
2.3 If the version of php5isapi.dll you want to use appears on the list but is not allowed, right click the version of php5isapi.dll you want to allow and click Allow.
3. Configuring IIS for 32-Bit Emulation Mode (THIS IS MOST IMPORTANT!!!!)
3.1. If you are installing IIS on x64-based editions of Windows Server 2003 or Windows Server 2003 R2, IIS must be configured to run in 32 bit emulation mode. Perform the following procedure on each front-end Web server running an x64-based edition of Windows Server 2003.
Configure Internet Information Services (IIS) for 32-bit mode
1. Click Start, and then click Run.
2. In the Open box, type cmd, and then click OK.
3. In the command prompt window, navigate to the %drive%:\Inetpub\Adminscripts folder, where %drive% is the drive in which Windows Server 2003 is installed.
4. In the Adminscripts folder, type the following command:
cscript adsutil.vbs set w3svc/AppPools/Enable32bitAppOnWin64 1
Note The value "1" for Enable32bitAppOnWin64 specifies 32-bit mode, whereas the value "0" specifies 64-bit mode.
5. Press ENTER.
6. Type iisreset and then press ENTER.
7. Close the command prompt window.
8. Re-star System.
Note The Run WWW service in IIS 5.0 isolation mode check box is only selected if you have upgraded to IIS 6.0 on Windows Server 2003 from IIS 5.0 on Windows 2000. New installations of IIS 6.0 use IIS 6.0 worker process isolation mode by default.
[#29] patatraboum at nospam dot com [2005-12-26 18:09:55]
IIS + PHP
- The browser can't find your php code like localhost/dir/dir_code.php from any virtual directory (404 error)
- You are sure the code exists
You may rename it with a .html extension and check if it displays
- Process of your php code like localhost/root_code.php is ok from the root directory
It may come from the doc_root directive in php.ini whitch should be set to blank :
doc_root =
Then restart IIS to reload php.ini
[#30] some dude @ some place [2005-11-04 08:57:54]
on two recent installation attempts on iis6 on win2k3 i followed the php manual and windows configuration steps exactly and php would still not run.
on the first install i had to give the USER account (not IUSR) read execute permissions to this file, c:\php\sapi\php4isapi.dll. using filemon i saw that it was being accessed and access was denied.
steps:
- right click on this file > properties > security > add > location (select the server -not domain if listed) > advanced > find now > Users (usually the last item) > click OK
- select Read & Execute > apply
also a complete computer restart was required in each install
[#31] Bill dot Rook at Gmail dot com [2005-09-18 10:09:14]
doc_root = ".;c:\inetpub\wwwroot" does seem to work with virtual websites. This might be a better option then commenting out the line.
[#32] Jason [2005-09-09 16:54:39]
For me atleast, the steps for installing php 5 on IIS 6 on windows 2003 seemed to get buried with the other setups. I found it difficult to quickly look through and make sure I covered every step. So I created a clean step by step tutorial with screenshots:
http://psdforums.com/article.php?a=9
[#33] atomictaco at atomic-taco dot com [2005-07-10 09:17:46]
In response to phpmanual at pbb dot dds dot nl:
You are absolutly correct. I found this out while trying to install PHP4 with Apache2 on XPPro. Here are 3 general guidelines that I have found to be correct:
- Path may not have spaces. Change C:\Program Files to C:\Progra~1 If you don't understand this, go to start-->run-->command (not cmd). Type cd\ and hit enter. Then type dir. You should see all your directory names there.
- Paths should not be enclosed by quotes.
- Use forward slashes (/) and not backslashes (\)
[#34] cpz at akik-ffm dot de [2004-12-19 10:24:16]
In the above, "the web server's directory" means the directory where the server executable lives, for example for the Apache installation on my XP box this is "\program files\apache group\apache2\bin" and NOT just "\program files\apache group\apache2".
But it's probably best to tell your web server where PHP's ini file is stored, for example via PHPIniDir for Apache's http.conf.
[#35] chuacheehow at gmail dot com [2004-10-08 05:55:53]
My experience with IIS 5.1 is that the doc_root directive be commented in order for virtual directories to recognise PHP files (with PHP installed as CGI).
[#36] phpmanual at pbb dot dds dot nl [2004-10-07 06:29:45]
Okay, I'm a total newbie to this, so my findings may be wrong, but this is what I found out.
The manual says "do not have spaces in the path (like C:\Program Files\PHP) as some web servers will crash if you do". Indeed, when using this with PHP5 on WinXP, I got the error message "The specified module could not be found."
However, the problem seems not to lie in the SPACE in the pathname, but in the QUOTES that Windows adds when a space is in the pathname! This is what I found:
"C:\Program Files\php5\php5isapi.dll" -- doesn't work
C:\php5\php5isapi.dll -- works
"C:\php5\php5isapi.dll" -- doesn't work
C:\Progra~1\php5\php5isapi.dll -- works
"C:\Progra~1\php5\php5isapi.dll" -- doesn't work
C:\Program Files\php5\php5isapi.dll -- doesn't work, because it's not accepted by Internet Information Services
I don't know if this all is a problem with Internet Information Services or with PHP, but it would be nice if it was more documented in the PHP manual.
[#37] php dot user dot com [2004-08-29 01:43:00]
After having the same problem as specifed below with "No input file specified". I changed the doc_root as mentioned.
This is fine if all php scripts are going to be run from the c:\inetpub\wwwroot directory. To enable it for multiple websites where the root directories are all different simply leave the doc_root attribute in the php.ini file blank.
This is for the isapi version not cgi implementation. It also means you don't have to set IUSR or IWAM access to the PHP root directory.