search
HomeBackend DevelopmentPHP Tutorial关于Zend Optimizer_PHP

关于Zend Optimizer_PHP

Jun 01, 2016 pm 12:42 PM
phpaboutimplementVersioncompilerun

ZendOptimizer

Zend Optimizer(以下简称ZO)用优化代码的方法来提高PHP 4.0应用程序的执行速度。实现的原理是对那些在被最终执行之前由运行编译器(Run-Time Compiler)产生的代码进行优化。 优化能提高你的盈利能力

一般情况下,执行使用ZO的PHP程序比不使用的要快40%到100%。这意味着网站的访问者可以更快的浏览网页,从而完成更多的事务,创造更好的客户满意度。更快的反应同时也意味着可以节省硬件投资,并增强网站所提供的服务。所以,使用ZO,就等于提高了电子商务的盈利能力。

ZO能给PHP用户带来很多益处,特别是那些运营网站的人。快速运行PHP程序可以显著降低服务器的CPU负载,并可以减少一半的反应时间,也就是从访问者点击链接到服务器开始读取页面之间的时间。

系统需求

当前版本的ZO(Beta 4)只能运行在PHP 4.0下。

对操作系统的要求如下:
- 基于glibc2.1的x86 Linux系统(Red Hat 6.1, Mandrake 7.0, Slackware 7.0及SuSE 6.1)
- 基于glibc2的x86 Linux系统(Red Hat 5.2, SuSE 6.1)
- 基于libc5的x86 Linux系统(Slackware 4.0, Debian 1.3.1r8)
- Sparc Solaris 2.6, 7和8
- FreeBSD 3.4和4.0
- Windows NT 4.0(不包括其它版本的Windows)

对PHP的要求如下:
- PHP 4.0.0:以外的版本均不被支持
- 同时支持CGI方式和Apache模块方式
- 在Windows下,PHP必须:1)是从http://www.php.net上下载的现成的WIN32执行版本;2)自己编译时带"Release_Ts"(Release Thread Safe)选项的。

安装过程

-UNIX
1 编译PHP,不要加调试选项-否则ZO不会工作:在配置是加上--disable-debug选项
2 复制ZendOptimizer.so文件到你的机器,通常放在:/usr/local/Zend/lib下
3 在php.ini文件中加入如下两行,不要包含任何空格:
zend_optimizer.optimization_level=7
zend_extension="/usr/local/Zend/lib/ZendOptimizer.so"
4 重新启动Apache服务器

-WINDOWS
1 从http://www.php.net下载WINDOWS版的PHP 4.0.0,这个版本不包含调试特性。
2 复制ZendOptimizer.dll文件到你的机器,通常放在:C:\Program Files\Zend\lib下
3 在php.ini文件中加入如下两行,不要包含任何空格:
zend_optimizer.optimization_level=7
zend_extension_ts="C:\Program Files\Zend\lib\ZendOptimizer.dll"
4 如果需要的话,重新启动WEB服务器

Zend Optmizer常见问题

问:什么是Zend Optimizer;有什么用?
答:ZO仔细检查有运行编译器产生的代码,分析并做优化,让它运行得更快。

问:为什么要用ZO,难道PHP4还不够快吗?
答:的确,用于PHP4的标准运行编译器已经够快了--相同情况下比PHP3要快2-10倍。但使用了ZO的PHP程序的执行速度还会加快40%到100%。

问:ZO在PHP4软件安装的什么位置?
答:ZO位于PHP4的ZEND引擎中,介于运行编译器和最终执行器之间。

问:ZO的最终发布版本要付费吗?
答:不要。ZO的最终版本将继续作为免费软件来发布。ZEND技术公司不打算对任何ZO版本收费。

问:开发人员如何获知ZO是否在运行?
答:只要用PHP的函数phpinfo()来检测便知,如下所示:
phpinfo();
?>
显示的结果中关于ZO的部分就象下面这样:
This program makes use of the Zend scripting language engine:
Zend Engine v1.0, Copyright ? 1998-2000 Zend Technologies Ltd.
with Zend Optimizer v0.98, Copyright ? 1998-2000 by Zend Technologies

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
PHP Performance Tuning for High Traffic WebsitesPHP Performance Tuning for High Traffic WebsitesMay 14, 2025 am 12:13 AM

ThesecrettokeepingaPHP-poweredwebsiterunningsmoothlyunderheavyloadinvolvesseveralkeystrategies:1)ImplementopcodecachingwithOPcachetoreducescriptexecutiontime,2)UsedatabasequerycachingwithRedistolessendatabaseload,3)LeverageCDNslikeCloudflareforservin

Dependency Injection in PHP: Code Examples for BeginnersDependency Injection in PHP: Code Examples for BeginnersMay 14, 2025 am 12:08 AM

You should care about DependencyInjection(DI) because it makes your code clearer and easier to maintain. 1) DI makes it more modular by decoupling classes, 2) improves the convenience of testing and code flexibility, 3) Use DI containers to manage complex dependencies, but pay attention to performance impact and circular dependencies, 4) The best practice is to rely on abstract interfaces to achieve loose coupling.

PHP Performance: is it possible to optimize the application?PHP Performance: is it possible to optimize the application?May 14, 2025 am 12:04 AM

Yes,optimizingaPHPapplicationispossibleandessential.1)ImplementcachingusingAPCutoreducedatabaseload.2)Optimizedatabaseswithindexing,efficientqueries,andconnectionpooling.3)Enhancecodewithbuilt-infunctions,avoidingglobalvariables,andusingopcodecaching

PHP Performance Optimization: The Ultimate GuidePHP Performance Optimization: The Ultimate GuideMay 14, 2025 am 12:02 AM

ThekeystrategiestosignificantlyboostPHPapplicationperformanceare:1)UseopcodecachinglikeOPcachetoreduceexecutiontime,2)Optimizedatabaseinteractionswithpreparedstatementsandproperindexing,3)ConfigurewebserverslikeNginxwithPHP-FPMforbetterperformance,4)

PHP Dependency Injection Container: A Quick StartPHP Dependency Injection Container: A Quick StartMay 13, 2025 am 12:11 AM

APHPDependencyInjectionContainerisatoolthatmanagesclassdependencies,enhancingcodemodularity,testability,andmaintainability.Itactsasacentralhubforcreatingandinjectingdependencies,thusreducingtightcouplingandeasingunittesting.

Dependency Injection vs. Service Locator in PHPDependency Injection vs. Service Locator in PHPMay 13, 2025 am 12:10 AM

Select DependencyInjection (DI) for large applications, ServiceLocator is suitable for small projects or prototypes. 1) DI improves the testability and modularity of the code through constructor injection. 2) ServiceLocator obtains services through center registration, which is convenient but may lead to an increase in code coupling.

PHP performance optimization strategies.PHP performance optimization strategies.May 13, 2025 am 12:06 AM

PHPapplicationscanbeoptimizedforspeedandefficiencyby:1)enablingopcacheinphp.ini,2)usingpreparedstatementswithPDOfordatabasequeries,3)replacingloopswitharray_filterandarray_mapfordataprocessing,4)configuringNginxasareverseproxy,5)implementingcachingwi

PHP Email Validation: Ensuring Emails Are Sent CorrectlyPHP Email Validation: Ensuring Emails Are Sent CorrectlyMay 13, 2025 am 12:06 AM

PHPemailvalidationinvolvesthreesteps:1)Formatvalidationusingregularexpressionstochecktheemailformat;2)DNSvalidationtoensurethedomainhasavalidMXrecord;3)SMTPvalidation,themostthoroughmethod,whichchecksifthemailboxexistsbyconnectingtotheSMTPserver.Impl

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),