Getting Started with Zend Server CE

March 2, 2009

Tutorials

Getting Started with Zend Server CE

Spring Cleaning

Every once in a while, I get the urge to clean up my development environment, reinstalling everything from the operating system on down just to experience the good vibes that come with a squeaky-clean (and super-snappy) system. However, this isn’t something to be undertaken lightly – it typically takes me an entire weekend to get things set up the way I like them, and I always emerge from the experience bruised and bleary-eyed from squinting at installation documents and configuration variables.

The last weekend was a little different. Having read about the new Zend Server Community Edition, I decided that instead of the usual procedure I follow to reinstall my PHP environment, I’d give the new one-click installer a try and see if it saved me some time. It worked out pretty well, and over the next few pages, I’m going to tell you what I did and guide you through the process of installing and using the application for your own development. And I’ll also show you how simple it is to install and use PHP/MySQL applications under Zend Server CE, with a live demonstration using an off-the-shelf CMS.

Feature Presentation

Let’s start with the basics – what the heck is Zend Server CE, anyhow?

Zend Server CE, in the words of its official Web site, is a “production-ready, integrated PHP stack for non-critical applications”. If you don’t speak Geek, I’ll translate that for you: it’s a pre-packaged version of Apache and PHP that gets a simple PHP environment up and running with minimal effort on your part. It is currently available for Windows, Linux (RPM and DEB packages) and Macintosh platforms, and (like all good software) it’s provided free of charge.

Here’s a quick list of the key features:

  • Single-click installation: Zend Server CE provides an all-in-one installable distribution of PHP, Apache, Zend Framework, and various Zend utilities. An automated installer takes care of installing and configuring these components for your system, without requiring you to download and install packages separately or work your way through three different sets of installation instructions. Needless to say, if you’re in a rush, don’t really want to spend the time creating a custom-fit installation or are looking for an “unattended installation” option suitable for deployment on multiple systems, this single-click installation approach can save you a fair amount of time!
  • Integrated administration console: Zend Server CE comes with an integrated administration console for both PHP and Apache services. This console can be accessed via a Web browser, and eliminates the need to futz around with configuration files to alter the server’s behaviour, or to view and change the server’s operational status.
  • Bundled development tools: Zend Server CE comes with a bunch of additional development tools, such as the Zend Optimizer+, which speeds up script execution through opcode caching; the Zend Data Cache, a set of functions for speeding up access to data via caching; the Zend Debugger, a full-featured script debugger; the Zend Guard Loader, for running encoded PHP scripts; and the Zend Java Bridge, which makes it possible to use Java applications from within a PHP script. Some of these components are freely available, while others are included in Zend’s commercial products; nevertheless; it’s nice to have them all in one package. And lest you’re worried about performance, you can turn them off individually as well (as you’ll shortly see).
  • Free, but certified by Zend: Zend Server CE comes with a certified copy of PHP that includes the latest bug fixes for security and performance. More importantly, it’s free of charge…always a good thing!

Service With A Smile

To get started using Zend Server CE, you’ll need to first make sure that you have everything needed for a successful installation of the product. Basically, so long as you have a relatively-recent Linux distro (for Linux users), or Windows XP and above (for Windows users), you’re good to go. Depending on the kind of performance you’d like to see, you might want to invest in some decent hardware as well, particular on Windows systems.

To download a version for your platform, drop by the Zend Server CE Web site and pick your poison. Once you’ve got it downloaded, installation is pretty simple: unpack the distribution archive and run the included installer. Here’s what it looks like on Linux:

At the end of the process, you should see a series of status messages, as below:

Note this information down, you’ll need it as we go along. In particular, note that the Apache Web server is set to automatically start on port #10088.

Installation on Windows is also quite simple. Start up the installer, and you should see a screen like this:

Work your way through the initial screens and choose a custom installation. You should then have the option of selecting various components, as in the following screenshot:

Notice that, in addition to a complete PHP installation, Zend Server CE includes the Zend Debugger for debugging, and the Zend Optimizer and Zend Data Cache for performance optimization. You should definitely install these components, as they come in handy when developing Web-based applications. Zend Server CE also includes the Zend Framework, which you should install if you expect to be doing any development with this framework.

A number of other add-ons are also available under Windows, including Dojo (don’t install unless your project specifically needs it), MySQL (install if you don’t already have it), phpMyAdmin (install to make MySQL management simpler), and various database drivers (only install the ones you expect to be using).

Once you’ve selected the components, also select the Web server type and port number – Apache 2.2.x on port #80 should do fine for most installations:

Review your installation settings, and confirm them to begin the installation process.

Zend Server CE will begin installing, downloading files as needed to complete the installation.

Once the installation process is complete, the installer’s last task will be to automatically start the Apache Web server, and then launch the Zend Server CE administration console in a new browser window. Under Linux, you’ll have to do this step manually, by accessing the administration URL provided at the end of the installation process.

Since this is the server’s first run, Zend Server CE will first ask you to set a password, which will be needed for all subsequent visits to the administration console. Once you’ve set a password, you’ll be granted access to the main server administration console, which looks something like this:

Spinning A Web

Every aspect of Zend Server CE can be controlled via the integrated administration console shown previously, which is accessible through a Web browser. Let’s quickly review the main sections of this console:

Monitor: This section provides run-time information on the server process. A dashboard provides at-a-glance information on version information, as well as on the status of various Zend components such as the Zend Data Cache and Zend Optimizer. There are also separate pages for viewing PHP information, via the phpinfo() command, and the server’s error and access logs.

Here are some screenshots illustrating what you might see in this section:


Server Setup: The Monitor section provides information on the server’s current state, and is great for when you need a quick visual check that everything’s running smoothly. However, if you need to make changes, you need to instead head over to the Server Setup section, which allows you to modify the server’s configuration. This section allows you to turn the various Zend tools on or off, enable or disable PHP extensions, change PHP configuration, and restart the server to have your PHP configuration changes take effect. All of these changes can be made via the browser-based interface, and every variable comes with an explanatory note, making reconfiguration a far simpler process than it normally is (especially for users new to PHP).

It’s worth pointing out also that Zend Server CE also comes with built-in hooks for debugging PHP scripts using the Zend Studio debugger. Within the Server Setup section, you can allow or deny access to the debugging system for specific clients, using IP address masks.

Here are some screenshots illustrating what you might see in this section:










Administration: The third section, Administration, merely allows you to change the password used to gain access to the administration console.

Saying Hello

At this point, Zend Server CE is fully set up. In order to test the installation and verify that your PHP code is being correctly parsed, pop open a text editor and create a simple PHP script containing the following code:

<?php
echo strtoupper('Welcome to PHP v' . phpversion());
?>

Save this script as ‘welcome.php’ in the Web server’s document root directory. If you kept the installation defaults, this directory will be located at ‘C:\Program Files\Zend\Apache2\htdocs’ under Windows, while under Linux it will be located at ‘/usr/local/zend/apache2/htdocs’ (you can also obtain the correct value from the Monitor -> Server Info -> Web Server section of the Zend Server CE administration console). Then, point your browser to ‘http://localhost/welcome.php’ (Windows) or ‘http://localhost:10088/welcome.php’ (Linux), and you should see something like this:

Going Digital

Are we done? Nope, not yet. You see, Zend Server CE is only a means to an end – typically, you’ll install it as a prelude to installing some other PHP/MySQL-based application, such as a weblog application, a shopping cart system or a content management system. Fortunately, this too is pretty painless, and Zend Server CE also comes with some interesting built-in tools to help you monitor the health and performance of your installed applications.

To demonstrate, let’s consider adding a new application – Digitalus CMS – to the Zend Server CE environment. In case you don’t already know, Digitalus CMS is a template-based content management system that makes it easy to set up and customize a Web site. It’s developed in Zend Framework, and also makes use of the jQuery JavaScript library.

To get started, download Digitalus CMS from its home Web site, and unpack the distribution archive to a directory named ‘digitalus’ under your Web server’s document root:

shell> unzip digitalus_cms_1.5.1_rc1.zip

Next, create the ‘cache’, ‘media’ and ‘trash’ subdirectories under the main installation directory:

shell> mkdir cache
shell> mkdir media
shell> mkdir trash

Pop open your ‘httpd.conf’ file (you’ll find it in either ‘C:\Program Files\Zend\Apache2\conf\httpd.conf’ on Windows, or ‘/usr/local/zend/apache2/conf/httpd.conf’ on Linux) and allow .htaccess overrides for your Digitalus CMS installation, by adding an entry to the end of the file, as below:

<Directory "/usr/local/zend/apache2/htdocs/digitalus">
    Options Indexes FollowSymLinks
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>

This is necessary for the application’s URL rewriting to work. Once you’re done, restart the Apache Web server, using either the Apache Monitor tray application (Windows) or the ‘zendctl.sh script’ (Linux).

shell> /usr/local/zend/bin/zendctl.sh restart

Fire up your browser and head back to the Zend Server CE administration console. Launch phpMyAdmin by browsing to ‘http://localhost/phpMyAdmin’ (Windows), log in, and create a new MySQL database for the application:

While you’re there, you can also create a MySQL user account, which has limited access only to the above database, for security reasons:




If you don’t have phpMyAdmin, you can also accomplish the above tasks through the MySQL command-line client, as below:

shell> mysql -u root -p
Enter password: ****
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 59
Server version: 5.1.28-rc-community MySQL Community Server (GPL)
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> CREATE DATABASE digitalus;
Query OK, 1 row affected (0.00 sec)

mysql> GRANT ALL ON digitalus.* TO digitalus@localhost IDENTIFIED BY 'g00dcm5';
Query OK, 1 row affected (0.00 sec)

Now, access the Digitalus index page through your browser, and you should be prompted for n administrative account and database information. Provide the necessary information and begin the installation process by hitting Install Now.




Once the installation process is complete, remove the ‘install’ folder, as prompted by the installer, and visit the index page again. You should see the Digitalus CMS, all set up and ready to use!

I, Me, Myself

To access the Digitalus administration module, visit ‘http://localhost/digitalus/admin’, and you should see something like this:

Log in using the credentials you supplied earlier, and you’ll be presented with various administrative options. To quickly see the CMS in action, visit the Pages section, and create a new page:

After defining the basic page parameters, and slotting it into the navigation menu, add some content to it using either the built-in WYSIWYG editor or the bare-bones HTML editor:

Save your page, and head back to the home page. Your newly-added page should show up in the main menu, together with the content you added.

In a similar vein, you can add more pages to the system – Digitalus CMS comes with numerous options to help you control the appearance, content and navigation of pages in the site. There are a lot of features to explore, so take a look at the documentation wiki and play with it a bit to get the hang of it.

As this example demonstrates, Zend Server CE makes it very easy to get a fully-functional PHP environment up in minutes, while simultaneously allowing users the flexibility to reconfigure the default installation to their specific needs. If you’re a system administrator or power users, you might still prefer the “roll your own” approach to building a PHP development environment; however, if you’re a PHP newbie, weekend hobbyist or impatient developer, Zend Server CE might help get you up and running faster than usual. Take a look at it the next time you’re in the mood to “spring clean” your development system…and happy coding!

Copyright Melonfire, 2009. All rights reserved.

About Vikram Vaswani

Vikram Vaswani is the founder and CEO of "Melonfire":http://www.melonfire.com/, a consultancy specializing in open-source tools and technologies. He is a passionate proponent of the open-source movement and frequently contributes articles and tutorials on open-source technologies, including Perl, Python, PHP, MySQL, and Linux, to the community at large. He is the author of four books on PHP and MySQL, including "MySQL: The Complete Reference":http://www.mysql-tcr.com/, "How to Do Everything with PHP and MySQL":http://www.everythingphpmysql.com/ and "PHP Programming Solutions":http://www.php-programming-solutions.com/. Vikram has more than eight years of experience working with PHP and MySQL as an application developer. He is the author of Zend Technologies' "PHP 101 series":http://devzone.zend.com/tag/PHP101 for PHP beginners, and has extensive experience deploying PHP in a variety of different environments (including corporate intranets, high-traffic Internet Web sites, and mission-critical thin client applications). A Felix Scholar at the University of Oxford, England, Vikram combines his interest in Web application development with various other activities. When not dreaming up plans for world domination, he amuses himself by reading crime fiction, watching old movies, playing squash, blogging, and keeping an eye out for unfriendly Agents.

View all posts by Vikram Vaswani

17 Responses to “Getting Started with Zend Server CE”

  1. _____anonymous_____ Says:

    Hi,

    I’ve just download ZendServer CE for Mac OS X, I changed the default port of Apache from 10080 to 80, everything works OK, I just cannot manage to find the way to configure ZendAdminInterface to work with Apache on the new port? Noted that I changed the DocumentRoot to another directory, outside of Zend Server installation directory.

    Thank in advance ;-)

  2. _____anonymous_____ Says:

    I found sth like this

    /gui/application/data/zwas.ini :)

  3. matt_bk Says:

    This sounds interestig. Have to try it by my self. Thanks

  4. current Says:

    Hi Vikram,
    Thanks for your post. There is lots of documentation now available to install Zend Server, thanks to folks like you and Zend corporation.
    However, I am stuck trying to integrate my existing Zend Framework website with a Flex page, using Zend AMF.

    Has anyone else achieved it? Any help will be sincerely appreciated,

    regards,
    Karan Tandon

  5. wwllmm Says:

    @Karan Can you please provide more details about your problems with Zend_Amf so that we can help?

    Thanks.
    ,Wil

  6. alphafer Says:

    Hi

    I decided to try Zend CE in Ubuntu intrepid. The installation went fine. I have Apache, PHP and MySql up and running with almost no effort. Great!

    Going through the steps to install Digitalus I got a white page after a hit install. I have all green flags but it seems that mod_rewire is not enabled in my Apache installation. does Zend CE has an interface to enable Apache components? How can I enable the mod_rewirite?

    Thank you

  7. xxjonkushxx Says:

    Nice tutorial.. Definitely puts everything "into scope". Now if only it didn’t always seem to break, that would be awesome (the application logic itself… for example, installer breaks on step 2). In any case, the only issue I see with this installation is the rule itself. Depending on the nix version, you might not hit the httpd.conf (I don’t in intrepid), or furthermore, I believe they restructured the handling for CE Edition in nix (at least from what I can see). For example, I do not have the Apache2 folder as you do (I think this was removed from beta). In any case, I’ve found this way a bit easier since apache loads the entire conf.d directory by default: ( Hope this helps! )

    $ mkdir /usr/share/digitalus; cd /usr/share/digitalus;
    $ wget http://digitalus-cms.googlecode.com/files/digitalus_cms_1.5.1_rc1.zip
    $ unzip digitalus_cms_1.5.1_rc1.zip
    $ chmod -R 0777 trash media application/data/config.xml
    $ touch /etc/apache2/conf.d/digitalus
    $ nano /etc/apache2/conf.d/digitalus

    Alias /digitalus /usr/share/digitalus
    <Directory /usr/share/digitalus>
    DirectoryIndex index.php
    Options FollowSymLinks
    Order allow,deny
    Allow from all
    </Directory>

  8. ooduque Says:

    Does mysql and PhpMyAdmin comes with Zend CE by default? Because i just installed one without an internet connection and MySQL was not installed on my machine. How can i rectify this issue?

  9. silione Says:

    is it possible to build addons to the zend server?

    for example: i want to add an "applications" tab that will show me the current applications i have on the site (like the index page of wamp)

  10. spatan2002 Says:

    Please i have a big issue here. I have been on this for 3 days now. I installed Zend ce on my machine. Due to the nature of the project i wanted to do i needed to enable CURL LIBRARY… Curl works on php installed on my localhost… http://localhost/project. But when zend was installed on port 10081 on my marchine, curl did not work. so i have to do all my configuration again. I uninstalled my php and in c:/xampp/ and also i uninstalled zend server. i clean up my system.

    Now the issue is this after that i reinstall zend server only i check phpmyadim as one of the adons to be istalled, but after installation, i could not lunch phpmyadmin on the browser.. http://localhost:10081/phpMyadmin. I have tried all i could i dont knwo what exactly is the problem..
    Please i need a help…..

  11. marktyers Says:

    Hi
    I tried the tutorial but got stuck with the simple test script.

    <?php
    echo strtoupper(‘Welcome to PHP v’ . phpversion());
    ?>

    I saved the file to /usr/local/zend/apache2/htdocs but got the 404 not found error

    I am running the latest version of Zend Server CE on Snow Leopard.

    Can anyone help. I am rather stuck at this point!

    Mark

  12. gushie25 Says:

    Dear @STUCK

    Got the same problem like yours, i’m also newbie on Zend Framework.

    already surfing the zend devzone forum, and found no solution whatsoever, after a bit desperation, I tried diving into /usr/local/zend to find htdocs, whaddayanow… /usr/local/zend/gui/lighttpd/htdocs

    creating the simple test script in there and there it goes "WELCOME TO PHP V5.3.3"

  13. arvprod Says:

    After a custom install (just added mysql and nothing else) of Zend Server CE :

    I’ve spent one evening setting mysql root password to 1234 (expected to be default password for this CE install ???)

    And now, I’ve just spent more than 2 hours finding that 8080 was the default port for this "custom" install
    I DON’T REMEMBER HAVING CHANGED THIS DURING INSTALL !

    YES It’s straight forward for apache experts…
    "Listen 8080" in httpd.conf should have led me to the conclusion…
    BUT WHY THIS PORT ?! when neither "Getting started guide" nor forum message is mentioning it !

    So: 8080 is the default web server port for recent Zend Server CE installations. => change it in httpd.conf

    Hope it helps.

  14. shadowlurker Says:

    When I try to go to http://localhost/ I get a 404 error, and when I go to http://localhost:10088/ I also get a 404 error. When I go to http://localhost:10081/, however, I get the Zend server page. But welcome.php isn’t a file in it, even though I saved it in the directory I was told to.

    My operating system is Windows 7.

  15. sgetachew Says:

    During installation of Zend server CE in widows server 2008R2 I encounter an error message:

    "Can not create config.inc.php in C:\Programs Files(x86)\Zend\phpMyAdmin"

    And when I try to connect to http://localhost/phpmyadmin i get a 404 error.

    Need help please

  16. fdrouillard Says:

    A few comments:

    phpMyAdmin login screen — default username is "zend" (without the quotes) and password is blank. (From page 38 of the Zend Server CE Reference Manual v4.0.3.)

    Need to change permissions (Mac OS X) — Digitalus v1.8.1 install creates the folders cache, media and trash, so you don’t need to do that yourself. You will need to change a few permissions to complete the install. Navigate to:

    /usr/local/zend/apache2/htdocs/digitalus/

    Change permissions on a few folders and files therein:

    $ sudo chmod -R 0777 trash media cache application/data/config.xml

    (Don’t include the $, that merely indicates the command prompt.)

    Now when you point your browser to http://localhost/digitalus/ you should get the screen shown in this tutorial.

  17. fdrouillard Says:

    Hopefully, someone will tell me I’m dead wrong, but judging by their forums and wiki site, Digitalus CMS appears to be dead.