|The instructions provided in this article or section are considered advanced.|
You are expected to be knowledgeable in the UNIX shell.
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.
[] (as seen from a FileZilla FTP client)
Here is 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.
- Familiar with the Dreamhost web panel
- SSH (terminal) to your Dreamhost account to run commands
Step 1 – Create a fully hosted domain / sub-domain on the Dreamhost panel
- Create a new account to host the site before or during creation
- Use bash for shell
- Use PHP 5.3
- Enhanced web security
- 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
- Make sure the Dreamhost auto-magic scripts have completed and the domain and user are active
- Edit the user config – Enable SSH, disallow FTP, change the password
- 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)
- SSH (terminal) to your account and run the following command to download the Zend Framework package:
- 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
- You can clean it up now using the command below
Step 4 – Modify bash profile
- Using the editor of your choice, open the .bash_profile for editing
- Add the following 3 lines to the end of the file and save it
- Disconnect and reconnect to your terminal (SSH) for the profile changes to take affect.
Step 5 – Create Your Zend App!
- 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
- 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
- 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
- Now symlink the Zend library into your zend app
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.
Blog Article: