How to allow Zend Optimizer and Zend Debugger coexist

January 13th, 2008

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!

Entry Filed under: IT (geeky)

22 Comments Add your own

  • 1. Anonymous  |  April 7th, 2008 at 3:10 am

    This worked like a charm, thanks a ton!!

  • 2. Marco  |  May 1st, 2008 at 11:29 am

    Many thanks, this saved me!

  • 3. Rick  |  May 5th, 2008 at 1:25 am

    What occurs is Apache will select the appropriate version according to the version of PHP running.

    If you look at the “\lib\zendOptimizer” directory you will see entries for various versions of PHP such as 4.1.x,…,… 5.2.x

    The debugger is no different… So if you create a directory under PHP\lib\zendOptimizer called say “debug” giving you “PHP\lib\zendOptimizer\debug” under that debug directory create your version directories such as php-5.2.x JUST LIKE THAT.

    Do not go like, “php-5.2.5″ you want it as “php-5.2.x” ie: dont fill in the “x” with a actual version. The MINOR VERSION in other words is ignored.

    You now have a path of “PHP\lib\zendOptimizer\debug\php-5.2.x”

    Save your ZendDebugger.dll FOR VERSION 5.2.n into that directory.

    In your php.ini which in the case of Xampp resides in your Xampp\apache\bin directory add:

    zend_extension_manager.debug_server_ts=”"PHP\lib\zendOptimizer\debug”
    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

    ***NOTE*** No TRAILING “\” after debug and NOTE your not mentioning the php-5.2.x directory. These will be automatically selected based on WHAT version of PHP your running.

  • 4. Rick  |  May 5th, 2008 at 1:28 am

    Oye Vey

    zend_extension_manager.debug_server_ts=”C:\xampp\php\zendOptimizer\lib\debug”
    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

  • 5. Matt  |  June 20th, 2008 at 5:27 pm

    Here is what I have tried using the php.ini file located within c:\xampp\apache\bin\ with no success:

    [Zend]
    zend_extension_ts = “C:\xampp\php\zendOptimizer\lib\ZendExtensionManager.dll”
    zend_extension_manager.optimizer_ts = “C:\xampp\php\zendOptimizer\lib\Optimizer”
    zend_optimizer.enable_loader = 0
    zend_optimizer.optimization_level=15

    [Zend DEBUGGER]
    zend_extension_manager.debug_server_ts = “c:\xamp\php\zendDebugger”
    zend_debugger.allow_hosts=127.0.0.1/32,192.168.1.0/255
    zend_debugger.expose_remotely=allowed_hosts

    I have placed the DUMMY.php file within the c:\xampp\htdocs\ root directory and the zendDeugger is located within the debug_server_ts directory.

    Please help!

  • 6. Ashley Raiteri  |  June 25th, 2008 at 7:28 am

    Seriously, Thanks, saved me hours of trouble.

  • 7. Brad Baumann  |  July 9th, 2008 at 6:22 pm

    You saved me HOURS too. Thank you!

  • 8. Nikita Volkov  |  July 16th, 2008 at 7:37 am

    Thank you very much!

  • 9. Arya Sabda  |  July 23rd, 2008 at 2:21 am

    Thanks for the clue, but my phpinfo() didn’t show that Zend Debugger was loaded. Just Zend Extension manager and Zend Optimizer. Altough apache logs wasn’t complaining about the dll (I was using XAMPP for windows)

    like this

    This program makes use of the Zend Scripting Language Engine:


    Zend Engine v2.2.0, Copyright (c) 1998-2008 Zend Technologies
    with Zend Extension Manager v1.2.0, Copyright (c) 2003-2007, by Zend Technologies
    with Zend Optimizer v3.3.3, Copyright (c) 1998-2007, by Zend Technologies

    Any

  • 10. Mindaugas  |  August 6th, 2008 at 2:51 am

    exactly, you dont’t need exact version of php under X. This is worng:
    zend_extension_manager.debug_server_ts=c:\xamp\zend-5.2.10

    Any way, thank you!

  • 11. Lucas  |  August 17th, 2008 at 7:45 pm

    Rick’s solution worked for me. Thanks a lot!

  • 12. Lou  |  August 22nd, 2008 at 8:51 pm

    I was having the same problem as Matt and Arya until I noticed in my phpinfo():
    Loaded Configuration File C:\xampp\apache\bin\php.ini

    I’d been editing c:\xampp\php\php.ini!!! I copied the configuration lines across to the php.ini file under the apache folder and everything fell into place.

    phpinfo() is displaying the Zend Debugger v5.2.14 info, and the “Test Debugger” test from within Eclipse is working.

    thanks for the post(s) everyone.

  • 13. Anthony  |  October 7th, 2008 at 8:53 am

    Thanks very much for this very usefull post ! you really made me save time !

  • 14. Ro  |  October 10th, 2008 at 12:24 pm

    Small correction:
    zend_debugger.allow_hosts=127.0.0.1/32,192.168.1.0/255 (originally rather /255.255.255.0)
    will be misinterpreted by the debugger. The correct subnet mask is between 1 and 32:
    zend_debugger.allow_hosts=127.0.0.1/32,192.168.1.0/24

  • 15. Daniel  |  November 7th, 2008 at 5:06 am

    Wow, you really saved my day. Thanks alot!

  • 16. Rima  |  December 2nd, 2008 at 9:45 pm

    Man, you really saved me a lot of time and a lot of hours of grief and aggravation, not to mention fights with the boyfriend who could not do the installation. Thanks a lot!

  • 17. Grover Campos  |  December 17th, 2008 at 9:27 am

    A lot of thanks, your post is very helpfull

  • 18. Tom  |  January 15th, 2009 at 5:30 pm

    Saved my day to, thanks to all!

    For noobs like me working on OS X with a local MAMP setup, here’s my php.ini settings:

    [Zend]
    ; zend optimizer
    zend_optimizer.optimization_level=15
    zend_extension_manager.optimizer=/Applications/MAMP/bin/php5/zend/lib/Optimizer-3.3.3
    zend_optimizer.version=3.3.3
    zend_extension=/Applications/MAMP/bin/php5/zend/lib/ZendExtensionManager.so

    ; zend debugger
    zend_extension_manager.debug_server=/Applications/MAMP/bin/php5/zend/lib/Optimizer-3.3.3/debug
    zend_debugger.allow_hosts=127.0.0.1
    zend_debugger.expose_remotely=always

    My steps:
    1. Downloaded latest debugger here

    2. Createed a new directory named “debug” with this path:
    /Applications/MAMP/bin/php5/zend/lib/Optimizer-3.3.3/debug

    3. Unpacked debugger .tar.gz (used the Finder, all GUI based) and copied all four “_comp” directories to the new “debug” directory

    4. Renamed the debugger directories. Ex., “5_2_x_comp” becamed “php-5.2.x”

    5. Updated /Applications/MAMP/conf/php5/php.ini

    6. Restarted MAMP and confirmed both optimizer and debugger were listed in phpinfo in the box towards the top of the page that starts with the line “This program makes use of the Zend Scripting Language Engine:”

  • 19. multikulinaria  |  February 12th, 2009 at 8:54 am

    After changing computers I once again went through the ordeal of trying to get Zend remote debugging to work. Thanks to your help, I finally got it working… Great job!

  • 20. Maxime Schneider  |  February 13th, 2009 at 4:43 pm

    Thanks a lot everyone for your post.

    I am using MAMP 1.7.2 with Zend Debugger 5.2.15.

    I have lost a lot of time, because firstly I had the following folder structure:
    /Applications/MAMP/bin/php5/zend/lib/Debugger-5.2.15 storing the various folders php-M.m.x/ZendDebugger.so
    And the following line in my php.ini:
    zend_extension_manager.debug_server=/Applications/MAMP/bin/php5/zend/lib/Debugger-5.2.15

    It didn’t work because my parent folder for debugger was named like this Debugger-5.2.15.
    I just renamed it like this Debugger-5.2.1 and modified my php.ini then it worked well.

  • 21. San  |  March 20th, 2009 at 12:27 am

    New url for download
    http://downloads.zend.com/pdt/server-debugger/

  • 22. website design  |  April 6th, 2009 at 4:46 pm

    Thank you for the great tips. I did update my php.ini in apache\bin\ directory. I was wondering if I was supose to update the 2 php.ini and php5.ini in xampp\php as well ?

    Thank you

Leave a Comment

Required

Required, hidden

Required

Some HTML allowed:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>

Trackback this post  |  Subscribe to the comments via RSS Feed


Calendar

July 2009
M T W T F S S
« Mar    
 12345
6789101112
13141516171819
20212223242526
2728293031  

Most Recent Posts