Creating Zend Framework2 Skeleton application using zftool phar file in LAMP

February 5, 2013
By

In this article, we will create a Zend Framework2 skeleton application using zftool in Ubuntu 12.04.

In our previous article titled “Setting up Zend Framework2 Skeleton application in LAMP“, we had setup a Zend Framework2 skeleton application which is downloaded from http://github.com.

In order to develop a Zend Framework2 application, we need to have a web server with PHP installed. For installing Apache2 web server and PHP in Ubuntu, you can follow the given below articles.

Installing and Starting Apache2 Web Server in Ubuntu 12.04

Installing PHP in Ubuntu 12.04 to work with Apache2 web server


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

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


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


$sudo cp zftool.phar /var/www


3. Create a Zend Framework2 skeleton application namely “Zf2SkeletonApplicationWithZftool”


$sudo php zftool.phar create project Zf2SkeletonApplicationWithZftool


4. Installing Zend Framework2 library to this application


$cd Zf2SkeletonApplicationWithZftool

$sudo php composer.phar self-update

$sudo php composer.phar install


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


127.0.0.1 zf2skeletonapplicationwithzftool.local


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


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


7. Enable the site zf2skeletonapplicationwithzftool.local


$sudo a2ensite zf2skeletonapplicationwithzftool.local


8. Enable Apache’s rewrite module


$sudo a2enmod rewrite


9. Restart Apache2 Web server


$sudo service apache2 restart



10. Accessing the application at the URL : http://zf2skeletonapplicationwithzftool.local

Screenshot of the Zend Framework2 application

Figure 1 : Screenshot of the Zend Framework2 application


11. What is next?

A continuation to this article 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: , , , , ,

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