Install Zend Framework on Linux

Zend Framework 1.11.10 version has the following System Requirements:

  1. Linux server (Ubuntu 11.10).
  2. Apache2.2 or later.
  3. MYSQL 5.1 or later.
  4. PHP 5.2.4 or later.

Download and Install Zend Framework

  • Download zend framework (full version recommended) and save to your "Download" folder
  • Extract ZendFramework-xx.tar.gz and rename ZendFramework-x.x.x as "ZendFramework"
  • Copy ZendFramework to local system folder:
    sudo cp -r ~/Downloads/ZendFramework  /usr/local/
  • Open your terminal, type:
    sudo gedit ~/.bash_aliases
    - Add the following line:
       alias zf='/usr/local/ZendFramework/bin/zf.sh'
  • Save and exit it.
  • Reload .bash_aliases:
    source .bash_profile
  • Test zf tool installation:
    zf show version
    Zend Framework Version: 1.11.10
  • Install Pear and PHPUnit
    sudo apt-get install php-pear
    sudo pear upgrade pear
    sudo pear update-channels
    sudo pear channel-discover pear.phpunit.de (check whether a channel installed)
    sudo apt-get install phpunit/PHPUnit
  • Check your phpunit version:
    phpunit --version
    PHPUnit 3.5.5 by Sebastian Bergmann.
  • Open your php.ini configuration file
    sudo gedit /etc/php5/apache2/php.ini
  • Find the following line and uncomment it:
    ; UNIX: "/path1:/path2"
    include_path = ".:/usr/share/php"
  • Install XDebug
    sudo apt-get install php5-xdebug
  • Locate xdebug.so path:
    locate xdebug
    /usr/lib/php5/20090626+lfs/xdebug.so
    ... ...
  • Add the following line to php.ini:
    zend_extension="/usr/lib/php5/20090626+lfs/xdebug.so"
  • Find the following line and uncomment it:
    Development Value: E_ALL | E_STRICT
  • Restart your apache server
    sudo /etc/init.d/apache2 restart
  • Type the browser localhost/phpinfo.php and search for Zend logo.
    <?php
        phpinfo();
    ?>
    You will see on the left of this logo, the following description
    ... with Xdebug v2.1.0, Copyright (c) 2002-2010, by Derick Rethans

Test PHPUnit

  • Create a new file testphpunit.php into /home/user/Public/:
    <?php
            
    // testphpunit.php
               class TestPHPUnit extends PHPUnit_Framework_TestCase {
                    public function testOne()
                    {
                             $this->assertTrue(FALSE);
                   }
               }
            ?>
  • Save the file.
  • Go to terminal and type console:
    phpunit --verbose TestPHPUnit.php

    PHPUnit 3.5.5 by Sebastian Bergmann.

    TestPHPUnit
    F

    Time: 0 seconds, Memory: 3.50Mb

    There was 1 failure:

    1) TestPHPUnit::testOne
    Failed asserting that <boolean:false> is true.

    /home/..../Public/TestPHPUnit.php:5

    FAILURES!
    Tests: 1, Assertions: 1, Failures: 1.

Test Zend Framework

  • Create a new file testZendFramework.php into Public/ folder:
    <?php
            // testZendFramework.php 
            require_once 'Zend/Mail.php';
           $mail = new Zend_Mail();
            echo 'it is working.';
    ?>
  • Save the file
  • Type into your browser:
    localhost/testZendFramework.php
    you will see the message: it is working.

PEAR, PHPUnit Channels

sudo pear update-channels
components.ez.no
doc.php.net
pear.php.net
pear.phpunit.de
pear.symfony-project.com
pear.zfcampus.org
pecl.php.net