# CVS & executable PHP

I have a CVS on Debian and apache/PHP/MySql. I remember when i worked in a team over the net a wile ago, that after commit i could see the changes on the web server in the php application.

How can I achieve this?

Thanks

You'd need a Post-commit hook to update (cvs update) /var/www or wherever your DocumentRoot is.

Don't.

If it's not a development server only, then it's an exceptionally bad idea. It only takes a second to commit non-working code, then you're website's buggered.

The smart play in this situation, I think, is to use something like Hudson CI server, and run a bunch of PHP tests, with lint, PHPUnit and Selenium before updating the DocumentRoot with new code.

Another valid option is only to allow the DocumentRoot to be updated if the latest release is "tagged", so that the tagging is a manual process, and only takes place after the code has been reviewed / tested.

• Yes this is a dev server, it is available in intranet only. – Dr Casper Black Jan 31 '11 at 10:42

This can be done by having a script to automatically publish your repo to the web server every X minutes, this script should only check that changes have happened to the repository and proceed to deploy it.

This is very useful for development scenarios, be aware though that automatic deployment is really not recommended for prod (I know you're not asking for that, it's just a recommendation)