在Windows环境下编译、配置 eAccelerator 加速PHP 附eAccelerator.dll for php5.3.8 nts下载
本文使用到的程序以及版本下载地址如下:
(笔者使用fast-cgi模式运行php,请根据自己的实际情况进行相关的改动和配置,本文附件提供php5.3.6VC9nts以及php5.2.17vc6nts(使用VC6.0编译)编译后的 eAccelerator v0.9.6.1下载 。)
Php5.3.6(VC9 x86 Non Thread Safe)下载地址:http://windows.php.net/download/
Php5.3.6源文件(PHP 5.3.6 (tar.bz2) 下载地址:http://www.php.net/downloads.php
eAccelerator v0.9.6.1(源文件)下载地址:http://eaccelerator.net/
Visual Studio 2008 express下载地址:http://msdn.microsoft.com/zh-cn/express/
Nginx1.0.0 下载地址:http://nginx.org/en/download.html
bison.exe 下载地址:http://gnuwin32.sourceforge.net/packages/bison.htm(此文附件也提供下载)
———————————————————–
好了,我们现在开始:
第一步、解压下载到得php5.3.6源文件包tar.bz2包到C盘c:/phpsrc,并且解压php5.3.6(VC9 x86 Non Thread Safe,也就是能够正常使用的php压缩包文件)到C:/php,我们只需要里面的一个文件C:/php/dev/ php5.lib,复制php5.lib到c:/phpsrc。
第二部、复制bison.exe到C:/Program Files/Microsoft Visual Studio 9.0/VC/bin(也就是Visual Studio 2008 express安装后的路径)
第三部、在这里我们开始生成生成config.w32.h。打开开始菜单找到Visual Studio 2008里面的命令提示,在里面操作:
进入:c:/phpsrc执行buildconf.bat,
建立一个临时环境变量
执行set path=%path%;C:/phpsrc/bin
执行 cscript /nologo configure.js –with-php-build=”../phpsrc” –without-libxml –disable-odbc –disable-zts
如果想要Thread Safe 模式就去掉上面的命令最后的参数 –disable-zts
然后看看是不是main下面多了一个 config.w32.h
第四步、在C:/phpsrc/ext下建立文件夹eaccelerator将eAccelerator v0.9.6.1(源文件)解压后里面的全部文件复制到C:/phpsrc/ext/eaccelerator文件夹内,启动Visual Studio 2008打开C:/phpsrc/ext/eaccelerator/win32/eAccelerator.dsw文件,点击Visual Studio 2008菜单“生成->配配置管理器-活动解决方案配置-Release-NTS-关闭”–>“生成->生成eAccelerator”
OK,这时候你会发现C:/phpsrc/ext/eaccelerator/win32/Release里面已经生成了一个eAccelerator.dll文件,将此文件复制到c:/php/ext里面即可现在这个文件已经能够使用了,并且是根据你现在正在使用的php版本生成的eAccelerator。
————————————————————–
下面是配置eAccelerator,在C盘建立目录eAccelerator
打开PHP.INI
在文件最末增加以下代码:
[eAccelerator]
zend_extension=”C:/php-5.3.8-nts-Win32-VC9-x86/ext/eAccelerator.dll”
eaccelerator.shm_size=”128″
eaccelerator.cache_dir=”C:/phpcache/eAcceleratorCache”
eaccelerator.enable=”1″
eaccelerator.optimizer=”1″
eaccelerator.check_mtime=”1″
eaccelerator.debug=”0″
eaccelerator.filter=””
eaccelerator.shm_max=”0″
eaccelerator.shm_ttl=”3600″
eaccelerator.shm_prune_period=”3600″
eaccelerator.shm_only=”0″
eaccelerator.compress=”1″
eaccelerator.compress_level=”9″
eaccelerator.keys=”disk_only”
eaccelerator.sessions=”disk_only”
eaccelerator.content=”disk_only”
;这是控制面板的地址,安装包里有个control.php,你把它复制到网站的任意目录,可以用它查看和管理,这个必须指定,否则查看缓存内容的时候会出错
eaccelerator.allowed_admin_path=”C:/websites/eaccelerator”
关于eAccelerator的详细配置请查阅:www.oaxueyuan.com/eaccelerator-configuration-parameters-explain.html
重新启动php-cgi.exe,OK,配置完成!
附件下载:
注意,编译本文件,必须使用VS 2008 ,即编译为VC9的版本,不然在系统日志里会报错,上一个版本我是用VS2010编译的,出错信息为:
“弹出应用程序: Warning: PHP Startup: eAccelerator: Unable to initialize module
Module compiled with build ID=API20090626,NTS,VC10
PHP compiled with build ID=API20090626,NTS,VC9
These options need to match
有关更多信息,请参阅在 http://go.microsoft.com/fwlink/events.asp 的帮助和支持”
再用VS 2008重新编译一次,文件本地下载地址:
eAccelerator.dll For 5.3.8 nts Windows 非线程安全版
Bison下载:
原创文章,作者:斑斓网站长,如若转载,请注明出处:https://www.argb.net/compiled-in-a-windows-environment-configuration-eaccelerator-php-acceleration.html
评论列表(5条)
求一个php5.3.10 的DLL
@kinor:有空了我再编译一个
D:\php-5.3.21>cscript /nologo configure.js -with-php-build=”../php-5.3.21” -wi
thout-libxml -disable-odbc -disable-zts
Unknown option -with-php-build; please try configure.js –help for a list of val
id options
囧啊……怎么回事
博主!错了!是
cscript /nologo configure.js –with-php-build=”../phpsrc” —
without-libxml –disable-odbc –disable-zts
才对,是–,不是-
还是不行,我用Visual Studio 2010的:
1>—— 已启动生成: 项目: eAccelerator, 配置: Release NTS Win32 ——
1>生成启动时间为 2013/2/2 20:57:46。
1>InitializeBuildStatus:
1> 正在创建“.\eAccelerator___Win32_Release_NTS\eAccelerator.unsuccessfulbuild”,因为已指定“AlwaysCreate”。
1>ClCompile:
1> debug.c
1>..\debug.c(46): warning C4996: ‘fopen’: This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1> D:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(234) : 参见“fopen”的声明
1>..\debug.c(50): warning C4996: ‘fileno’: The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _fileno. See online help for details.
1> D:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(723) : 参见“fileno”的声明
1> ea_dasm.c
1> ea_info.c
1>..\ea_info.c(125): warning C4996: ‘strcpy’: This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1>..\ea_info.c(130): warning C4996: ‘strcpy’: This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1>..\ea_info.c(148): warning C4996: ‘open’: The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _open. See online help for details.
1> D:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\io.h(312) : 参见“open”的声明
1>..\ea_info.c(153): warning C4996: ‘read’: The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _read. See online help for details.
1> D:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\io.h(313) : 参见“read”的声明
1>..\ea_info.c(155): warning C4996: ‘close’: The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _close. See online help for details.
1> D:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\io.h(302) : 参见“close”的声明
1>..\ea_info.c(156): warning C4996: ‘unlink’: The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _unlink. See online help for details.
1> D:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(299) : 参见“unlink”的声明
1>..\ea_info.c(159): warning C4996: ‘close’: The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _close. See online help for details.
1> D:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\io.h(302) : 参见“close”的声明
1> ea_restore.c
1> ea_store.c
1>..\ea_store.c(205): error C2143: 语法错误 : 缺少“;”(在“类型”的前面)
1>..\ea_store.c(207): error C2065: “opline”: 未声明的标识符
1>..\ea_store.c(207): warning C4047: “=”:“int”与“zend_op *”的间接级别不同
1>..\ea_store.c(208): error C2065: “end”: 未声明的标识符
1>..\ea_store.c(208): error C2065: “opline”: 未声明的标识符
1>..\ea_store.c(209): error C2065: “opline”: 未声明的标识符
1>..\ea_store.c(209): error C2065: “end”: 未声明的标识符
1>..\ea_store.c(209): error C2065: “opline”: 未声明的标识符
1>..\ea_store.c(210): error C2065: “opline”: 未声明的标识符
1>..\ea_store.c(210): error C2223: “->op1”的左侧必须指向结构/联合
1>..\ea_store.c(211): error C2065: “opline”: 未声明的标识符
1>..\ea_store.c(211): error C2223: “->op1”的左侧必须指向结构/联合
1>..\ea_store.c(211): error C2198: “calc_zval”: 用于调用的参数太少
1>..\ea_store.c(213): error C2065: “opline”: 未声明的标识符
1>..\ea_store.c(213): error C2223: “->op2”的左侧必须指向结构/联合
1>..\ea_store.c(214): error C2065: “opline”: 未声明的标识符
1>..\ea_store.c(214): error C2223: “->op2”的左侧必须指向结构/联合
1>..\ea_store.c(214): error C2198: “calc_zval”: 用于调用的参数太少
1>..\ea_store.c(352): warning C4090: “函数”: 不同的“const”限定符
1>..\ea_store.c(360): warning C4090: “函数”: 不同的“const”限定符
1> eaccelerator.c
1>..\eaccelerator.c(309): warning C4996: ‘sscanf’: This function or variable may be unsafe. Consider using sscanf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1> D:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(325) : 参见“sscanf”的声明
1>..\eaccelerator.c(312): warning C4996: ‘sscanf’: This function or variable may be unsafe. Consider using sscanf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1> D:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(325) : 参见“sscanf”的声明
1>..\eaccelerator.c(324): warning C4996: ‘strnicmp’: The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _strnicmp. See online help for details.
1> D:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\string.h(248) : 参见“strnicmp”的声明
1>..\eaccelerator.c(326): warning C4996: ‘sscanf’: This function or variable may be unsafe. Consider using sscanf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1> D:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(325) : 参见“sscanf”的声明
1>..\eaccelerator.c(327): warning C4996: ‘strnicmp’: The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _strnicmp. See online help for details.
1> D:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\string.h(248) : 参见“strnicmp”的声明
1>..\eaccelerator.c(329): warning C4996: ‘sscanf’: This function or variable may be unsafe. Consider using sscanf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1> D:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(325) : 参见“sscanf”的声明
1>..\eaccelerator.c(330): warning C4996: ‘strnicmp’: The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _strnicmp. See online help for details.
1> D:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\string.h(248) : 参见“strnicmp”的声明
1>..\eaccelerator.c(332): warning C4996: ‘sscanf’: This function or variable may be unsafe. Consider using sscanf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1> D:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(325) : 参见“sscanf”的声明
1>..\eaccelerator.c(582): warning C4996: ‘strncpy’: This function or variable may be unsafe. Consider using strncpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1> D:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\string.h(188) : 参见“strncpy”的声明
1>..\eaccelerator.c(603): warning C4996: ‘open’: The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _open. See online help for details.
1> D:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\io.h(312) : 参见“open”的声明
1>..\eaccelerator.c(605): warning C4996: ‘read’: The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _read. See online help for details.
1> D:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\io.h(313) : 参见“read”的声明
1>..\eaccelerator.c(607): warning C4996: ‘close’: The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _close. See online help for details.
1> D:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\io.h(302) : 参见“close”的声明
1>..\eaccelerator.c(612): warning C4996: ‘close’: The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _close. See online help for details.
1> D:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\io.h(302) : 参见“close”的声明
1>..\eaccelerator.c(613): warning C4996: ‘unlink’: The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _unlink. See online help for details.
1> D:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(299) : 参见“unlink”的声明
1>..\eaccelerator.c(626): warning C4996: ‘close’: The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _close. See online help for details.
1> D:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\io.h(302) : 参见“close”的声明
1>..\eaccelerator.c(631): warning C4996: ‘read’: The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _read. See online help for details.
1> D:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\io.h(313) : 参见“read”的声明
1>..\eaccelerator.c(633): warning C4996: ‘close’: The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _close. See online help for details.
1> D:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\io.h(302) : 参见“close”的声明
1>..\eaccelerator.c(634): warning C4996: ‘unlink’: The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _unlink. See online help for details.
1> D:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(299) : 参见“unlink”的声明
1>..\eaccelerator.c(644): warning C4996: ‘close’: The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _close. See online help for details.
1> D:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\io.h(302) : 参见“close”的声明
1>..\eaccelerator.c(662): warning C4996: ‘unlink’: The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _unlink. See online help for details.
1> D:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(299) : 参见“unlink”的声明
1>..\eaccelerator.c(700): warning C4996: ‘unlink’: The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _unlink. See online help for details.
1> D:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(299) : 参见“unlink”的声明
1>..\eaccelerator.c(701): warning C4996: ‘open’: The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _open. See online help for details.
1> D:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\io.h(312) : 参见“open”的声明
1>..\eaccelerator.c(710): warning C4996: ‘write’: The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _write. See online help for details.
1> D:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\io.h(318) : 参见“write”的声明
1>..\eaccelerator.c(712): warning C4996: ‘write’: The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _write. See online help for details.
1> D:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\io.h(318) : 参见“write”的声明
1>..\eaccelerator.c(715): warning C4996: ‘close’: The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _close. See online help for details.
1> D:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\io.h(302) : 参见“close”的声明
1>..\eaccelerator.c(717): warning C4996: ‘strerror’: This function or variable may be unsafe. Consider using strerror_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1> D:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\string.h(157) : 参见“strerror”的声明
1>..\eaccelerator.c(993): warning C4996: ‘strcpy’: This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1>..\eaccelerator.c(1011): warning C4996: ‘strcpy’: This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1>..\eaccelerator.c(1063): warning C4996: ‘strcpy’: This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1>..\eaccelerator.c(1423): warning C4996: ‘strcat’: This function or variable may be unsafe. Consider using strcat_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1>..\eaccelerator.c(1478): warning C4996: ‘strncpy’: This function or variable may be unsafe. Consider using strncpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1> D:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\string.h(188) : 参见“strncpy”的声明
1>..\eaccelerator.c(1509): warning C4996: ‘strnicmp’: The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _strnicmp. See online help for details.
1> D:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\string.h(248) : 参见“strnicmp”的声明
1>..\eaccelerator.c(1625): warning C4996: ‘localtime’: This function or variable may be unsafe. Consider using localtime_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1> D:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\time.inl(58) : 参见“localtime”的声明
1>..\eaccelerator.c(1634): warning C4996: ‘asctime’: This function or variable may be unsafe. Consider using asctime_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1> D:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\time.h(153) : 参见“asctime”的声明
1>..\eaccelerator.c(1636): warning C4996: ‘asctime’: This function or variable may be unsafe. Consider using asctime_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1> D:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\time.h(153) : 参见“asctime”的声明
1>..\eaccelerator.c(1732): warning C4996: ‘umask’: The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _umask. See online help for details.
1> D:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\io.h(317) : 参见“umask”的声明
1>..\eaccelerator.c(1742): warning C4013: “S_ISDIR”未定义;假设外部返回 int
1>..\eaccelerator.c(1752): warning C4996: ‘umask’: The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _umask. See online help for details.
1> D:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\io.h(317) : 参见“umask”的声明
1>..\eaccelerator.c(1764): warning C4996: ‘umask’: The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _umask. See online help for details.
1> D:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\io.h(317) : 参见“umask”的声明
1>..\eaccelerator.c(1771): warning C4996: ‘chmod’: The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _chmod. See online help for details.
1> D:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\io.h(300) : 参见“chmod”的声明
1>..\eaccelerator.c(1786): warning C4996: ‘umask’: The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _umask. See online help for details.
1> D:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\io.h(317) : 参见“umask”的声明
1> fnmatch.c
1> mm.c
1>..\mm.c(644): warning C4996: ‘strncpy’: This function or variable may be unsafe. Consider using strncpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1> D:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\string.h(188) : 参见“strncpy”的声明
1>..\mm.c(662): warning C4996: ‘strncpy’: This function or variable may be unsafe. Consider using strncpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1> D:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\string.h(188) : 参见“strncpy”的声明
1>..\mm.c(1010): warning C4996: ‘strcpy’: This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1>..\mm.c(1054): warning C4996: ‘strcpy’: This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1> opcodes.c
1> optimize.c
1> 正在生成代码…
1>
1>生成失败。
1>
1>已用时间 00:00:04.40
========== 生成: 成功 0 个,失败 1 个,最新 0 个,跳过 0 个 ==========