Version control PHP Web Project
Asked Answered
L

8

36

We have a PHP project that we would like to version control. Right now there are three of us working on a development version of the project which resides in an external folder to which all of our Eclipse IDEs are linked, and thus no version control.

What is the right way and the best way to version control this?

We have an SVN set up, but we just need to find a good way to check in and out that allows us to test on the development server. Any ideas?

Looksee answered 7/8, 2008 at 16:46 Comment(0)
B
27

We were in a similar situation, and here's what we ended up doing:

  • Set up two branches -- the release and development branch.
  • For the development branch, include a post-commit hook that deploys the repository to the dev server, so you can test.
  • Once you're ready, you merge your changes into the release branch. I'd also suggest putting in a post-commit hook for deployment there.

You can also set up individual development servers for each of the team members, on their workstations. I find that it speeds things up a bit, although you do have some more setup time.

We had to use a single development server, because we were using a proprietary CMS and ran into licensing issues. So our post-commit hook was a simple FTP bot.

Bove answered 7/8, 2008 at 16:56 Comment(0)
P
5

Here is what we do:

  • Each dev has a VM that is configured like our integration server
  • The integration server has space for Trunk, each user, and a few slots for branches
  • The production server
  • Hooks are in Subversion to e-mail when commits are made

At the beginning of a project, the user makes a branch and checks it out on their personal VM as well as grabs a clean copy of the database. They do their work, committing as they go.

Once they have finished everything in their own personal space they log into the integration server and check out their branch, run their tests, etc. When all that passes their branch is merged into Trunk.

Trunk is rebuilt, the full suite of tests are run, and if all is good it gets the big ol' stamp of approval, tagged in SVN, and promoted to Production at the end of the night.

If at any point a commit by someone else is made, we get an e-mail and can merge those changes into our individual branches.

Parental answered 7/8, 2008 at 21:15 Comment(0)
M
3

Beanstalk has built-in post-commit hooks for deploying to development, staging, and production servers.

Manhandle answered 8/8, 2008 at 18:17 Comment(0)
Q
2

One way to use subversion for PHP development is too setup a repository for one or all three developers, and use this repository, more as a syncing tool, than true version control.

You could,

  • Make a repo

  • Add your entire PHP document structure of your project

  • Checkout a copy of this repo into the correct spot on your dev server

  • Use an svn hook, that activates on commit

This hook, will automatically update the contents of the dev sever, whenever anybody on the team checks in any code.

Hook resides in:

svn_dir/repo_name/hooks/post-commit

And could look like:

/usr/bin/svn up /path_to/webroot --username svn_user --password svn_pass

That will update your working copy on the dev server to the latest check in.

Quarterdeck answered 7/8, 2008 at 17:4 Comment(0)
C
2

What about something distributed? You can start for example with Mercurial, try different workflows, and see which one fits you the best.

Carbaugh answered 17/3, 2010 at 21:9 Comment(0)
S
0

Each of you could run it locally, or on your own dev server (or even the same one with a different port...).

Sherburne answered 7/8, 2008 at 16:49 Comment(0)
C
0

One possible way (there are probably better ways):

Each of you should have your own checked out version of the project.

Have a local copy of the server on your computer and test it there throughout the day. Then at the end of each day (or whenever), you merge together whatever you are ready to test, and you check it out onto the dev server and test it.

Chromosphere answered 7/8, 2008 at 16:57 Comment(0)
B
0

Another tool you can use for the builds is TeamCity which is free for 20 build configurations (enough for most small companies/projects.) This way you can run your tests as well as schedule builds.

Butyrate answered 19/9, 2008 at 9:18 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.