JustinK101 Posted February 5, 2008 Share Posted February 5, 2008 Hello, I am running Linux with PHP5 and cPanel. I need a script which does the following file work: 1.) Goes to the root http directory /. 2.) First looks if there is a folder called 'customerXYZ' 3.) If no folder called 'customerXYZ' then create it. ELSE output an error message. 4.) Create a symbolic link from folder 'customerXYZ' to another folder I have already created, lets call it 'software'. If possible but I suspect not, create a subdomain in cPanel with name customerXYZ.mydomain.com which points to the logical folder 'customerXYZ'. Thanks for the help guys. Quote Link to comment https://forums.phpfreaks.com/topic/89465-creating-folders-and-symbolic-links/ Share on other sites More sharing options...
JustinK101 Posted February 5, 2008 Author Share Posted February 5, 2008 Here is what I created. Everything works great except the auto create of a cPanel subdomain. I am thinking it can be done using exec("SOME APPLICATION CALL AND ARGUMENTS HERE"). Anybody have ideas? function setup_client($dir_name, $symbolic_link_path) { global $error_text; $prev_umask = umask(0); try { if(@file_exists($dir_name)) { throw new Exception("ERROR: Directory '" . $dir_name . "' already exists; cannot create duplicates.\\n\\n" . $error_text); } if(@!symlink($symbolic_link_path, $dir_name)) { throw new Exception("ERROR: Failed to create symbolic link '" . $dir_name . "'.\\n\\n" . $error_text); } } catch (Exception $e) { $msg = new alert($e->getMessage()); echo $msg->display(); } umask($prev_umask); } Quote Link to comment https://forums.phpfreaks.com/topic/89465-creating-folders-and-symbolic-links/#findComment-458309 Share on other sites More sharing options...
priti Posted February 5, 2008 Share Posted February 5, 2008 this may be useful http://www.zubrag.com/scripts/cpanel-subdomains-creator.php Quote Link to comment https://forums.phpfreaks.com/topic/89465-creating-folders-and-symbolic-links/#findComment-458334 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.