Wednesday, 25 February 2015

PHP Zend - Install and Deploy on Ubuntu


Apache
Php
mysql
phpmyadmin







  Introduction:


This step by step guide will walk you through installation and configuring Zend framework for PHP development with MySQL database on Ubuntu

1      Install Mysql

sudo apt-get install mysql-server mysql-common mysql-client  mysql-doc-5.0

2   Install Apache 2

The  following command to install the Apache HTTP server, its documentation, and  collection of utilities.
sudo apt-get install apache2 apache2-doc apache2-utils

To check Apache running  or not go to the URL http://localhost it should be display like this
Apache installation
Apache Default page

To start, stop and restart apache2

sudo service apache2 start
sudo service apache2 stop
sudo service apache2 restart

To install Support for PHP Scripting

sudo apt-get install libapache2-mod-php5 php5 php-pear php5-xcache

To install phpMyAdmin


sudo apt-get install phpmyadmin

To up and run phpmyadmin we need to configure apache


          cd  /etc/apache2/
          sudo gedit apache2.conf

We need to  include the following line in apach2.conf

     Include /etc/phpmyadmin/apache.conf

To check phpMyAdmin is runing  or not go to the URL http://localhost/phpmyadmin or http://Domainname/phpmyadmin it should be display like this
phpmyadmin login
PhpMyadmin Login


while installing mysql you will be asked to chose username and password.We need to use same uaername and password login. 

To install Zend framework

           Sudo apt-get install  zend-framework

You can execute" zf " in terminal to check all the zend framework  command.
        To  create project go to
          cd  /var/www/
   Then
           zf  create projectname

Virtual host (To use default host)


        cd  /etc/apache2/
        sudo gedit apache2.conf

Move to Directory location and make sure Below setting


        <Directoy  /var/www/>
               Options Indexes  FollowSymLinks
               AllowOverride None
               Required all granted
     </ Directoy> 

Then move to
         cd /etc/apache2/sites-available
         sudo gedit 000-default.conf

Go To Document Root then Modify Document Root line to

         DocumentRoot /var/www/projectname/public

And make sure /var/www have a permission to read,write and execute.if the permission is denied execute the following command 
         sudo chmod -R 755 /var/www/ or sudo chmod -R 755 /var/www/projectname

Note: If you are facing any problem with pre Installed Mysql and Apache.Run Below command to remove mysql and apache2  completely then reinstall it

To uninstall Mysql completely


          sudo apt-get --purge remove mysql-server mysql-common mysql-client libmysqlclient15-dev libmysql-ruby


To uninstall apache2 completely


          sudo apt-get remove --purge apache2 apache2-utils apache2.2-bin apache2-common;
          sudo apt-get autoremove;

To uninstall phpmyadmin completely 


          sudo apt-get --purge remove phpmyadmin