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 performed by DreamHost may break your modifications. You, as the user, are responsible for troubleshooting and resolving issues with your customizations.

Overview

This article provides instructions on how to implement the Zend framework onto a shared hosting environment. Please note that this guide does not teach you about the Zend Framework itself.

Note2 icon.png Note: To proceed with this article, you must have a Shell user enabled and have a basic understanding of the Unix shell. View the following articles for further details:


Objectives

Here are the objectives:

  • Hackless install, no custom php.ini or messed up redirection in your .htaccess
  • Simple and clean file structure
Important icon.png Important: Please be aware that DreamHost recommends you use PHP version 5.6. You can find more info about PHP here:

Installing Zend framework

Step one: creating a new user

View the Users article for details on how to create a new username. When creating it, make sure it’s created as an SSH (Shell) user as this allows you to log into your server to run commands later.

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! If a hack compromises your account, all the domains running under that specific username can and will be affected.


Step two: creating a fully hosted domain/subdomain

View the following article which walks you through how to add a fully hosted domain to your panel:

Makes sure to assign the newly created Shell user to the domain when adding it.

Step three: downloading and extracting Zend Framework through a shell (terminal)

  1. SSH to your user’s home directory.
  2. In that directory, run the following command:
    wget https://packages.zendframework.com/releases/ZendFramework-1.12.15/ZendFramework-1.12.15.tar.gz
  3. View the following page for a full list of available downloads:
  4. Once downloaded, run the following command to extract the contents into a folder called ‘ZendFramework-1.12.15’:
    tar -xvf ZendFramework-1.12.15.tar.gz
  5. Run the following command to remove the original .tar.gz file:
     rm ZendFramework-1.12.15.tar.gz

Step four: modifying the bash profile

  1. Using the editor of your choice, open the .bash_profile to edit. For example, you can use the ‘nano’ editor:
    nano .bash_profile
  2. Add the following three lines to the end of the file and save it:
    PATH=$PATH:$HOME/ZendFramework-1.12.15
    export PATH
    alias zf=$HOME/ZendFramework-1.12.15/bin/zf.sh
    
  3. Add the following to the bottom of your .bashrc file:
    source .bash_profile
  4. Save the file by running CTRL + X, then clicking the ‘Enter’ key.
  5. Disconnect and reconnect to your terminal (SSH) for the profile changes to take affect. You could also run the following command to update it:
    . ~/.bash_profile

Step five: creating your Zend app

At the terminal (SSH), type the following command (do NOT name your project as a domain name yet):

zf create project yourzendapp

A zend app appears in a new “yourzendapp” folder.

Step six: deleting with Symlink

  1. Run the following command through a terminal (SSH) where “example.com” is your domain:
    mv example.com example.com_OLD
  2. Symlink it to the “public” directory of your zend app where “example.com” is your domain:
    ln -s yourzendapp/public example.com
  3. Symlink the Zend library into your zend app:
    cd yourzendapp/library
    ln -s ../../ZendFramework-1.12.15/library/Zend
    
  4. Visit your domain and you should see the default zend mainpage.

See also