I am a newbie, but learning fast. I have an application where I need to create subdomains on my domain for use by registered users and then allow the public to view the contents of those subdomains via "www.subdomain.mydomain.com"
I've found success creating the subdomains and inserting an "index.php", but I'm doing something wrong in creating the symlink to the subdirectory. Below is the code. Any help is much appreciated.
$new_directory = "$newname";
//CREATE DIRECTORY
mkdir("/htdocs/$new_directory", 0755);
//CREATE LINK TO DIRECTORY
symlink("/htdocs/$new_directory", "/htdocs/www.$new_directory");
//CREATE HOMEPAGE FILE
$create_file = fopen("/htdocs/$new_directory/index.php", "w+");
//CREATE CONTENT OF HOMEPAGE FILE THAT INSERTS STANDARD WEBPAGE
$content = "content";
//WRITE CONTENT INTO NEWLY CREATED FILE
$write_file = fputs($create_file, $content);
//CLOSE FILE POINTER TO PREVENT PROBLEMS
fclose($create_file);