Zend framework

From DreamHost
Jump to: navigation, search
The instructions provided in this article or section are considered advanced.

You are expected to be knowledgeable in the UNIX shell.
Support for these instructions is not available from DreamHost tech support.
Server changes may cause this to break. Be prepared to troubleshoot this yourself if this happens.
We seriously aren't kidding about this.

Objective

Here’s what we’re aiming for:

  • Hackless install, no custom php.ini or messed up redirection in your .htaccess
  • Simple and clean file structure

If you’re a Dreamhost customer, here’s the default Dreamhost directory structure which you are no doubt familiar with.

[[1]] (as seen from a FileZilla FTP client)

Here is the directory structure you’ll end up with:

[[2]]

This article is about how to get the framework running on Dreamhost shared hosting. It will not teach you anything about the Zend Framework.

Skills Required

  • Familiar with the Dreamhost web panel
  • SSH (terminal) to your Dreamhost account to run commands

The Process

Step 1 – Create a fully hosted domain / sub-domain on the Dreamhost panel

  1. Create a new account to host the site before or during creation
    1. Use bash for shell
    2. Use PHP 5.3
    3. Enhanced web security
  1. Wait for the domain to be created

Note: For security reasons it is best to create a new user account to host the domain. Avoid hosting multiple domains on the same user account at all costs! Delineation of resources is a standard security practice for a reason. If a hack compromises your account, all the domains running on that account can and will be affected.

Step 2 – Enable SSH, disallow FTP

  1. Make sure the Dreamhost auto-magic scripts have completed and the domain and user are active
  1. Edit the user config – Enable SSH, disallow FTP, change the password
  1. Wait for the user config changes to complete

Note: FTP is not secure. SFTP / SSH is no more difficult than FTP and provides a secure connection to your data.

Step 3 – Download and Extract Zend Framework through a shell (Terminal)

  1. SSH (terminal) to your account and run the following command to download the Zend Framework package:

wget http://framework.zend.com/releases/ZendFramework-1.11.11/ZendFramework-1.11.11-minimal.tar.gz

  1. Once downloaded, run the command below to extract the contents into a folder called “ZendFramework-1.11.11-minimal”

tar -xvf ZendFramework-1.11.11-minimal.tar.gz

  1. You can clean it up now using the command below

rm ZendFramework-1.11.11-minimal.tar.gz

Step 4 – Modify bash profile

  1. Using the editor of your choice, open the .bash_profile for editing
  1. Add the following 3 lines to the end of the file and save it

PATH=$PATH:$HOME/ZendFramework-1.11.11-minimal export PATH alias zf=$HOME/ZendFramework-1.11.11-minimal/bin/zf.sh

  1. Disconnect and reconnect to your terminal (SSH) for the profile changes to take affect.

Step 5 – Create Your Zend App!

  1. At the terminal (SSH) type the following command, do NOT name your project as a domain name, we’ll get to that

zf create project yourzendapp

Voila! A zend app magically appears in a new “yourzendapp” folder

Step 6 – Delete, Symlink and Symlink

  1. Normally not recommended, don’t do this under any other circumstances but for now run the following command through a terminal (SSH) where “yourdomain.com” is your domain. Dot com.

rm –rf yourdomain.com

  1. Now symlink it to the “public” directory of your zend app where “yourdomain.com” is your domain. Dot com.

ln -s yourzendapp/public yourdomain.com

  1. Now symlink the Zend library into your zend app

cd yourzendapp/library ln -s ../../ZendFramework-1.11.11-minimal/library/Zend

… and holy potatoes we’re done!

Visit yoursite.com and you should see the default zend mainpage.

References

Blog Article: [3]