Keep in mind this is based on MY development and deployment environment, in your environment things will be a bit different.
{esc} = Press escape key.
{everything else} = Needs changed for your project or case.
Do not type # hash or anything after it.

Where it says “root> ” you may also assume “admin_user> sudo ” if you like to use protection.

Create new svn user:

	root> htpassd -m /etc/apache2/dav_svn.passwd {username}
	# will ask for password twice

Create svn project:

	root> cd /path/to/svn/repo/root
	root> svnadmin create {project name}
	root> chown -R www-data: ./{project name}

First import for project:

	user> mkdir svn_{project}_core
	user> cd svn_{project}_core
	user> mkdir trunk
	user> mkdir tags
	user> mkdir branches
	user> cd trunk
	user> cp -r /path/to/existing/files/ ./
	# repeat for . files in root direcotry (.htaccess for example)
	user> cd ..
	user> svn import -m 'Initial Import' ./ http://hostname.or.ip/svn/project
	# system will ask for svn username and password

Checkout project to web location:

	root> su - www-data
	www-data> cd /var/www/sites/{project}/
	# directory must be blank, delete contents and . files if not
	# directory must be owned by www-data user
	www-data> svn co http://hostname.or.ip/svn/{project} ./

Create auto publish post commit hook:

	root> cd /path/to/svn/repo/{project}/hooks
	root> ls post-commit

  # if file does not exist:
	root> touch post-commit
	root> vim post-commit
		i
		#!/bin/sh
		/usr/bin/svn update /var/www/sites/{project} --username www-data --password ************
		{esc}
		:wq
	root> chown www-data: post-commit
	root> chmod +x post-commit

  # if file exists:
	root> vim post-commit
		:9999999
		o
		/usr/bin/svn update /var/www/sites/{project} --username www-data --password ************
		{esc}
		:wq

Test post-commit hook:

	root> cd /path/to/svn/repo/{project}/hooks
	root> su - www-data
	www-data> env - ./post-commit
	# errors will be reported

Add project to websvn:

	root> cd /path/to/websvn/web/root/include/
	root> vim config.php
		/Local
		o
		$config->addRepository('{project name}', 'file:///path/to/svn/repo/{project}');
		{esc}
		:wq
	# Load websvn in browser and see project.

Enjoy, I will post ‘Misc subversion commands and information vol 2′ in a few weeks.

      Terry Valladon (The Dirty Troll)

Edits:

Fixed name of password file (was missing .passwd)

Technorati Tags: , , , , , , , ,

Daily system check:

root@terryvalladon> uptime
08:12:22 up 35 years,  0:00,  2 siblings, 3 child processes,  1 user, load average: 1.00, 1.00, 1.00
root@terryvalladon> dmesg
HAPPY BIRTHDAY

Yay to me! Another year older and wiser.

May you all have a happy day as well :)

Till next time, code sexy.
      Terry Valladon (The Dirty Troll)

With our last article on debugging PHP with UDP sockets we created a new class able to send debugging information from PHP to a remote netcat client. The limit of the code was that it could only send strings and not arrays or an object. Today we will modify the code to send arrays to our remote listening client.

First, I will show you what happens if we try to send an array using the UDPDEBUG class that we currently have. To do this we will create a very simple array and then attempt to send it.

 php (udptest2.phps) download
<?
	$ThisWeek = array(1 => 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday',  'Saturday', 'Sunday');

	require_once("UDPDEBUG_CLASS.php");
	$UDPDEBUG = new UDPDEBUG("127.0.0.1", 4545);
	$UDPDEBUG->SEND($ThisWeek, 'LOW', TRUE);
?>

    

This test code results in no useful information other then the fact we are dealing with an array.

Read the rest of this entry »

Technorati Tags: , , , , , ,

The nature of Internet applications creates an issue with debugging. For example, how do you debug an application that may be getting hundreds or even thousands of hits every minute? How do you debug this application without sending sensitive data to the user in the form of comments or debug statements that are “hidden” for only as long as nobody is looking for them? What do you do when you are unable to trigger an error but your user base is, though they lack the knowledge to be of much assistance other then “I borked it!”?

There are several new contenders on the debugging scene for PHP code, the most popular of which is FirePHP and their unholy union with FireBug. These two are great tools for debugging an Internet application but they both suffer from one fatal flaw in my eyes: the ability to view debugging information from anonymous Internet users.

Sure, it is a great feature to be able to hit a site and have debugging information pop up in a panel in my browser but how does that help me when dealing with users that I do not personally know? It doesn’t… Dumping data to a .log file offers several problems in and of itself, the largest of which is the rate at which said log file can reach an unwieldy size.

Another flaw in FirePHP is that sometimes you just want it short, sweet and not sent to the client. For years I have gone with a tried and true method of remote debugging which allows for me to view dumped data on a remote server. Yes, a REMOTE server… as in 3000 miles away and not in my browser.

Read the rest of this entry »

Technorati Tags: , , , , , ,