Installing Zend Server CE on OS X: A Guide For the Terminal Timid

I use MAMP Pro both at home and at work for development. It quick, it’s easy and I really don’t have to fiddle with it a lot after it is set up. It’s perfect for me.

At work we have a project to be built with Codeigniter sitting on a Linux machine but we wanted to use Microsoft SQL Server on a different machine as the database. Turns out, it’s not a simple as changing the database type in Codeigniter to “mssql” to get it up and running. If this is all you do, you get the dreaded white screen. You need a PHP extension to do it. Problem is, Microsoft only makes this PHP extension for Windows. There are a lot of tutorials out there on how to build the extension yourself on Mac or Linux machine (this site for example), but none seemed to work for me.

Instead of setting up a Windows virtual machine and being forced into developing that way, I decided to install Zend Server CE. Zend comes with a MSSQL extension, it just needs to be enabled.

This tutorial does include Terminal work. I am going to walk through step-by-step, so even if you are not comfortable with Terminal, you will be up and running with Zend Server CE in no time. The only requirement is you are running an Intel Mac OS X.

  1. Download Zend Server CE. CE (Community Edition) is free.

  2. Install Zend Server CE like you would any other application. You can optionally drop/drop Zend Controller.app into your applications directory if you want.

  3. Once installed, in your applications directory, open ZendServer.app. This will open a browser window. Go through the three steps. Congratulations! You have Zend Server CE set up and running. But we aren’t done yet.

    By default, the root folder of your Zend Server is at /usr/local/zend/htdocs. Since /usr is a hidden directory, it’s not easily accessible.

    But first…

  4. Open Terminal. Terminal can be found at /Applications/Utilities/Terminal.app

    You can also open it from Spotlight by typing “Terminal”

  5. OS X comes with Apache already installed. We don’t want to use that version. We want to use the Zend Server version.

    In Terminal type:

    sudo /usr/local/zend/bin/zendctl.sh stop

    To stop Zend Server. Then type:

    sudo apachectl stop

    Enter your password if prompted

  6. We need to move apachectl to a safe place, such as your home directory. In Terminal type:

    cd /usr/sbin/
    sudo mv apachectl /Users/YOUR_USERNAME/

  7. Then create a symbolic link to Zend Server’s apachectl. In Terminal type:

    sudo ln -s /usr/local/zend/apache2/bin/apachectl ./

  8. Start Zend Server’s Apache. In Terminal type:

    sudo apachectl start

    You should then see:

    /usr/sbin/apachectl start [OK]

  9. If you go to http://localhost/ in your browser, you will either get a forbidden or a 404 message. We’ll change that next.

  10. Zend Studio’s Apache comes preconfigured to use port 10088. Let’s change this to port 80 like the default Apache port uses.

    Now we are getting into vi editing. I think this scares a lot of people. But don’t worry. It’s very simple.

    We are going to edit our httpd.conf file. In Terminal type:

    sudo vi /usr/local/zend/apache2/conf/httpd.conf

    Enter your password when prompted

  11. You are in vi edit mode so you won’t be able to type in Terminal like you normally would. Typing only gives you the the OS X bump sound. That’s normal. You can use the up, down, left, right arrow keys.

    Look for the line that says “Listen 10088″

    In Terminal, type “i” to go into edit mode to start editing the file. At the bottom of the Terminal window it will say “– INSERT –” to notify you that you are editing the file.

  12. With your blinker over the “L” on “Listen”, type “#” to comment out that line

    Use the down arrow to go to the next line.


    Listen 80

  13. Since we are already editing this file, we will go ahead and change our root directory since, as I mentioned earlier, the /usr directory is a hidden directory.

    Use the down arrow to scroll down to where it says

    DocumentRoot "/usr/local/zend/apache2/htdocs"

    With your blinker over the “D” on “DocumentRoot”, type “#” to comment out that line

    Use the down arrow to go to the next line.


    DocumentRoot "/Users/YOUR_USERNAME/Sites"

    This is the default web root for OS X sites. This is a pretty good place to put out root as well.

  14. Use the down arrow again to scroll down to where it says

    <Directory "/usr/local/zend/apache2/htdocs">

    With your blinker over the “<”, type “#” to comment out that line

    Use the down arrow to go to the next line.


    <Directory "/Users/YOUR_USERNAME/Sites">

  15. We are done editing this file. Now we need to save it. In Terminal, hit the escape key to edit out of editing mode. The “– INSERT –” at the bottom will go away.

    In Terminal again, type “:x”. This exits vi mode and saves what you changed

  16. Restart apachectl type typing:

    sudo apachectl restart

    Enter your password when prompted

  17. If you go to http://localhost/ in your browser, you will see the default Mac OS X homepage now.

  18. To configure Zend Framework, type:

    sudo ln -s /usr/local/zend/share/ZendFramework/bin/zf.sh ./zf

  19. To Configure Pear, type

    sudo ln -s /usr/local/zend/bin/pear ./
    sudo pear upgrade pear

  20. Now we have to configure MySQL. In terminal type:

    sudo ln -s /usr/local/zend/mysql/bin/mysql ./
    sudo ln -s /usr/local/zend/mysql/bin/mysqladmin ./

  21. We have to edit some settings in my.cnf for MySQL, so we go back to vi. In Terminal, type:

    sudo vi /usr/local/zend/mysql/data/my.cnf

    To edit the file, it is similar to what you did in step 10.

    Use the down arrow to scroll down to where it says:

    socket = /usr/local/zend/mysql/tmp/mysql.sock

    With your blinker over the “s” on “socket”, type “#” to comment out that line

    Use the down arrow to go to the next line.


    socket = /tmp/mysql.sock

  22. By default, the password that comes with Zend Server is blank. You can change this by removing the “#” next to “password” and then changing “you_password” to whatever you want. Make sure you remember what the password is though.

  23. To save the file, it is similar to what you did in step 14.

  24. Configure phpMyAdmin. Since we changed the web root for Apache, we will have to create a Directory entry and Alias for phpMyAdmin, since it exists somewhere else. To edit the httpd.conf file again, in Terminal type:

    sudo vi /usr/local/zend/apache2/conf/httpd.conf

    Enter your password when prompted

  25. To start editing the file, use similar steps from step 10.

    Somewhere in the file (I put it at the very end), type:

    Alias /phpMyAdmin /usr/local/zend/share/phpmyadmin
    <Directory "/usr/local/zend/share/phpmyadmin">
        Options Indexes FollowSymLinks
        AllowOverride All
        Order allow,deny
        Allow from all

    * Hint: Yes, you can copy/paste this if you don’t want to type it all out yourself.

    To save the file, use similar steps from step 14.

  26. Go ahead and restart Zend Server. In Terminal, type:
    sudo /usr/local/zend/bin/zendctl.sh restart

Where do I put the file for my website(s)?

Files will be places in /Users/YOUR_USERNAME/Sites

Yes, of course you can create directories within that folder.

What is the URL for my site?

The root of your site is now at http://localhost/ If you have a directory within the /Users/YOUR_USERNAME/Sites directory, the URL would become http://localhost/FOLDER_NAME

To configure Zend Server, you can get to it by going to http://localhost:10081/ZendServer/ or simply by opening ZendServer.app

phpMyAdmin is located at http://localhost/phpMyAdmin The default username is “zend” and the password is left blank. You can also use “root” as the username. Again, with no password.

How do I start/stop/restart Zend Server?

To start Zend Server, in Terminal type:

sudo /usr/local/zend/bin/zendctl.sh start

To stop Zend Server, in Terminal type:

sudo /usr/local/zend/bin/zendctl.sh stop

To restart Zend Server, in Terminal type:

sudo /usr/local/zend/bin/zendctl.sh restart

Uninstalling Zend Server

  1. Open Terminal

  2. Enter

    sudo /usr/local/zend/bin/uninstall.sh

    This will:

    1. Stop all Zend Server processes
    2. Delete all Zend Server installed files
    3. Remove the ZendServer.app from /Applications
    4. Remove Zend users
  3. It will ask for your password. Enter your password

  4. It will ask you if you are sure you want to remove Zend Server. Type “yes” (without the double quotes)

  5. It tells you it will a couple directories, including your MySQL databases. Type “cont” (without the double quotes) to continue

  6. In your applications directory, drag Zend Controller.app to the trash (if it is installed)

13 Responses to Installing Zend Server CE on OS X: A Guide For the Terminal Timid

  1. Matt says:

    This is a great guide, but it doesn’t specifically mention how to enable the mssql extension once you have Zend Server installed. To do that, the easiest way is to go to the Zend control panel:


    From there, go to the Server Setup | Extensions tab and enable the mssql extension.
    Or you can edit php.ini directly (/usr/local/zend/etc/php.ini) and restart Apache (sudo zendctl restart-apache)

  2. Neil Corke says:

    I spent hours combing the web some help on configuring this properly until find this!

    Thank you very much.

  3. Ryan says:

    Just wanted to thank you. I never do this but i spent hours trying to configure this as its 3am… Got it up in 5 mins after reading this.

  4. Quint says:

    Question: When I tried step 18, configuring pear, the following was the output:

    Could not get contents of package “/usr/local/zend/bin/pear”. Invalid tgz file.

    Any ideas on how I should proceed? Thank you and great, meticulous directions.

  5. @Quint The tgz file gets downloaded to your computer before installing. So it’s there it just couldn’t install for some reason. Without seeing the full output of the error message and what is before the error message, you could try something like this:
    sudo pear install –offline /Applications/MAMP/bin/php5.3/bin/pear/PEAR-1.9.1.tgz
    Or whatever Terminal is saying the path to the file and file version is.

  6. dcolumbus says:

    So I installed Zend Server CE, changed ports to 80, changed root directory to Sites … but I didn’t like it. So I uninstalled ZSCE with “sudo /usr/local/zend/bin/uninstall.sh” and went back to MAMP. However, since I installed/uninstalled ZSCE, MAMP can no longer access “localhost” … works fine.

    No cool at all. Any ideas?

  7. Marty says:

    I don’t think there should be any overlap between the two. You might check that /Library/StartupItems/ZendServer_init has been removed. Also, the easiest thing might be to reinstall MAMP.

  8. Rob says:

    Thanks for this just what i have been looking for. I will try this over the next few days I was not sure if Zend replaced the default apache install and now I know :-)
    Also if I already have mysql installed and working with standard osx apache do I need To doe mysql steps? It’s just a connection string?

  9. John says:

    Great document on installing Zend Server on Mac OS X. I was ready to give up after installing it myself as I could not use the Mac OS X finder to locate the PHP files I created in Zend Studio. Reconfiguring the base directory to \Users\MY_USER_NAME\Sites solved everything and I will continue to investigate the use of Zend Server and Zend Studio.

  10. Gigamike says:

    i tried this one and seems to be fine. But as soon i restarted my mac there is always a problem on mysql

    RROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/usr/local/zend/mysql/tmp/mysql.sock’ (2)

    And idea?


  11. Gigamike says:

    ok, seems ok now with my problem on mysql, i just ignore step no 20

    instead of socket = /tmp/mysql.sock i used socket = /usr/local/zend/mysql/tmp/mysql.sock



  12. john c says:

    have tried everything and I can not get on to myPhpAdmin. NO password works. I tried editing the /usr/local/zend/mysql/data/my.cnf to put in a password. that still does not work

    I get the following terminal session …

    sudo /usr/local/zend/mysql/bin/mysql.server startPassword:
    Warning: World-writable config file ‘/usr/local/zend/mysql/data/my.cnf’ is ignored
    Warning: World-writable config file ‘/usr/local/zend/mysql/data/my.cnf’ is ignored
    Starting MySQL
    . SUCCESS!

    So MySQL started but the config file is ignored.

    Even if I do get a password changed then what is the user name? ‘zend’, ‘root’, blank?

    I has installed MAMP before zend and I can get the MAMP SQL to run ok. When I shut that one down and start the Zend MySQL install I can get get past the log in.

    Thanks for any assistance.

  13. Mark says:

    What happened to Zend Server CE? I can’t find it on Zend’s website, it just redirects to the Free Version, which has a trial period and inside terminal it doesn’t look like what you posted. Also my google search results don’t turn it up, nor is it hosted on any of the torrent sites I don’t visit.
    What can I do?

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>