Jeremy Simkins | Web Developer

Sep
28

Setting up MAMP with Zend Debugger, Optimizer and Extension Manager

Filed Under: MAMP, Zend

It seems some are having trouble setting up the Zend Debugger so i wrote this after doing some testing to see why people are having this problem. I provide below how to do this in MAMP. This will also get rid of the :8888 at the end of the url as well.

  1. Download an install the latest version of MAMP
  2. Install MAMP
    • Install MAMP Pro – I recommend this if you work on multiple projects, it is way easier than editing your hosts file and the http.conf every time
    • If you use MAMP Pro you will need to use this tutorial

MAMP :

  1. Go ahead and make sure that MAMP is working, go to localhost:8888/MAMP and select phpinfo()
  2. Check the powered by image, this is the first image, it should look like this
  3. Go to the MAMP Controller, Select Preferences.
    • First lets get ride of the :8888 at the end of the url, Select “Ports” and then click on the “Set to default” option (this will get rid of the ports on the end of the url)
    • Select the PHP tab and check Zen Optimizer to use the optimizer – (Optional)
    • select “OK” and let the server restart
  4. Now go to localhost/MAMP and again select the phpinfo() option. Scroll down to the same image an now you should notice the Extension Manager and the Optimizer set (The Extension Manager will only be on here if you chose to check the optimizer in the step above)

Now We can Setup the Debugger :
Now lets do the supposed hard part, lets turn on the debugger.

  1. Download the latest debugger. You can grab it from here – (i downloaded darwin for my intel based mac book pro)
    • Take the file that was extracted and put it in the MAMP directory -
      /Applications/MAMP/bin/php5/zend/lib/
      (i renamed the unzipped folder to ZendDebugger-5.2.14 so i will be using it through the rest of the tutorial, you can name the file whatever you want)
  2. The edits are the same for both MAMP and MAMP Pro. The only difference is where the files are located for each. I believe this is the area that is causing the confusion on setting up MAMP with the debugger.
  3. The MOST important part of setting up the debugger is the folder structure. you will have to rename the version folder to the correct format.
    • The original folder name is – 5_2_x_comp – you will need to rename it to – php-5.2.x
    • The folder structure should be setup like this

MAMP :

  1. Open php.ini from /Applications/MAMP/conf/php5/ - (or 4 if using php4)
  2. Open the php.ini and scroll to the bottom of the file it should look something like this
  3. You will want to add

    zend_extension_manager.debug_server=/Applications/MAMP/bin/php5/zend/lib/ZendDebugger-5.2.14
    zend_debugger.allow_hosts=127.0.0.1
    zend_debugger.expose_remotely=always

    • The php.ini should look like this now
  4. Save the file and restart the server
  5. Go to localhost/MAMP and choose phpinfo() and you should now see the debugger in the powered by image.

MAMP PRO :

  1. Open the php.ini that is being used by MAMP Pro. Now the problem i had with this was i was using the php.ini from the MAMP Pro directory, that is not the correct one. To get to the correct php.ini you have to be in MAMP Pro and choose File -> Edit Template then the appropriate ini file, i will be using php5.ini since i am using php5.
  2. Open the php.ini and scroll to the bottom of the file it should look something like this
  3. You will want to add after the “MAMP_zend_optimizer_MAMP”

    zend_extension_manager.debug_server=/Applications/MAMP/bin/php5/zend/lib/ZendDebugger-5.2.14
    zend_debugger.allow_hosts=127.0.0.1
    zend_debugger.expose_remotely=always

    • The php.ini should look like this now
  4. Save the file and restart the server
  5. Go to localhost/MAMP and choose phpinfo() and you should now see the debugger in the powered by image.

Now if you did everything correct you will now have the debugger working with your MAMP Install.

Hope this was helpful

15 Responses to “Setting up MAMP with Zend Debugger, Optimizer and Extension Manager”

  1. JosOctober 19th, 2009 at 6:26 pm

    Very helpful! Thanks a lot. I’ve been struggling with Zend Server CE on Snow Leopard and couldn’t get it to work – was very happy to find this and be able to debug with good old MAMP.

  2. Theo NobelNovember 11th, 2009 at 8:36 am

    Thanks for this great post. Now i finally got my Zdebug running!

  3. LihtworksgalDecember 25th, 2009 at 3:19 am

    great job! thanks!

  4. CJJanuary 14th, 2010 at 2:49 am

    Excellent guide. To the point and best of all easy to understand. Thank you so much for doing this! Setting up a debugger should not be this hard!

  5. uvoMay 17th, 2010 at 1:46 am

    Thank you for this detailed guide and explanations!

  6. Michael StellyMay 20th, 2010 at 4:52 pm

    Hey,
    Thanks for the info. Nonetheless, I followed each step explicitly and the debugger does not appear to load as shown in the phpinfo image. I double-checked the file version and directory location. Renamed the folder as you did, and made the changes to the php.ini like this:

    [Zend]
    zend_extension=/Applications/MAMP/bin/php5/zend/lib/ZendExtensionManager.so
    zend_optimizer.optimization_level=15
    zend_extension_manager.optimizer=/Applications/MAMP/bin/php5/zend/lib/Optimizer-3.3.9
    zend_optimizer.version=3.3.9
    zend_extension_manager.debug_server=/Applications/MAMP/bin/php5/zend/lib/ZendDebugger-5.2.14
    zend_debugger.allow_hosts=127.0.0.1

    zend_debugger.allow_tunnel=127.0.0.1
    zend_debugger.expose_remotely=always

    After multiple restarts and do-overs, all I get from phpinfo is this:

    This program makes use of the Zend Scripting Language Engine:
    Zend Engine v2.2.0, Copyright (c) 1998-2009 Zend Technologies
    with Zend Extension Manager v1.2.2, Copyright (c) 2003-2007, by Zend Technologies
    with Zend Optimizer v3.3.9, Copyright (c) 1998-2009, by Zend Technologies

    Thanks anyway. Looks like it’s back to square one. :(

  7. SoN9neMay 20th, 2010 at 6:01 pm

    Assuming you have done everything in the tutorial, remove or comment out the first initiation of the debugger.
    zend_extension=/Applications/MAMP/bin/php5/zend/lib/ZendExtensionManager.so
    and the duplicated
    zend_debugger.allow_tunnel=127.0.0.1

    Don’t forget to restart the server

    Let me know if that helps.

  8. Michael StellyMay 20th, 2010 at 9:04 pm

    Did what you suggested and here are the results. And yes, I followed your instructions explicitly.

    This program makes use of the Zend Scripting Language Engine:
    Zend Engine v2.2.0, Copyright (c) 1998-2009 Zend Technologies

  9. SoN9neMay 20th, 2010 at 9:38 pm

    I see my mistake. The issue could be the duplicated
    zend_debugger.allow_tunnel=127.0.0.1
    Just removed that line. I misread the first line… That just disabled your extension manager and disabled the debugger as well.

    Try this.
    zend_extension=/Applications/MAMP/bin/php5/zend/lib/ZendExtensionManager.so
    zend_optimizer.optimization_level=15
    zend_extension_manager.optimizer=/Applications/MAMP/bin/php5/zend/lib/Optimizer-3.3.9
    zend_optimizer.version=3.3.9
    zend_extension_manager.debug_server=/Applications/MAMP/bin/php5/zend/lib/ZendDebugger-5.2.14
    zend_debugger.allow_hosts=127.0.0.1
    zend_debugger.expose_remotely=always

  10. Michael StellyMay 21st, 2010 at 5:23 pm

    Ok, is it just me? Did the Zend deities curse my dev environment? ahhhhh! This is the phpinfo output now after copying your directives into the php.ini. No sign of my wayward debugger anywhere. ;(
    Nonetheless, I do appreciate your willingness to help me resolve the issue.

    This program makes use of the Zend Scripting Language Engine:
    Zend Engine v2.2.0, Copyright (c) 1998-2009 Zend Technologies
    with Zend Extension Manager v1.2.2, Copyright (c) 2003-2007, by Zend Technologies
    with Zend Optimizer v3.3.9, Copyright (c) 1998-2009, by Zend Technologies

  11. SoN9neMay 21st, 2010 at 5:48 pm

    I really need to update this post… The issue again is most likely something simple. I am going to assume you are using the latest version of MAMP which is currently 1.9.

    This line is the problem.
    zend_extension_manager.debug_server=/Applications/MAMP/bin/php5/zend/lib/ZendDebugger-5.2.14

    For the new MAMP it needs to be this:
    zend_extension_manager.debug_server=/Applications/MAMP/bin/php5.2/zend/lib/ZendDebugger-5.2.14
    or
    zend_extension_manager.debug_server=/Applications/MAMP/bin/php5.3/zend/lib/ZendDebugger-5.2.14

    depending on which version you are running. Please make note of the php folder name, that is most likely the issue you are having. Also, make sure the debugger folder name matches, and at the sake of repeating myself, make sure you renamed the folder inside the debugger directory.
    You could always just hardcode the path to the .so instead of letting the system auto load it (which is the method I am using)

    Hopefully this will get you up and going.

  12. Michael StellyMay 21st, 2010 at 6:13 pm

    I am not using 1.9. My version is 1.8.4. I didn’t want to update anything while in the middle of my current project. The last time I updated something, Zend Studio 7.2, it broke. I lost a half-day of billable time. So, I didn’t want to risk it. But I digress.

    Well, as the saying goes, “the devil is in the details.” I misnamed my ZendDebugger folder. I had it as 5_2_x instead of php-5.2.x. Jeeminee Christmas! Computers are so f’ing literal. grrr. I now have:

    This program makes use of the Zend Scripting Language Engine:
    Zend Engine v2.2.0, Copyright (c) 1998-2009 Zend Technologies
    with Zend Extension Manager v1.2.2, Copyright (c) 2003-2007, by Zend Technologies
    with Zend Optimizer v3.3.9, Copyright (c) 1998-2009, by Zend Technologies
    with Zend Debugger v5.2.14, Copyright (c) 1999-2008, by Zend Technologies

    So, it wasn’t you. It was the loose nut behind my keyboard. ;-)
    I owe you a virtual beer for your efforts. Much obliged, my good man. Uh, now if I could just figure out how to use the debugger… that’s another issue entirely.

    BTW, saw you on LinkedIn, but couldn’t send an invitation for some reason. if you’d like, you can send one to me. I’d like to have you in my network. http://www.linkedin.com/in/mstelly

    Thanks!

  13. SoN9neMay 21st, 2010 at 6:50 pm

    Glad to hear you got it working. I’ve made the same mistakes a few times myself, it almost is always the folder structure… lol

    I went ahead and sent you the invite, thanks! When I get the time I need to update that site and my own. Work is keeping me busy, guess that’s a good think thought ;)

  14. CraigOctober 4th, 2010 at 7:10 pm

    Thanks for the post. I am on MAMP 1.9, but I was able to figure out the different structures. Apparently in 1.9 the Optimizer and debugger will not work with 5.3, but that’s not a big deal for me yet. I did tun into the “Debugger compile handler overriden, cannot continue” error and this was very helpful to fix that: http://www.phil-taylor.com/2006/04/05/debugger-compile-handler-overriden-cannot-continue/

    I’m in the process of setting up Eclipse 3.6 with debugging, Subversion, and ant on my Mac MAMP machine. If I get it all working I’ll publish the steps.

  15. Alan AlvaradoJune 27th, 2012 at 8:50 pm

    Hi everybody,

    I got an issue. With the newest version from MAMP I cannot set up Zend Optimizer. Somebody can help me? Thanks!

Leave a Reply

Profile

Jeremy Simkins is an accomplished senior web developer with over ten years in the production field. Experienced PHP developer as well as a passionate software engineer. Jeremy specializes in code optimization, performance, and implementation.

View Jeremy Simkins's profile on LinkedIn

Open Source Projects

MPS Mod

FriendFeed

WordPress

Copyright ©2009 Jeremy Simkins