Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Zend Framework 2 Cookbook

You're reading from   Zend Framework 2 Cookbook If you are pretty handy with PHP, this book is the perfect way to access and understand the features of Zend Framework 2. You can dip into the recipes as you wish and learn at your own pace.

Arrow left icon
Product type Paperback
Published in Dec 2013
Publisher Packt
ISBN-13 9781849694841
Length 340 pages
Edition 1st Edition
Languages
Arrow right icon
Authors (2):
Arrow left icon
joseph@callaa.rs joseph@callaa.rs
Author Profile Icon joseph@callaa.rs
joseph@callaa.rs
Josephus Callaars Josephus Callaars
Author Profile Icon Josephus Callaars
Josephus Callaars
Arrow right icon
View More author details
Toc

Table of Contents (17) Chapters Close

Zend Framework 2 Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
1. Zend Framework 2 Basics FREE CHAPTER 2. Translating and Mail Handling 3. Handling and Decorating Forms 4. Using View 5. Configuring and Using Databases 6. Modules, Models, and Services 7. Handling Authentication 8. Optimizing Performance 9. Catching Bugs Setting up the Essentials Index

Making sure you have all that you need


The Zend Server is a nice piece of software that takes out a lot of work from our hands by installing everything we need (or at least provide a good platform) to code Zend Framework 2 (and Zend Framework 1!) applications. Although the paid version of Zend Server might not be necessary for production applications, developing in the developer version of the Zend Server is a pure delight as it will give a proper overview of the system, logs, configuration, and everything else we need to know.

We are going the cheap way by installing the Zend Server Community Edition, which installs everything we need to use Zend Framework and Zend Framework 2. The handy thing about the Zend Server is not only the ease of installation, but the immense toolset you get with the server itself. It is a great product to get a good overview of any PHP related configuration and is also able to monitor performance and track events in your system.

To install the Zend Server we need to download it first from the Zend website (http://www.zend.com), at the moment Zend Server 6.2.0 is the latest version of the application, and although we use it, the installation process should be the same for any later versions.

Tip

Zend Server is not needed to run Zend Framework 2, but does, however, provide an excellent platform that needs only minimal configuration to get started.

Installing Zend Server Community Edition on a Linux environment

When we have downloaded Zend Server for Linux (you need a free Zend account to download any of their software), we will have a file called ZendServer-6.2.0-RepositoryInstaller-linux.tar.gz.

Next, to install the Zend Server we need to execute the following command sequence:

$ tar -xf ZendServer-6.2.0-RepositoryInstaller-linux.tar.gz

This will unpack the Gzipped Tarball (this is a compression method) package and extract it in the ZendServer-RepositoryInstaller-linux directory. Now let's install the Zend Server:

$ cd ZendServer-RepositoryInstaller-linux/
$ sudo ./install_zs.sh 5.4

We have chosen to install PHP 5.4, and if there is no reasonable explanation why we need PHP 5.3, we recommend keeping it in this version. If we need PHP 5.3, however, we can easily change the 5.4 to 5.3 and it will install the lower PHP version. Once we execute the install_zs.sh command as the root user (hence, the sudo, which tells the system we want to execute a command as a super user) we will get a short confirmation window asking us if we really want to install the Zend Server. Simply press Enter to continue the installation.

At some point during the installation, the script will ask if you want to install X amount of new packages. You want to answer Y or yes for that, otherwise the installation will end there.

The installation itself takes a couple of minutes and upon successful installation, the script will display the following message:

Note

********************************************************
* Zend Server was successfully installed.              *
*                                                      *
* To access the Zend Server UI open your browser at:   *
* https://<hostname>:10082/ZendServer (secure)         *
* or                                                   *
* http://<hostname>:10081/ZendServer                   *
********************************************************

Security wise it is best to always use the secure version of Zend Server, as you want to make sure that passwords are put in securely. However, while working locally it doesn't really matter that much.

Installing Zend Server Community Edition on a Windows environment

When we have downloaded the Zend Server for Microsoft Windows (you need a free Zend account to download any of their software) and we started up the ZendServer-6.2.0-php-5.4.21-Windows_x86.exe file, we find ourselves again with a very simple installation. If we choose the custom installation, we have a few options that we can change, but normally the default options are fine enough for us.

Another great thing about the Windows installation of Zend Server is that the installation program asks us if we want to use an existing IIS web server or install an Apache server instead.

What option you choose is all down to the configuration requirements for the rest of the project, assuming that we have more requirements; otherwise, we would really need to reconsider using Windows for our PHP environment.

After a summary screen of the installation we are about to commence, the installation will continue and configure the system. If the installation has been completed successfully, we get the option to start working with the Zend Server and to add the Zend Server as a desktop icon.

First-time run of Zend Server

If we go to the Zend Server interface in the browser for the first time (please note that the Zend Server in Windows does not have the secure connection built-in like the Linux version has), we will see the license agreement, which we need to accept before we can go on.

In the next screen, depending on the purpose of the Zend Server, we need to choose between the Development, Single Server, or Cluster license. The Single Server and Cluster license come standard with a 30-day trial version, and if we are new to the Zend Server then this is the best option to see the full server capabilities in action.

Next up is setting the administrator and developer password. If we are not the only one working on the server environment, it is best to use separate accounts as that creates a better maintenance structure in the organization; if only one person (or account) is capable of changing the system settings, then we can just skip filling in the developer details as they will not really have any use.

Once we have done all that, we are ready to login for the first time in our brand new system.

By default the login URL to the administration panel is http://localhost:10081/ZendServer for the non secure panel and https://localhost:10082/ZendServer for the secure administration panel.

The first thing we will see is the overview of the server's health, which also displays the current events that have taken place such as high memory uses, exceptions, and slow execution times.

The main bit we want to view now is the PHP configuration, which can be found in the Configuration screen, under PHP. It is very important to set the time zone for PHP as otherwise PHP will annoy us(for a reason: as some application developers erroneously believe that the machine is running on their local time zone, and base many of their date and time code on this) with warnings telling us that this should be set. If we search for the date.timezone in the search bar in the top right corner of the screen, it will take us (and highlight) immediately to the setting that we need to change. We can easily search on the Internet what the relevant value is for our specific time zone; this can be, for example, Europe/London or America/New_York.

See also

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image