You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modules-dev@httpd.apache.org by Jorge Bastos <my...@decimal.pt> on 2009/02/14 23:33:51 UTC

mod_vhost_dbd

Hi people,

I just signed up, to report a typo.

 

http://modules.apache.org/search.php?id=1753

 

the link is broken.

I'd love to test this, I'm looking for it for some time.

Is the maintainer out there? J

 

Jorge


RE: mod_vhost_dbd

Posted by Jorge Bastos <my...@decimal.pt>.
> > I'm just curious, libmysql shouldn't be linked agains the .so module
> Nope - it uses the built-in APR DBD in Apache, which already links
> against MySQL.
> 

Oh right. Stupid question, and I saw it on the source the apr_dbd, I'm
sleepy :|
I do use mod_dbd for http auth, stupid question :P

Ok going to test this and let you know the success/something not right with
it.
Thank's a lot Dave.

Jorge


Re: mod_vhost_dbd

Posted by Dave Ingram <da...@dmi.me.uk>.
Jorge Bastos wrote:
> Sorry about apxs.
>   
That's fine -- everyone has to learn somewhere.

> I'm just curious, libmysql shouldn't be linked agains the .so module
Nope - it uses the built-in APR DBD in Apache, which already links
against MySQL.


Dave

RE: mod_vhost_dbd

Posted by Jorge Bastos <my...@decimal.pt>.
> 
> Erm. I think all you need to use is:
> 
> apxs2 -i -c mod_sqltemplate.c
> 
> as root, to compile and install in one step. Don't forget to add the
> LoadModule line!

I won't!

Sorry about apxs.
I'm just curious, libmysql shouldn't be linked agains the .so module?


Re: mod_vhost_dbd

Posted by Dave Ingram <da...@dmi.me.uk>.
Jorge Bastos wrote:
> Dave,
> You could have a Install.txt file to explain how to compile.
> I'm not very familiar with apxs2 :)
>
> Can you post here?
>   

Erm. I think all you need to use is:

apxs2 -i -c mod_sqltemplate.c

as root, to compile and install in one step. Don't forget to add the
LoadModule line!


Dave

RE: mod_vhost_dbd

Posted by Jorge Bastos <my...@decimal.pt>.
Dave,
You could have a Install.txt file to explain how to compile.
I'm not very familiar with apxs2 :)

Can you post here?


RE: mod_vhost_dbd

Posted by Jorge Bastos <my...@decimal.pt>.
> Yup. I place no restrictions at all. It doesn't even have to be a
> single
> table -- it can be the result of a multi-table join, as long as all of
> the columns have different names. They can be renamed using "AS", like
> "SELECT a.id, a.name, h.name AS hname FROM table1 a, table2 h" for
> example, which would then be accessed as ${id}, ${name}, ${hname}. Take
> a quick glance at the sample configuration
> <http://www.dmi.me.uk/code/apache/mod_sqltemplate/99_mod_sqltemplate.co
> nf>
> from the mod_sqltemplate site.

Good!

> 
> It can be from anything that can send Apache a signal (USR1 causes a
> graceful restart) as well. Running apache2ctl can be done from anything
> that has the right permissions to signal Apache.

Hum... I'll have to do something with netcat or so, because the web
interface that will manage the sql records, will be on another server.
Not a big problem.

> You can leave your existing configuration files and create a completely
> new one that handles all of your new virtualhosts.

Great!


Re: mod_vhost_dbd

Posted by Dave Ingram <da...@dmi.me.uk>.
Jorge Bastos wrote:
>> This is possible using mod_sqltemplate. Suppose in your database, you
>> have a "php_register_globals" column, which is either "On" or "Off".
>> Then this will work:
>>
>> [snip]
>
> So I think my problem is resolved!
> Resuming, I can have as many columns I want in the hosts table, correct? If
> so, I can have the config I want!!! That's fantastic, I've been looking for
> something like this for some years!
>   
Yup. I place no restrictions at all. It doesn't even have to be a single
table -- it can be the result of a multi-table join, as long as all of
the columns have different names. They can be renamed using "AS", like
"SELECT a.id, a.name, h.name AS hname FROM table1 a, table2 h" for
example, which would then be accessed as ${id}, ${name}, ${hname}. Take
a quick glance at the sample configuration
<http://www.dmi.me.uk/code/apache/mod_sqltemplate/99_mod_sqltemplate.conf>
from the mod_sqltemplate site.

>> You can tell Apache to perform a config reload (e.g. via apache2ctl
>> graceful), which will force the configuration to be re-read from the
>> database.
>>     
>
> Hum but this only via commandline correct?
>   
It can be from anything that can send Apache a signal (USR1 causes a
graceful restart) as well. Running apache2ctl can be done from anything
that has the right permissions to signal Apache.

As an incidental note, I'm planning on writing a PHP patch that allows
you to force Apache to do a graceful restart, but I haven't had the time
to think about the best way to do this yet.

> Another thing, apache read's this, when it loads and stays with this info on
> memory correct?
>   
That's correct.

> The existing virtualhosts that I have, I can leave that intact, and start
> using the new virtualhosts with this configuration, correct?
>   
You can leave your existing configuration files and create a completely
new one that handles all of your new virtualhosts.


Dave

RE: mod_vhost_dbd

Posted by Jorge Bastos <my...@decimal.pt>.
> Thanks -- it's always nice to be appreciated. Let me know if you hit
> any
> problems, as I don't have the resources to test it in lots of different
> situations.

I'll :)

> This is possible using mod_sqltemplate. Suppose in your database, you
> have a "php_register_globals" column, which is either "On" or "Off".
> Then this will work:
> 
> <SQLRepeat ".... blah sql to select virtualhosts... ">
> <VirtualHost *:80>
> # ...
> php_flag register_globals ${php_register_globals}
> # ...
> </VirtualHost>
> </SQLRepeat>
> 
> > When I say this values for php, it may happen that other ones appear.
> >
> You can use a similar method for any directives. You can even have
> fully
> custom directives:
> 
> <SQLRepeat...>
> <VirtualHost *:80>
> #...
> ${custom}
> #...
> </VirtualHost>
> </SQLRepeat>

So I think my problem is resolved!
Resuming, I can have as many columns I want in the hosts table, correct? If
so, I can have the config I want!!! That's fantastic, I've been looking for
something like this for some years!

> You can tell Apache to perform a config reload (e.g. via apache2ctl
> graceful), which will force the configuration to be re-read from the
> database.

Hum but this only via commandline correct?



Another thing, apache read's this, when it loads and stays with this info on
memory correct?
The existing virtualhosts that I have, I can leave that intact, and start
using the new virtualhosts with this configuration, correct?


Re: mod_vhost_dbd

Posted by Dave Ingram <da...@dmi.me.uk>.
Jorge Bastos wrote:
> Hi again Dave,
>
> Your is better than dbd!
>   
Thanks -- it's always nice to be appreciated. Let me know if you hit any
problems, as I don't have the resources to test it in lots of different
situations.

> I just see a problem for me, I have the need to tune values for php
> configuration, for example:
>
> Vhost 1, needs register_globals off (php_admin_value register_globals off)
> Vhost 2, needs register_globals on  (php_admin_value register_globals on)
>
> This is something that won't be possible at the moment.
> Did you ever think in a way to make this possible?
>   
This is possible using mod_sqltemplate. Suppose in your database, you
have a "php_register_globals" column, which is either "On" or "Off".
Then this will work:

<SQLRepeat ".... blah sql to select virtualhosts... ">
<VirtualHost *:80>
# ...
php_flag register_globals ${php_register_globals}
# ...
</VirtualHost>
</SQLRepeat>

> When I say this values for php, it may happen that other ones appear.
>   
You can use a similar method for any directives. You can even have fully
custom directives:

<SQLRepeat...>
<VirtualHost *:80>
#...
${custom}
#...
</VirtualHost>
</SQLRepeat>

In this case, the "custom" column can contain anything from an empty
string to a single directive, to a set of directives.

Does this help?

> Another question, when I delete/create a record in the DB, it's required a
> apache restart or it knows when a request is done?
>   
You can tell Apache to perform a config reload (e.g. via apache2ctl
graceful), which will force the configuration to be re-read from the
database.


Dave

RE: mod_vhost_dbd

Posted by Jorge Bastos <my...@decimal.pt>.
> Hi dave,
> Thanks,
> 
> I'm looking at your proj also.
> 
> What I am looking is, a completely independent module, so that I can
> create,
> decreate any virtualhost, just inserting and removing records from the
> DB.
> The values can be apache configurations, or any other.
> Yours can? I didn't got time to look at it.
> 
> 

Hi again Dave,

Your is better than dbd!
I just see a problem for me, I have the need to tune values for php
configuration, for example:

Vhost 1, needs register_globals off (php_admin_value register_globals off)
Vhost 2, needs register_globals on  (php_admin_value register_globals on)

This is something that won't be possible at the moment.
Did you ever think in a way to make this possible?
When I say this values for php, it may happen that other ones appear.

Another question, when I delete/create a record in the DB, it's required a
apache restart or it knows when a request is done?


What do you say?

Jorge,


RE: mod_vhost_dbd

Posted by Jorge Bastos <my...@decimal.pt>.
Hi dave,
Thanks,

I'm looking at your proj also.

What I am looking is, a completely independent module, so that I can create,
decreate any virtualhost, just inserting and removing records from the DB.
The values can be apache configurations, or any other.
Yours can? I didn't got time to look at it.




> -----Original Message-----
> From: Dave Ingram [mailto:dave@dmi.me.uk]
> Sent: domingo, 15 de Fevereiro de 2009 20:03
> To: modules-dev@httpd.apache.org
> Subject: Re: mod_vhost_dbd
> 
> Hi Jorge,
> 
> Something with the same name:
> 
> http://code.google.com/p/dbd-modules/wiki/mod_vhost_dbd
> 
> <self-promotion>
> I don't know if that's what you're after, but I've written something
> vaguely similar but more flexible:
> 
> http://www.dmi.me.uk/code/apache/mod_sqltemplate/
> </self-promotion>
> 
> Hope this helps!
> 
> 
> Dave
> 
> 
> Jorge Bastos wrote:
> > Hi people,
> >
> > I just signed up, to report a typo.
> >
> >
> >
> > http://modules.apache.org/search.php?id=1753
> >
> >
> >
> > the link is broken.
> >
> > I'd love to test this, I'm looking for it for some time.
> >
> > Is the maintainer out there? J
> >
> >
> >
> > Jorge
> >
> >
> >



Re: mod_vhost_dbd

Posted by Dave Ingram <da...@dmi.me.uk>.
Hi Jorge,

Something with the same name:

http://code.google.com/p/dbd-modules/wiki/mod_vhost_dbd

<self-promotion>
I don't know if that's what you're after, but I've written something
vaguely similar but more flexible:

http://www.dmi.me.uk/code/apache/mod_sqltemplate/
</self-promotion>

Hope this helps!


Dave


Jorge Bastos wrote:
> Hi people,
>
> I just signed up, to report a typo.
>
>  
>
> http://modules.apache.org/search.php?id=1753
>
>  
>
> the link is broken.
>
> I'd love to test this, I'm looking for it for some time.
>
> Is the maintainer out there? J
>
>  
>
> Jorge
>
>
>