Actions

Zend Framework Setup

From zen2

Revision as of 21:22, 16 February 2010 by Chris (talk | contribs) (Configure Zend)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

http://www.howtoforge.com/basic-web-server-on-ubuntu-9.04-with-zend-framework

Configure Apache

We need to make sure that rewrite_module is enabled in apache2 for the Zend Framework to work properly, so lets check:

a2dismod

Hopefully you should see rewrite listed in the list of modules that are currently enabled. If not, press enter to disable nothing and then issue:

a2enmod rewrite

Then we need to enable AllowOverride All in the default site file

sudo gedit /etc/apache2/sites-available/default
[...]
  DocumentRoot /var/www/
        <Directory />
                Options FollowSymLinks
                AllowOverride All
        </Directory>
        <Directory var/www/>
                Options FollowSymLinks 
                AllowOverride All
                Order allow,deny
                allow from all
        </Directory>
[...]

Restart Apache afterwards:

sudo /etc/init.d/apache2 restart

Install Zend

Now we can get the latest version of the Zend Framework

cd /opt
sudo mkdir ZendFramework
cd /ZendFramework
sudo svn co http://framework.zend.com/svn/framework/standard/tags/release-1.10.1/

Next what we will do is create a soft link called "current" to that release folder that way if we change the Zend Framework version, we can do so without restarting Apache:

sudo ln -s release-1.10.1 current

So that we don't have to manually add the include path into your PHP scripts using set_include_path. I want the current Zend Framework included automatically, by adding the path to the /etc/php5/apache2/php.ini.

sudo gedit /etc/php5/apache2/php.ini

Change:

include_path = ".:/usr/share/php5:/usr/share/pear"

to:

include_path = ".:/opt/ZendFramework/current/library:/usr/share/php5:/usr/share/pear"

Then Restart Apache again:

sudo /etc/init.d/apache2 restart

When a new version of the Zend Framework is released, all we need do is check out the SVN directory and change the soft link.

cd /opt/ZendFramework
svn co http://framework.zend.com/svn/framework/standard/tags/release-1.8.4/
rm current
ln -s release-1.8.4 current

Configure Zend

We now need to set up the paths for the command line so we'll make the same changes we just made above to the PHP CLI.

sudo gedit /etc/php5/cli/php.ini
include_path = ".:/opt/ZendFramework/current/library:/usr/share/php5:/usr/share/pear"
sudo gedit ~/.bashrc

and add the line

[...]
PATH=/opt/ZendFramework/current/bin:"${PATH}"
[...]

Reboot. When you log back in

zf.sh show version

And you should get

Zend Framework Version: 1.10.1