Zend framework
From DreamHost
I wanted to play around with the ZEND Frame work and wanted to see what the big deal was with this Model Controler View (MCV) thing I have heard so much about. But when I googled "zend framework tutorial dreamhost" all I found was others looking for help. And the only answers were folks talking about other hosting companies.
| The instructions provided in this article or section are considered advanced. You are expected to be knowledgeable in the UNIX shell. |
- It is my assumption you have setup command line access to your Dream Host account and can Login via SSH.
- It is also my assumption you know how to copy files from your local computer to your Dream host home directory
Step 1. Download The ZEND Framework
At the Time of this writing 1.8.4 is the Latest
http://framework.zend.com/download/latest
I got the Full Package version myself.
Step 2. make a Directory named ZEND_framework
This will be a nice place to keep the file needed to "make it go" in your home directory
mkdir ZEND_framework
Step 3. Upload The ZEND stuff you need
When up unpack/unzip it there will be a folder named library
Upload the "library" folder and it's contents to the ZEND_framework on your dreamhost account
AND Upload the "bin" folder and it's contents to the ZEND_framework folder.
Step 4. setup a php.ini for the command line zf.sh script
It seems to me you don't need to compile your own PHP to get this to work.
All you need do is have a php.ini file where you can add to the include path.
for this section I "borrowed" from http://wiki.dreamhost.com/PHP.ini
cp /etc/php5/cgi/php.ini $HOME/ZEND_framework/php.ini
now edit the php.ini file you just copied and you are going to change line 494
FROM include_path = ".:/usr/local/php5/lib/php:/usr/local/lib/php"
TO something like
include_path = ".:/usr/local/php5/lib/php:/usr/local/lib/php:/home/(YOUR_USER_NAME_HERE)/ZEND_framework/library"
Step 5. Modify the zf.sh script
FROM
#!/bin/sh
#############################################################################
# Zend Framework
#
# LICENSE
#
# This source file is subject to the new BSD license that is bundled
# with this package in the file LICENSE.txt.
# It is also available through the world-wide-web at this URL:
# http://framework.zend.com/license/new-bsd
# If you did not receive a copy of the license and are unable to
# obtain it through the world-wide-web, please send an email
# to license@zend.com so we can send you a copy immediately.
#
# Zend
# Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
# http://framework.zend.com/license/new-bsd New BSD License
#############################################################################
# find php: pear first, command -v second, straight up php lastly
if test "@php_bin@" != '@'php_bin'@'; then
PHP_BIN="@php_bin@"
elif command -v php 1>/dev/null 2>/dev/null; then
PHP_BIN=`command -v php`
else
PHP_BIN=php
fi
# find zf.php: pear first, same directory 2nd,
if test "@php_dir@" != '@'php_dir'@'; then
PHP_DIR="@php_dir@"
else
SELF_LINK="$0"
SELF_LINK_TMP="$(readlink "$SELF_LINK")"
while test -n "$SELF_LINK_TMP"; do
SELF_LINK="$SELF_LINK_TMP"
SELF_LINK_TMP="$(readlink "$SELF_LINK")"
done
PHP_DIR="$(dirname "$SELF_LINK")"
fi
$PHP_BIN -d safe_mode=Off -f "$PHP_DIR/zf.php" -- $@
TO
#!/bin/sh
#############################################################################
# Zend Framework
#
# LICENSE
#
# This source file is subject to the new BSD license that is bundled
# with this package in the file LICENSE.txt.
# It is also available through the world-wide-web at this URL:
# http://framework.zend.com/license/new-bsd
# If you did not receive a copy of the license and are unable to
# obtain it through the world-wide-web, please send an email
# to license@zend.com so we can send you a copy immediately.
#
# Zend
# Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
# http://framework.zend.com/license/new-bsd New BSD License
#############################################################################
# find php: pear first, command -v second, straight up php lastly
PHP_BIN=/usr/local/php5/bin/php
# find zf.php: pear first, same directory 2nd,
if test "@php_dir@" != '@'php_dir'@'; then
PHP_DIR="@php_dir@"
else
SELF_LINK="$0"
SELF_LINK_TMP="$(readlink "$SELF_LINK")"
while test -n "$SELF_LINK_TMP"; do
SELF_LINK="$SELF_LINK_TMP"
SELF_LINK_TMP="$(readlink "$SELF_LINK")"
done
PHP_DIR="$(dirname "$SELF_LINK")"
fi
$PHP_BIN -c /home/(YOUR_USER_NAME_HERE)/ZEND_framework/php.ini -d safe_mode=Off -f "$PHP_DIR/zf.php" -- $@
Step 6. chmod the zf.sh script
chmod +x $HOME/ZEND_framework/bin/zf.sh
Step 7. create an alias to the zf.sh script
- assuming you use the bash shell like I do
ADD
alias zf=/home/(YOUR_USER_NAME_HERE)/ZEND_framework/bin/zf.sh
to Your .bash_profile in your Home directory
then
source .bash_profile
Step 8. TEST the zf script
Type
zf show version
You should see
Zend Framework Version: 1.8.4
Step 9. setup a project
Be sure to check out
http://akrabat.com/zend-framework-tutorial/
In Fact that is where I started
However that tutorial assumes you can edit a vhost and bounce apache
Here is what I did instead. Do not proceed if Step 8 failed
for sections 9.1 to 9.9 use a domain you have fully hosted with Dream host and not actually "example.com"
9.1 Logged in to https://panel.dreamhost.com/
9.2. Created a new sub-domain under "Manage Domains" for this example "zend.example.com"
(a Dream host script will do it's ninja magic and setup the vhost and create a directory "zend.example.com" in your $HOME directory)
9.3. Wait for it... the directory "zend.example.com" in your $HOME directory that is.
9.4. login via SSH and Delete the directory "zend.example.com" in your $HOME directory (not in the panel the vhost should still be setup)
zf create project zend.example.com
9.6. You should now have a “zend.example.com” again with all the ZEND frame work bits
9.7 Follow the steps on http://wiki.dreamhost.com/PHP.ini under "Custom php.ini for a Single domain" apply the chages for your "zend.example.com" directory.
9.8 Edit the php.ini file under the cgi-bin you made in 9.7 and change line 494
FROM include_path = ".:/usr/local/php5/lib/php:/usr/local/lib/php"
TO something like
include_path = ".:/usr/local/php5/lib/php:/usr/local/lib/php:/home/(YOUR_USER_NAME_HERE)/ZEND_framework/library"
9.9 Add this to your zend.example.com/.htaccess file
Again use you domain name not "example"
RewriteEngine on
RewriteCond %{HTTP_HOST} zend\.example\.com [NC]
RewriteCond %{REQUEST_URI} !/public
RewriteRule (.*) /public/$1 [L]
Masterwebmonkey 15:54, 24 June 2009 (UTC)

