Creating subdomains using php is a tricky business. If you want to allow users to access their personal URL, the subdomains must be created first. If you want to automate that process, either as part of registration, or created by the admin through your website, you will need to configure your server settings (primarily httpd.conf, assuming you're on an apache server) plus a php script. I myself have tried
this script
. It's very good, and it's proven to work (but you may need to tweak it a little to suit your needs).