How to allow Zend Optimizer and Zend Debugger coexist

One php script  that I used was encoded with Zend so I must enable Zend optimizer to run those scripts on my web server, yeah, as any smart people would guess, Zend optimizer should run smoothly with Zend Debugger, after all, they are all made by Zend, right? Turns out I was wrong.

I got this message after I enabled both Zend optimizer and Zend debugger(I was using xampp with php 5.2.4):

PHP Fatal error:  [Zend Optimizer] Zend Debugger must be loaded after Zend Optimizer in Unknown on line 0

The php.ini was configured this way

zend_extension_ts = “E:\xamp\php\zendOptimizer\lib\ZendExtensionManager.dll”
zend_extension_manager.optimizer_ts = “E:\xamp\php\zendOptimizer\lib\Optimizer”
zend_extension_ts = “e:\xamp\php\ext\ZendDebugger.dll”

After some research, turns out the default suggested configuration was wrong, you must use a hidden arg zend_extension_manager.debug_server_ts and point it to a container directory that names its children directory with a name pattern “php-n.m.x”.

Here is the steps:

  1. download latest 5.2.10 Zend Debugger here
  2. unzip the downloaded zip file to your web host, rename the children directory from m_n_x_comp to php-m.n.x, i.e. change 5_2_x_comp to php-5.2.x
  3. point zend_extension_manager.debug_server_ts to the parent folder of php-m.n.x
  4. enable optimizer in the same way

so completed php.ini should have something like this.

zend_extension_ts = “c:\xamp\php\zendOptimizer\lib\ZendExtensionManager.dll”
zend_extension_manager.optimizer_ts = “c:\xamp\php\zendOptimizer\lib\Optimizer”
zend_extension_manager.debug_server_ts=c:\xamp\zend-5.2.10
zend_debugger.expose_remotely=allowed_hosts
zend_debugger.allow_hosts=127.0.0.1/32,192.168.1.0/255
zend_debugger.allow_tunnel=127.0.0.1/32

Now start your apache and have fun!

你可能感兴趣的:(apache,PHP,Zend,ZendDebugger,zendOptimizer)