Posted in
Hosting & IIS7,
Windows Server |
No Comment | 5,540 views | 24/03/2009 09:16
Now what we did? First, we started with Bind Unattended Install, then we did MailEnable unattended install, now we are going to install PHP on IIS7 unattendedly. First, you should download php package (zip) and extract it to somewhere. Then you should make a batch file (.bat) to configure IIS7 Fastcgi support. My batch file:
1
2
3
4
5
6
7
| mkdir "C:\PHP"
xcopy /E "R:\PHP" "C:\PHP\"
setx Path "C:\PHP"
%windir%\system32\inetsrv\appcmd set config /section:system.webServer/fastCGI /+[fullPath='c:\PHP\php-cgi.exe']
%windir%\system32\inetsrv\appcmd set config /section:system.webServer/handlers /+[name='PHP_via_FastCGI',path='*.php',verb='*',modules='FastCgiModule',scriptProcessor='c:\PHP\php-cgi.exe',resourceType='Unspecified']
%windir%\system32\inetsrv\appcmd set config /section:defaultDocument /+files.[value='index.php']
exit |
mkdir "C:\PHP"
xcopy /E "R:\PHP" "C:\PHP\"
setx Path "C:\PHP"
%windir%\system32\inetsrv\appcmd set config /section:system.webServer/fastCGI /+[fullPath='c:\PHP\php-cgi.exe']
%windir%\system32\inetsrv\appcmd set config /section:system.webServer/handlers /+[name='PHP_via_FastCGI',path='*.php',verb='*',modules='FastCgiModule',scriptProcessor='c:\PHP\php-cgi.exe',resourceType='Unspecified']
%windir%\system32\inetsrv\appcmd set config /section:defaultDocument /+files.[value='index.php']
exit
As you see, first I copied php files from a source, then configured FastCgi support, after that I added index.php value for Default Document. My source is a network share but you can do whatever you want.
Note: You should use non-thread-safe zip package for fastcgi, for example “PHP 5.2.9-1 Non-thread-safe zip package”.