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 are the objectives:

  • 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 with which you should be familiar:

Here's the directory structure you’ll end up with:

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

Required Skills

You need to be:

  • familiar with the DreamHost web panel, and
  • able to SSH (terminal) to your DreamHost account to run a command.

The Process

Important icon.png Important: Please be aware that DreamHost recommends you use PHP version 5.4. You can find more info about PHP here:


Step one — Creating a fully hosted domain/sub-domain on the DreamHost panel

  1. Create a new account to host the site before or during creation.
  2. Use bash for shell.
  3. Use PHP 5.4 for enhanced web security.
  4. Wait for the domain to be created.
Note2 icon.png 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 two — Enabling SSH and disallowing FTP

  1. Make sure the DreamHost auto-magic scripts have completed and the domain and user are active.
  2. Edit the user config: enable SSH, disallow FTP, and change the password.
  3. Wait for the user config changes to complete.
Note2 icon.png Note: FTP is not secure. SFTP/SSH is no more difficult to use than FTP and provides a secure connection to your data.


Step three — Downloading and extracting 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
  2. Once downloaded, run the following command to extract the contents into a folder called “ZendFramework-1.11.11-minimal”:
    tar -xvf ZendFramework-1.11.11-minimal.tar.gz
  3. To clean it up, use the following command:
    rm ZendFramework-1.11.11-minimal.tar.gz

Step four — Modifying the bash profile

  1. Using the editor of your choice, open the .bash_profile to edit.
  2. Add the following three 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
    
  3. Disconnect and reconnect to your terminal (SSH) for the profile changes to take affect.

Step five — Creating your Zend app!

  1. At the terminal (SSH), type the following command (do NOT name your project as a domain name yet):
    zf create project yourzendapp
Voila! A zend app magically appears in a new “yourzendapp” folder!

Step six — Deleting with Symlink

Important icon.png Important: We don't recommend this, and should not be performed under any other circumstances.



  1. Run the following command through a terminal (SSH) where “yourdomain.com” is your domain.com:
    rm –rf yourdomain.com
  2. Symlink it to the “public” directory of your zend app where “yourdomain.com” is your domain.com:
    ln -s yourzendapp/public yourdomain.com
  3. Symlink the Zend library into your zend app:
    cd yourzendapp/library
    ln -s ../../ZendFramework-1.11.11-minimal/library/Zend
    
And that's it... you finished it!

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

References