Zend Framework + SVN + ZF Tools on CentOS part 2

This is the 2nd part of my attempt to write a tutorial about using svn and ZF to create a working environment for a small team of developers. It assumes you have followed the instructions provided here.

The following notations will be used in this part:
project is the name of your project, wherever you see project written with italics replace it with your actual project name. It should be one word.
developer is the name of the developer that is part of the team working on this project. For example john. is the name of your domain, replace it with the real name.
A # in front of the line means you have to execute those commands as root, while $ means you have to be a normal user.

1. Create the repository for the project

# mkdir -pv /var/svn
# svnadmin create /var/svn/project

2. Create project layout

# cd /tmp
# mkdir project
# cd project
# mkdir branches tags trunk

If you want to create a standard zf project:

# cd trunk
# zf create project
# ls

ATTENTION: zf create project is a command, so do not replace the word project.
You should have the standard structure now for a Zend Framework project.

3. Import the project files to repository

# svn import /tmp/project file:///var/svn/project -m "initial import"
# chown -R apache:apache /var/svn/project

4.1 Creating a user for the developer

# adduser -g users developer
# passwd developer

Repeat the above steps for each developer you want to add.

4.2 Creating a user for the project

# adduser project
# passwd project

5.1 Add a virtual host for each developer in apache conf file

You will have to figure out where your virtual hosts are defined in apache conf files. Most likely you can add the following lines to /etc/http/conf/httpd.conf

# developer sandbox
<VirtualHost *:80>
DocumentRoot /home/developer/www
ErrorLog /home/developer/logs/error_log
CustomLog /home/developer/logs/access_log combined
<Directory "/home/developer/www/">
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all

5.2 Add a virtual host for the project

# project sandbox
<VirtualHost *:80>
DocumentRoot /home/project/www
ErrorLog /home/project/logs/error_log
CustomLog /home/project/logs/access_log combined
CustomLog /home/project/logs/svn_logfile "%t %u %{SVN-ACTION}e" env=SVN-ACTION
<Directory "/home/project/www/">
Options -Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
<Location /svn>
Options +Indexes
DAV svn
SVNParentPath /var/svn
SVNPathAuthz off
SVNIndexXSLT "/svnindex.xsl"
Require valid-user
AuthType Basic
AuthName "Subversion repository"
AuthUserFile /var/svn/project/conf/passwd

* Depending on your DNS settings you may have to manually add the needed records for to properly work.

7.1 Checking out to dev boxes

# su - developer
$ mkdir svn
$ cd svn
$ svn checkout .
$ cd ..
$ rm www
$ ln -s /home/developer/svn/public www

7.2 Exporting the latest version of the project

# su - project
$ mkdir svn
$ cd svn
$ svn export . --force
$ cd ..
$ rm www
$ ln -s /home/project/svn/public www

See the project page at

Next time you want to update the page remove the svn directory, and re-export it as above.

8.1 Working as a developer

To update you dev box to latest version:

$ cd svn
$ svn up

Whenever you add a NEW file/directory to the project use:

$ svn add filename

Of course you replace filename with the real name of the file. The reverse of this is svn del.

When you are satisfied with your changes don’t forget to commit:

$ svn commit -m "something meaningful for that idiot project manager"

8.2 Working as a project manager(?)

$ su - project
$ rm -rf svn

Repeat the steps from 7.2
Check logs for svn commits at /logs/svn_logfile

<< EOF

Zend Framework + SVN + ZF Tools on CentOS

This first part focuses on installing svn + zf library + zf tools on your dev server. In the second part (coming soon) I will show you how to create a svn repository and import into it a simple zf project created with zf tools.

You will need at least a working web server (Apache2) and PHP version 5.

I’ll be using utterramblings repository to install subversion and required packages for the apache server.

Import the gpg key for utterramblings repository:

rpm –import

Add the repository to yum by creating a repo file in /etc/yum.repos.d/utterramblings.repo that contains the following lines:

name=Jason’s Utter Ramblings Repo

Install subversion and mod_dav_svn from utterramblings:

yum install subversion –enablerepo=utterramblings
yum install mod_dav_svn –enablerepo=utterramblings

You should have everything you need to start working with svn on your server.

Now let’s install ZF tools to the server:

mkdir ZF_Tool
cd ZF_Tool/
svn checkout .

Now copy the directory ‘library/ZendL’ to a place that’s in the include path of your php. In my case it was ‘/usr/share/php’.

Copy ‘bin/’ and ‘bin/zf.php’ to /bin and edit updating ZF_BIN_PHP variable to:


Don’t forget to change their permissions so anyone can use them:

chmod a+rx /bin/zf*

For ZF library I’ve used the minimal package since it contains most of the stuff I use anyway without being bloated. At the time of writing this article 1.6 was the latest version, which I’ve got it from their site using wget:

tar zxvf ZendFramework-1.6.2-minimal.tar.gz

Copy the directory ‘library/Zend’ to the same place where you’ve put ZendL directory (‘/usr/share/php’ for me).

Now if everything went ok when you type at the cli ‘zf show version’ you should get something like ‘Zend Framework Version: 1.6.2’.

Congratulations you are done with this part. If you want you can play around with ‘zf create project’ until I publish my next article showing how to use zf tools + SVN together to create the bases of a project.