One of the annoying issues with force.com sites is creating a portal user whether it is a person account or business account. The real issue is the method which is SIte.createPersonAccount which just returns null giving no clues on debugging the cause of it. The irony is that salesforce support does not have a clue on this as well. I had dealt with this a lot and so here are some possible solutions.
There are 3 steps to create a portal user using code. One is to read the form variables on your registration, associate it with a new user object, insert an account or person account and then call the site.createperson account to associate the user with the portal account. When ever, this method returns null, Here are things you should check on your end.
a. Go to sites detailed page which you can find by navigating to setup and find sites and click on the label. Make sure the guest user profile which can be found out by clicking on public access settings has account and contact standard objects with read, edit permissions on them.
b. On the create portal user, you have a owner id which you need to use in the method. Write a query for system administrators profile for users who have a role id and use the user id of only system administrator profile with a Role in them and assign it to the owner id variable. If you just have a system administrator profile with no Role, it will fail.
c. If you still have a problem and let us say the account creation worked but not the site.createPerson account did not, then login to the org and go to the account detailed page. You should see the account has an owner which is guest user account and if you click on enable for customer portal, then you would see that it will fail with an error message which is owner does not have a role. Now change the owner to a system administrator user who has a role and now click on enable customer portal which would solve issues. This technique would help in solving the owner id to use in the site.createuser method.
d. If it still does not solve your problem, now check on the profile for your authenticated sites user. You can see this by clicking on site detailed page and looking at the profile associated with creating the new user. Now go to customer portal settings and click on the customer portal settings detailed page. Check under profile section and ensure that the profile of the authenticated user is added to the customer portal. If this is not enabled, then the site.create portal user will fail.
So these are the 4 things which you can do to solve the weird site.createpersonaccount failure. Just to summarize. Check on public profile of the guest user, ensure you use an owner id with a role, customer portal has the profile of the authenticated user would help you to debug this issue quick. Please let me know what other techniques you used to solve the weird issue. Hope salesforce throws an exception in the future which would go a long way to solve the problem.