10秒手工安装windows2012+IIS8+PHP5.2(FastCGI模式)+ZendOptimizer3.3.3+eAccelerator+Mysql

其他技术 站长 浏览 评论

本文适用与windows2012 和win2008

快速安装步骤

1、下载
PHP:http://windows.php.net/downloads/releases/php-5.2.17-Win32-VC6-x86.zip(或者到http://windows.php.net/downloads/releases/archives/里面找)
MySQL:http://downloads.mysql.com/archives/mysql-5.1/mysql-noinstall-5.1.65-winx64.zip
http://downloads.mysql.com/archives/mysql-5.1/mysql-noinstall-5.1.65-win32.zip(32位系统)
php.ini+自己编写的my.ini+Zend+phpmyadmin+TMP空白目录+Xlight+Notepad2+批处理+本文.txt[Service.zip]
http://pan.baidu.com/share/link?shareid=132648&uk=1426358330

 

2、解压
把最后的压缩解压到D: 会自动创建Service目录
D:ServiceDataMySQL 为mysql数据目录,通过编辑my.ini可以自由移动
D:ServiceHtdocs 为phpmyadmin和phpinfo目录,建议把iis里面默认站点指过来,也可以删掉
把mysql解压到D:ServiceSoftmysql-5.1
把php解压到D:ServiceSoftphp-5.2
3、配置IIS 启动Mysql
IIS起始页下点击主机名(非站点名)>处理应用程序映射>添加模块映射
==================
路径:*.php
模块:FastCgiModule(下拉框选择)
可执行:D:ServiceSoftphp-5.2php-cgi.exe(不是dll)
名称:Php-FastCgi(名字随意)
==================
站点>默认文档>添加index.php 顺便添加 index.shtml index.shtm index.asp
然后运行 _安装MySQL.bat 即可 mysql默认密码是空

======================================================
据说FastCGI性能虽然比不上lamp甚至都比不上lnmp但是,总算是有改进了。
FastCGI性能测试

<?php
list($usec, $sec) = explode(” “,microtime());
$aa = ?((float)$usec + (float)$sec);
//echo $a.'<br/>’;
for($i=0;$i<10000000;$i++){
$a = $i*2;
}
list($usec, $sec) = explode(” “,microtime());
$b = ((float)$usec + (float)$sec);
//echo $b.'<br/>’;
echo ($b – $aa);
?>

在G540T的cpu上大概是1.6秒

Windows2012 额,盗版的,因为还干别的,所以使用蛋疼的Windows 获取:http://www.leiyanhui.com/Windows-Server-2012-key
PHP5.2.17 线程安全版 目前5.2的最新版了,不选择5.3 5.4甚至5.5只是为了兼容性
微软推荐在FastCGI下面使用非线程安全版本,据说效率更高,可悲的是非线程安全版本不支持Zend。当然你不用zend的话还是用非线程安全版本好了。也可以每个站点用不同的版本,随意。
http://windows.php.net/downloads/releases/php-5.2.17-Win32-VC6-x86.zip
历史版本存档
http://windows.php.net/downloads/releases/archives/
mysql-5.1.65
http://downloads.mysql.com/archives/mysql-5.1/mysql-noinstall-5.1.65-winx64.zip
http://downloads.mysql.com/archives/mysql-5.1/mysql-noinstall-5.1.65-win32.zip(32位系统)
ZendOptimizer3.3.3
官网地址:http://downloads.zend.com/optimizer/3.3.3/ZendOptimizer-3.3.3-Windows-i386.exe
eAccelerator 0.9.5.3 for PHP 5.2.17(VC6编译),这个需要自己编译了。或者下载本文附件里面一体包自己copy出来

步入正题

1、目录目录

D:ServiceSoftphp-5.2
D:ServiceSoftmysql-5.1
D:ServiceSoftZendeAccelerator
D:ServiceSoftZendZendEncoder
D:ServiceSoftZendZendOptimizer-3.3.3
D:ServiceSoftTMPeaccelerator
D:ServiceSoftTMPupload

2、php.ini
复制 php.ini-recommended 为 php.ini

date.timezone=”Asia/Shanghai”
extension_dir = “./ext”
cgi.force_redirect = 0
cgi.fix_pathinfo=1
fastcgi.impersonate = 1
memory_limit = 256M
post_max_size = 20M
upload_tmp_dir =”D:/Service/Soft/TMP/upload”
upload_max_filesize = 20M
extension=php_bz2.dll
extension=php_curl.dll
;extension=php_dba.dll
;extension=php_dbase.dll
;extension=php_fdf.dll
extension=php_gd2.dll
extension=php_gettext.dll
;extension=php_gmp.dll
;extension=php_ifx.dll
;extension=php_imap.dll
;extension=php_interbase.dll
;extension=php_ldap.dll
extension=php_mbstring.dll
extension=php_exif.dll
extension=php_mcrypt.dll
extension=php_mhash.dll
;extension=php_mime_magic.dll
;extension=php_ming.dll
;extension=php_msql.dll
;extension=php_mssql.dll
extension=php_mysql.dll
extension=php_mysqli.dll
;extension=php_oci8.dll
;extension=php_openssl.dll
extension=php_pdo.dll
;extension=php_pdo_firebird.dll
;extension=php_pdo_mssql.dll
extension=php_pdo_mysql.dll
;extension=php_pdo_oci.dll
;extension=php_pdo_oci8.dll
;extension=php_pdo_odbc.dll
;extension=php_pdo_pgsql.dll
extension=php_pdo_sqlite.dll
;extension=php_pgsql.dll
;extension=php_pspell.dll
;extension=php_shmop.dll
;extension=php_snmp.dll
;extension=php_soap.dll
;extension=php_sockets.dll
extension=php_sqlite.dll
;extension=php_sybase_ct.dll
;extension=php_tidy.dll
extension=php_xmlrpc.dll
extension=php_xsl.dll
extension=php_zip.dll

末尾添加一段

[eaccelerator]
zend_extension_ts=”D:/Service/Soft/Zend/eAccelerator/eaccelerator.dll”
eaccelerator.shm_size=”32″
eaccelerator.cache_dir=”D:/Service/Soft/TMP/eaccelerator/”
eaccelerator.enable=”1″
eaccelerator.optimizer=”1″
eaccelerator.check_mtime=”1″
eaccelerator.debug=”0″
eaccelerator.filter=””
eaccelerator.shm_max=”0″
eaccelerator.shm_ttl=”0″
eaccelerator.shm_prune_period=”0″
eaccelerator.shm_only=”0″
eaccelerator.compress=”1″
eaccelerator.compress_level=”9″
eaccelerator.keys = “shm”
eaccelerator.sessions = “shm”
[Zend]
zend_optimizer.optimization_level=1023
zend_optimizer.encoder_loader=1
zend_extension_ts=”D:/Service/Soft/Zend/ZendOptimizer-3.3.3/php-5.2.x/ZendOptimizer.dll”

cmd
在cmd窗口下 运行 D:ServiceSoftphp-5.2php.exe -info 检查一下

 

处理iis
IIS起始页下点击主机名(非站点名)>处理应用程序映射>添加模块映射
==================
路径:*.php
模块:FastCgiModule(下拉框选择)
可执行:D:ServiceSoftphp-5.2php-cgi.exe(不是dll)
名称:Php-FastCgi(名字随意)
==================
站点>默认文档>添加index.php 顺便添加 index.shtml index.shtm index.asp

测试phpinfo应该可以执行了

新建几个批处理
_安装MySQL.bat

@ECHO OFF
D:ServiceSoftmysql-5.1binmysqld –install
net start mysql

__卸载MySQL.bat

@ECHO OFF
net stop mysql
D:ServiceSoftmysql-5.1binmysqld.exe -remove

__重启IIS.bat

@ECHO OFF
net stop w3svc
net start w3svc
::win2012已经放弃了iisadmin

__重启MySQL.bat

@ECHO OFF
net stop mysql
net start mysql

所有批处理后面加上一段,延迟5秒关闭

echo ?if wscript.arguments(0)^>0 then wscript.Sleep(wscript.arguments(0) * 1000):end if>”%Temp%delay01.vbs”
cscript “%temp%delay01.vbs” 5
del “%Temp%delay01.vbs

转载请注明:网页阁吧 » 10秒手工安装windows2012+IIS8+PHP5.2(FastCGI模式)+ZendOptimizer3.3.3+eAccelerator+Mysql