Starting up a Zend Framework 2 application

February 20, 2013
By

In this article, we will develop a Zend Framework 2 application, namely “Zf2StudentApp”.

This article belongs the series “Web application development with Zend Framework 2“.

This application is developed in Apache2 web server running in Ubuntu Linux distribution.

We will make use zftool.phar to create Zend Framework 2 application.


1. Setting up Apache2 Web Server in Ubuntu

Please follow the given below link to setup Apache2 Web Server in Ubuntu

Installing and Starting Apache2 Web Server in Ubuntu 12.04


2. Setting up PHP in Apache2 Web Server

Please follow the given below link to setup PHP in Apache2 Web server

Installing PHP in Ubuntu 12.04 to work with Apache2 web server


3. Download zftool (zftool.phar) from the given below link

https://packages.zendframework.com/zftool.phar


4.Copy the downloaded, zftool.phar file to the directory /var/www

$sudo cp zftool.phar /var/www

5. Create a Zend Framework2 application namely “Zf2StudentApp”

$sudo php zftool.phar create project Zf2StudentApp

6. Installing Zend Framework2 library to this application

$cd Zf2StudentApp
$sudo php composer.phar self-update
$sudo php composer.phar install

7. Append the given below entry to theĀ  file /etc/hosts to add hostname

127.0.0.1 zf2studentapp.local

8. Create a file namely zf2studentapp.local in /etc/apache2/sites-available with the given below directive to create a virtual host

<VirtualHost *:80>
    ServerName zf2studentapp.local
    DocumentRoot /var/www/Zf2StudentApp/public
    SetEnv APPLICATION_ENV "development"
    <Directory /var/www/Zf2StudentApp/public>
        DirectoryIndex index.php
        AllowOverride all
        Order allow,deny
        Allow from all
    </Directory>
</VirtualHost>

9. Enable the site zf2studentapp.local

$sudo a2ensite zf2studentapp.local

10. Enable Apache’s rewrite module

$sudo a2enmod rewrite

11. Restart Apache2 Web server

$sudo service apache2 restart


12. Accessing the application at the URL : http://zf2studentapp.local

Starting up Zend Framework 2 Web Application

Figure 1 : Starting up Zend Framework 2 Web Application


13. Download

The source for this application can be downloaded from here.

The application repository is available here


14. What is next?

In the next part, we are discussing how to create a module, controller and action in Zend Framework 2 application. It is available at Zend Framework2 – Creating module, controller, actions, views and routing


How to hire me?

I am George Mathew, working as software architect and Android app developer at wptrafficanalyzer.in

You can hire me on hourly basis or on project basis for Android applications development.

For hiring me, please mail your requirements to info@wptrafficanalyzer.in.

My other blogs
store4js.blogspot.com


Android Knowledge Quiz

Ready to test your knowledge in Android? Take this quiz :



Tags: , , , , ,

One Response to Starting up a Zend Framework 2 application

  1. Moti on February 16, 2014 at 3:27 am

    Thanks for the simple and seamless post.

    How to create module? i followed your written steps , after i tried to create module using the command php zftool.phar create module Album.
    but its throwing fatal error exception!

Leave a Reply

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

Be friend at g+

Subscribe for Lastest Updates

FBFPowered by ®Google Feedburner