Getting Started with ZEND Server 6 on Mac OS X
I’ve just installed ZEND Server 6.3 on my MacBook running Mavericks 10.9.1. Needless to say I’m sill a little shaken up from the huge amount of brain pain this adventure has caused.
Because once downloaded and installed on your system, you may ask yourself a vital question: Now What?
Let’s find out. This article is Work in Progress – bear with me while I flesh it out.
ZEND Server on Mac is located here:
Your web files live here:
To open this directory in Finder you can navigate there with a Terminal session and open it, like so:
cd /usr/local/zend/apache2/htdocs open .
Now you can create a shortcut on your sidebar for easy access.
To access the ZEND Server Admin interface, navigate to the following URL in your browser:
If you’re done with it, you can uninstall ZEND Server with the following command:
Starting and Stopping ZEND Server services
You’d think they’d mention this in the manual somewhere. If so they did they a great job at hiding it. ZEND Server has a control script which does it all:
sudo /usr/local/zend/bin/zendctl.sh start sudo /usr/local/zend/bin/zendctl.sh stop sudo /usr/local/zend/bin/zendctl.sh restart sudo /usr/local/zend/bin/zendctl.sh start-apache sudo /usr/local/zend/bin/zendctl.sh stop-apache sudo /usr/local/zend/bin/zendctl.sh restart-apache sudo /usr/local/zend/bin/zendctl.sh start-mysql sudo /usr/local/zend/bin/zendctl.sh stop-mysql sudo /usr/local/zend/bin/zendctl.sh restart-mysql
Thanks to AJ Acevedo for his handy cheat sheet.
Avoiding auto start on boot
Once installed, ZEND Server will start automatically when your Mac boots. That’s great for some, but not for all. I really like that MAMP can be switched on and off so easily. ZEND Server isn’t quite as practical here.
Sadly how to avoid the auto start procedure appears to be a closely guarded secret. If you find a way to do it (aside from incinerating your local machine) please leave a comment.
In ZF1 you could create a sample application using the Zend Tool. I’m not sure if that’s still available in ZF2, in which the preferred method is to clone a Skeleton Application from git:
You’d imagine copying it into the web directory would show you a nice “Congratulations” message in your web browser. But that’s not the case. Even though the ZEND Server admin interface displays fine, your own projects do not appear to work.
This is because – much like MAMP – ZEND Server’s Apache installation does not listen on port 80 by default. Instead it listens on port 10088. So we have two options:
- either use http://localhost:10088 to reach our websites
- or tweak the https.conf file to listen on port 80 and use http://localhost instead
There’s a really good and very detailed article by Joe Stagner which describes how to do this. I’ll leave mine on the default port for now.
If you head over to http://localhost:10088/ZendSkeletonApplication/public/ you should see the glorious start screen of the default application. It looks like this:
How about MySQL?
PHP and MySQL are like siamese twins, and ZEND Server 6 installs a complete LAMP stack for us – including MySQL. How we access it is beyond me right now.
MySQL lives here:
Default credentials are “root” and no password. To create users and databases you can use either Sequel Pro or anything else you’re comfortable with. Note that I’ve had trouble getting phpMyAdmin to play ball here – mainly because of it’s super awful setup script. You have been warned!
Where to go next?
Nowhere fast – at least that’s what it feels like. How does anything actually work in this hostile alien world they call ZEND Framework? It is supposed to HELP developers rather than drive us crazy I assume?
I’ve had a look at some Kindle Books to find out – most of which were less than helpful. I struggle to understand why authors spend a great deal of time telling you about setting up yet another *AMP stack, but don’t tell you about the framework basics. Perhaps it’s “not easy to explain”.
Avoid these two at all cost:
- ZEND Framework 2 Application Development – by Christopher Valles
- ZEND Framework – a Beginner’s Guide – by Vikram Vaswani
Actually useful and at times helpful – when taken with a pinch of salt – are the following:
- ZEND Framework 2 by Example – by Krishna V Shasankar
- Learn Z2F – Learn by Example – by Slavey Karadzhov
There’s also the full PDF and EPUB documentation available from ZEND Technologies (extremely complex – and not meant to be understood by the general PHP developer).
Good luck, and stay sane! Nurse, where’s my medication?
[finds a different hobby]