Let us learn to deploy Zend Skeleton Application provided by ZendFramework as our Hello World Application.
1.Clone Zend framework 2 Skeleton Application in the server root. Go to your server root and clone the skeleton application on github:#git clone https://github.com/zendframework/ZendSkeletonApplication.gitYou need to install before git to execute above command. If don’t have git installed then download the zip file from github. 2.Install Composer. It is a dependency manager for PHP.
#curl -sS https://getcomposer.org/installer | phpUpdate the Composer:
#php composer.phar self-update3. Install all the dependencies for Zend Application using Composer. Go to the root of your Zend Application and execute following command:
#php composer.phar installAbove command will install all the dependencies defined in composer.json file. Zend framework 2 use Composer extensively to install the dependencies . All the dependencies r defined in composer.json files. 4. Set up the virtual host for your Zend Application. Open /usr/local/zend/etc/sites.d/vhost_comm-app-80.conf file in any text editor, e.g vim:
# vim /usr/local/zend/etc/sites.d/vhost_comm-app-80.confvhost_comm-app-80.conf is the virtual host file in Zend Server. Add following codes in this file:
<VirtualHost *:80>
ServerName helloworld.local
DocumentRoot /var/www/helloworld/public
SetEnv APPLICATION_ENV “development”
<Directory /var/www/helloworld/public>
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
ServerName helloworld.local
DocumentRoot /var/www/helloworld/public
SetEnv APPLICATION_ENV “development”
<Directory /var/www/helloworld/public>
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
Line# 2 : helloworld.local is the name of server.
Line#3 : /var/www/helloworld/public is the path to public folder of our hello world application.
Line#4 : We have set the Application environment of Zend to Development Mode.
#vim /etc/hostsAdd following line to /etc/hosts files:
127.0.0.1 hellowolrd.local6. All set! Now restart Zend Server, open browser ad navigate to helloworld.local , you will see default page of Zend skeleton application.
# service zend-server restart
This post first appeared on Technohunk.com| Daily Hacks In Plain English!, please read the originial post: here