Book Image

Zend Framework 2.0 by Example: Beginner's Guide

By : Krishna Shasankar V
Book Image

Zend Framework 2.0 by Example: Beginner's Guide

By: Krishna Shasankar V

Overview of this book

<p>ZF2 is the latest update to the well-known Zend Framework. This version has considerably eased the process of building complex web applications with minimal development effort using plug and play components. ZF2 also provides a highly robust and scalable framework for developing web applications.</p> <p>"Zend Framework 2.0 by Example: Beginner’s Guide" will guide you through the process of developing powerful web applications using ZF2. It covers all aspects of Zend Framework application development right from installation and configuration; the tasks are designed in a way that readers can easily understand and use them to build their own applications with ease.</p> <p>"Zend Framework 2.0 by Example: Beginner’s Guide" begins with the basic installation and configuration of the Zend Framework. As you progress through the exercises, you will become thoroughly acquainted with ZF2. With this book, you will learn about the basic concepts of building solid MVC web applications using Zend Framework 2.0. The detailed step-by-step instructions will enable you to build functionality such as a group chat, a file &amp; media sharing service, search, and a simple store to name a few. You will also use a wide range of external modules to implement features that are not natively available. By the end of the book, you will be well versed in building complex, functionality-rich web applications using Zend Framework 2.0.</p> <p>"Zend Framework 2.0 by Example: Beginner’s Guide" provides everything that you need for building functionality-rich web applications with simple real world examples and tasks.</p>
Table of Contents (18 chapters)
Zend Framework 2.0 by Example Beginner's Guide
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Time for action – creating a database


To create a new database, open an instance of phpMyAdmin in your web browser and follow the steps described here:

  1. Open phpMyAdmin in your web browser by visiting http://localhost/phpmyadmin:

  2. Choose Databases, enter the name of the new database as zf_app in Create new database, and click on Create:

  3. After creating the database, create a database user for this database; this can be done by selecting Add a new user from Privileges. Provide the following details:

    User field

    Value

    User name

    zf_user

    Host

    localhost

    Password

    zf_pass

    After doing this you will get the following screen:

  4. After the user is created, go to the Privileges section and choose Edit Privileges for the zf_user.

  5. In the Database-specific privileges section, select the zf_app database.

  6. You will be redirected to the privileges section of the zf_app database for the zf_user user. Choose Check All and click on Go.

You can now test the database by logging out of phpMyAdmin and logging in again with the user credentials of zf_user. You should now be able to see only the zf_app database.

What just happened?

We just created our first database in MySQL. We have also created a user in the database and mapped the user to the database with administrative rights; we can now use these credentials in the application that we will be building in our next chapters.

Have a go hero

Now that you have the PHP web server up and running and also have a MySQL database, create a simple table called Students and add a few records to the table using phpMyAdmin.

Your task will be to create a simple PHP web page that will display all the records in the Students table in the page.

Pop quiz – Zend Framework 2.0

Q1. What is the minimum version of PHP needed to run Zend Framework 2.0?

  1. PHP 4.3 and above

  2. PHP 5.2.0 and above

  3. PHP 5.3.3 and above

  4. PHP 5.4.7 and above

Q2. What is the default location of php.ini in the new Zend Server installation?

  1. /home/<user>/etc/php/php.inc

  2. /etc/php/php.ini

  3. /var/www/php.ini

  4. /usr/local/zend/etc/php.ini