Jump to content

Domains and PHP


Darklink

Recommended Posts

Creating domains in apache can be as simple as dropping a vhost file into the correct location and restarting the server (depending on how you have setup apache's configurations). There's not really any tricks to do it via php, if you know how to create domains manually, simply write a script that follows the same steps.

Link to comment
https://forums.phpfreaks.com/topic/115080-domains-and-php/#findComment-591822
Share on other sites

Restart the server!? How come cPanel is able to acomplish this without having to restart the server (or am I deeply mistakened)?

I just want to put addon domains for different users automatically via PHP as they submit them and change their nameservers.

 

I'm guessing I would have to create a desktop application and then use exec() to call it to do the job? I'm not looking for any quick tricks in PHP to do this as I know it will mean work and I am willing to spend time into researching and doing this properly along with the rest of the project I am doing.

 

:)

Link to comment
https://forums.phpfreaks.com/topic/115080-domains-and-php/#findComment-591828
Share on other sites

Restart the server!? How come cPanel is able to acomplish this without having to restart the server (or am I deeply mistakened)?

I just want to put addon domains for different users automatically via PHP as they submit them and change their nameservers.

 

I'm guessing I would have to create a desktop application and then use exec() to call it to do the job? I'm not looking for any quick tricks in PHP to do this as I know it will mean work and I am willing to spend time into researching and doing this properly along with the rest of the project I am doing.

 

:)

I'm sure cpanel does restart apache when a new domain is added.

Link to comment
https://forums.phpfreaks.com/topic/115080-domains-and-php/#findComment-591839
Share on other sites

Okay, that's given me a more clearer view.

 

I see that the VirtualHost containers are put into the httpd.conf file. Can any of the information in this file be altered and overwritten using .htaccess.

 

If that's the case, I think I know what I can do from here on in. I can just add more VirtualHost containers in the .htaccess automatically using PHP (remembering to set permissions safely and putting extra security measures in obviously). I don't think there would be anything else.

 

I would have to make sure that .htaccess overwrites any configuration settings which I think you can set somewhere.

 

Please correct me if I'm wrong, although I believe I will speak to you soon on MSN. :)

 

Thanks for your help.

Link to comment
https://forums.phpfreaks.com/topic/115080-domains-and-php/#findComment-591919
Share on other sites

If you do a little research on vhost containers.. and ways of storing them outside of the .conf files you dont need to restart apache. I cant remember what its called exactly but there is a method of storing flat files on a domain basis in a directory (for orginizational purposes) that will just read as they are put in.. you would put your vhost directives in the files per domain.. and upon that it would be live, pending theres no errors in the vhost containers.

Link to comment
https://forums.phpfreaks.com/topic/115080-domains-and-php/#findComment-591928
Share on other sites

If your going to go down the mod_vhost_alias route (which it seems you should) you do not need to define separate vhosts, even if you could, they cannot be defined in a .htaccess file. A .htaccess file only effects the directory it is in.

 

Also, as I hinted at in my first post there are many different ways to setup apache for easy configuration. You don't necessarily need to define vhosts within the main httpd.conf file, there are easier ways.

Link to comment
https://forums.phpfreaks.com/topic/115080-domains-and-php/#findComment-592027
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.