There seems to be a lot of questions about stored procedures in PHP5 / mySQL5, and I struggled with some of the caveats myself, especially the dreaded "server has gone away" message. However, I think I've got it worked out, and I've outlined my findings at the link below. I hope it saves someone some headache:
http://jimkeller.blogspot.com/2006/11/mysql-server-has-gone-away-in-php-when.html