ZendFramework 2

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

Skills Required

 * Familiar with the Dreamhost web panel
 * SSH to your Dreamhost account to run commands

Create a new user

 * 1) Create a new user
 * 2) Shell account
 * 3) Shell type: /bin/bash
 * 4) Disallow FTP (optional, but highly recommended)

Create a phprc file

 * 1) SSH to your account and run the following command:
 * 2) In that folder, create a file named exactly "phprc"
 * 3) Insert the following content:

The first five lines are used to turn Phar on and set it up for installation. The memory limit is raised just for the installation process, otherwise it will run out of memory and fail. That line should be removed once the Zend Framework 2 is correctly installed.

Make PHP 5.3 default
DreamHost currently defaults the php command to PHP 5.2, so we will change that to PHP 5.3 by running the following command:

Now, run:

And you should get a response stating the PHP version, which will be 5.3.x

Download Zend Framework 2

 * 1) SSH to your account and run the following commands to download the Zend Framework 2 package:
 * 2) cd my/project/directory (this can be your user's root directory)
 * 3) git clone git://github.com/zendframework/ZendSkeletonApplication.git
 * 4) cd ZendSkeletonApplication
 * 5) php composer.phar self-update
 * 6) php composer.phar install

Once this process is complete, you may want to rename ZendSkeletonApplication to your project's name.

Create a new domain and change the web directory

 * 1) Login to your DreamHost panel
 * 2) Go to Manage Domains
 * 3) Create or edit the domain for your project
 * 4) Set the web directory to: my/project/directory/ZendSkeletonApplication/public
 * 5) Choose PHP 5.3.x FastCGI
 * 6) Save changes

It usually takes about 5 minutes to an hour for the domain to be available.

Visit your website and wrap up
When you go to your website, you should see the default Zend Framework 2 page. At this point, everything works so we will remove the custom php configuration that was set earlier. Simply delete or rename the phprc file to something else.

Enjoy the framework now!