How to let PHP to create subdomain automatically for each user?
You're looking to create a custom A record.
I'm pretty sure that you can use wildcards when specifying A records which would let you do something like this:
*.mywebsite.example IN A 127.0.0.1
127.0.0.1
would be the IP address of your webserver. The method of actually adding the record will depend on your host.
Doing it like http://mywebsite.example/user
would be a lot easier to set up if it's an option.
Then you could just add a .htaccess
file that looks like this:
Options +FollowSymLinks
RewriteEngine On
RewriteRule ^([aA-zZ])$ dostuff.php?username=$1
In the above, usernames are limited to the characters a-z
The rewrite rule for grabbing the subdomain would look like this:
RewriteCond %{HTTP_HOST} ^(^.*)\.mywebsite.example
RewriteRule (.*) dostuff.php?username=%1
However, you don't really need any rewrite rules. The HTTP_HOST header is available in PHP as well, so you can get it already, like
$username = strtok($_SERVER['HTTP_HOST'], ".");
When you auto-create subdomains on user signup does it create a new website or gives appearance of a website?
Others have answered the main points of your question, but I did want to touch on what you call the "illusion" of a website.
There are a few different ways to serve a given application in a domain, subdomain or directory, from static files, to a single file handling every request no matter what path or domain was requested. No method is more or less "real" than any other. The only method I would call an "illusion" would be a website masked behind another website using frames, which is generally a Really Bad Idea. (Try bookmarking on a site where the URL doesn't change as you click around.)
Related Topics
Check If PHP Session Has Already Started
How to Implement a Good Profanity Filter
Convert Seconds to Hour:Minute:Second
How to Make Asynchronous Http Requests in PHP
How to Maintain a "Version For the Server" - With Only Config Files Changed, in Git
Sort Array of Objects by One Property
How to Retrieve Images from MySQL Database and Display in an HTML Tag
Detect Encoding and Make Everything Utf-8
How to Remove Duplicate Values from an Array in PHP
Parse Query String into an Array
Parse Error: Syntax Error, Unexpected End of File in My PHP Code
Gcm With PHP (Google Cloud Messaging)
500 Internal Server Error For PHP File Not For Html
How to Send 100,000 Emails Weekly