logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: How to store VirtualHosts in MySQL
Author
blaze



Joined: 14 Aug 2008
Posts: 2

PostPosted: Thu 14 Aug '08 11:22    Post subject: How to store VirtualHosts in MySQL Reply with quote

Hello!

Please, help me to solve the problem, how to store VitrualHosts in MySQL?

Apache: 2.2.9
OS: Windows

I saw that Apache has module mod_dbd, but I couldn't find any helpful information about that. If you know how does it works, or any other ways, please tell me!

Thank you!
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7371
Location: Germany, Next to Hamburg

PostPosted: Thu 14 Aug '08 17:41    Post subject: Reply with quote

There is a good how to in our forum. http://www.apachelounge.com/viewtopic.php?t=2210

if you still have a question please post here again.
Back to top
blaze



Joined: 14 Aug 2008
Posts: 2

PostPosted: Fri 15 Aug '08 11:17    Post subject: Reply with quote

Thank you!
I found that topic very useful!

But I have a question.
How can I store other parameters of VirtualHost?

For example I have this VitrualHost:
Code:
<VirtualHost example.com:80>
   ServerAdmin administrator@example.com
   ServerName example.com
   ServerAlias www.example.com

   DocumentRoot C:/Apache/htdocs/example.com/www

   <Directory C:/Apache/htdocs/example.com/www>
      AllowOverride All
   </Directory>

   php_admin_value open_basedir C:/Apache/htdocs/example.com/www
</VirtualHost>

How can I store this data in MySQL?
Back to top
tdonovan
Moderator


Joined: 17 Dec 2005
Posts: 611
Location: Milford, MA, USA

PostPosted: Sat 16 Aug '08 15:37    Post subject: Reply with quote

If you use mod_vhost_dbd, you can only set the document root from the database.

ServerAlias is easily handled by creating two rows in the database: one for example.com and another row for www.example.com.
Both should return the same document root: C:/Apache/htdocs/example.com/www.

For directives which can accept httpd environment variables, like Header and Allow from env=, you can return extra columns in your SQL queries which are converted into environment variables.

Unfortunately, PHP directives like php_admin_value can only be set at Apache startup. They cannot be changed "on-the-fly" by a module like mod_vhost_dbd. That is why you cannot put php_admin_value in a .htaccess file either.

-tom-
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7371
Location: Germany, Next to Hamburg

PostPosted: Sat 16 Aug '08 20:50    Post subject: Reply with quote

For me mod_macro was a good start for some fast standart configuration. There is only the pitty a of restart.
Back to top
randriese



Joined: 09 Sep 2008
Posts: 1

PostPosted: Tue 09 Sep '08 10:34    Post subject: Reply with quote

i'm having problems with the AllowOverride All.

i understand that the mod_vhost_dbd.so only adds the DocumentRoot, but is it also possible to add the AllowOverride directive? I really need it because otherwise this whole system doesn't work for me Sad

I need to have dynamic vhosts, based on a MySQL result and each dynamic host should read the .htaccess file in it's folder.

anyone got any idea's?
Back to top


Reply to topic   Topic: How to store VirtualHosts in MySQL View previous topic :: View next topic
Post new topic   Forum Index -> Apache