forcing apache to process files read from a database by php

forcing apache to process files read from a database by php

am 24.06.2002 16:21:22 von Dean Grant

I am trying to build an application that stores a website entirely
within a database. There is no problem processing plain-text and html
documents, but I need to find a way to utilize apache in
processing/parsing the more complicated files that I read out with php
(ie. .pl .pdf, etc.) so that they are treated properly by the web
browser. Can anyone think of something that might allow me to do this?
The whole idea is to keep the database activity transparent to the user
so that it appears they are surfing a typical website.

Thanks,

Dean

Re: forcing apache to process files read from a database by php

am 24.06.2002 16:43:16 von Dmitry Medvedev

Please, give more detailed info regarding what you are doing and what the
Apache should do or not do.
============================================================ ================
===
----- Original Message -----
From: "Dean Grant"
To:
Sent: Monday, June 24, 2002 6:21 PM
Subject: forcing apache to process files read from a database by php


> I am trying to build an application that stores a website entirely
> within a database. There is no problem processing plain-text and html
> documents, but I need to find a way to utilize apache in
> processing/parsing the more complicated files that I read out with php
> (ie. .pl .pdf, etc.) so that they are treated properly by the web
> browser. Can anyone think of something that might allow me to do this?
> The whole idea is to keep the database activity transparent to the user
> so that it appears they are surfing a typical website.
>
> Thanks,
>
> Dean
>
>
> ------------------------------------------------------------ ---------
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>

RE: forcing apache to process files read from a database by php

am 24.06.2002 16:56:07 von Dean Grant

Ok, I apologize if I did not give adequate information.

I have a database that stores files in binary form. I have a PHP script
that, depending on a URL request, will grab one of the files and attempt
to display it in the browser. The problem is that PHP is not Apache.
There are certain types of files that are treated in a special way by
Apache - such as scripts (cgi, php, asp, etc.). Apache knows where the
perl and php interpreters are located and how to use them. What I
require is a way to feed the files from the database into Apache so that
Apache treats the file as though it was read from the file system like
usual. I thought about creating a temporary file and directing Apache
to that file, but it kind of defeats the idea I'm aiming for - which is
to store a website in a database.

I hope this sheds a bit more light on the situation. If there are
specifics that I am forgetting or other details you are curious about
please let me know.

Thanks again,

Dean

-----Original Message-----
From: Dmitry Medvedev [mailto:medvedev@rsdsoft.msk.ru]
Sent: Monday, June 24, 2002 9:43 AM
To: users@httpd.apache.org
Subject: Re: forcing apache to process files read from a database by php

Please, give more detailed info regarding what you are doing and what
the
Apache should do or not do.
============================================================ ============
====
===
----- Original Message -----
From: "Dean Grant"
To:
Sent: Monday, June 24, 2002 6:21 PM
Subject: forcing apache to process files read from a database by php


> I am trying to build an application that stores a website entirely
> within a database. There is no problem processing plain-text and html
> documents, but I need to find a way to utilize apache in
> processing/parsing the more complicated files that I read out with php
> (ie. .pl .pdf, etc.) so that they are treated properly by the web
> browser. Can anyone think of something that might allow me to do
this?
> The whole idea is to keep the database activity transparent to the
user
> so that it appears they are surfing a typical website.
>
> Thanks,
>
> Dean
>
>
> ------------------------------------------------------------ ---------
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>



------------------------------------------------------------ ---------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org

Re: forcing apache to process files read from a database by php

am 24.06.2002 17:08:13 von Andrew Hawkes

On Mon, 24 Jun 2002 09:56:07 -0500
"Dean Grant" wrote:

> Ok, I apologize if I did not give adequate information.
>
> I have a database that stores files in binary form. I have a PHP script
> that, depending on a URL request, will grab one of the files and attempt
> to display it in the browser. The problem is that PHP is not Apache.
> There are certain types of files that are treated in a special way by
> Apache - such as scripts (cgi, php, asp, etc.). Apache knows where the
> perl and php interpreters are located and how to use them. What I
> require is a way to feed the files from the database into Apache so that
> Apache treats the file as though it was read from the file system like
> usual. I thought about creating a temporary file and directing Apache
> to that file, but it kind of defeats the idea I'm aiming for - which is
> to store a website in a database.

Why is the PHP script solution unsatisfactory? It sounds a lot more simple
than any alternative I know.

Also, if you don't mind telling, why do you want to store the entire site
in a database? That doesn't really make sense to me since filesystems seem
to work so nicely for that purpose.

Anyway, it sounds if you really want to do this you'll need to write an
Apache module (there are some books on that subject). The module would
need to somehow translate URLs into a SQL statement and then select
each file from the database, writing it to the client.

-Andy

RE: forcing apache to process files read from a database by php

am 24.06.2002 18:03:24 von Dean Grant

I understand that, for the moment, storing and distributing a website
from a database is not as fast or efficient as running from the file
system. But, I do believe that, eventually, the speed gap will be
reduced sufficiently that the difference will be negligible. Currently,
my reasons for wanting things done in this manner are two-fold:

1. To increase organization and allow inherent searching abilities of
the
web site without the need of a crawler.

2. To see if it can be done.

Dean



-----Original Message-----
From: Andrew Hawkes [mailto:ahawkes@unicon.net]
Sent: Monday, June 24, 2002 10:08 AM
To: users@httpd.apache.org
Subject: Re: forcing apache to process files read from a database by php

On Mon, 24 Jun 2002 09:56:07 -0500
"Dean Grant" wrote:

> Ok, I apologize if I did not give adequate information.
>
> I have a database that stores files in binary form. I have a PHP
script
> that, depending on a URL request, will grab one of the files and
attempt
> to display it in the browser. The problem is that PHP is not Apache.
> There are certain types of files that are treated in a special way by
> Apache - such as scripts (cgi, php, asp, etc.). Apache knows where
the
> perl and php interpreters are located and how to use them. What I
> require is a way to feed the files from the database into Apache so
that
> Apache treats the file as though it was read from the file system like
> usual. I thought about creating a temporary file and directing Apache
> to that file, but it kind of defeats the idea I'm aiming for - which
is
> to store a website in a database.

Why is the PHP script solution unsatisfactory? It sounds a lot more
simple
than any alternative I know.

Also, if you don't mind telling, why do you want to store the entire
site
in a database? That doesn't really make sense to me since filesystems
seem
to work so nicely for that purpose.

Anyway, it sounds if you really want to do this you'll need to write an
Apache module (there are some books on that subject). The module would
need to somehow translate URLs into a SQL statement and then select
each file from the database, writing it to the client.

-Andy

------------------------------------------------------------ ---------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org

Re: forcing apache to process files read from a database by php

am 24.06.2002 21:34:33 von Andrew Hawkes

All right, that makes sense - it is an interesting idea.

If I were you I'd write a module. I think the book I've seen is "Writing
Apache Modules in Perl and C", an O'Reilly book. I've never written an
Apache module but get the idea it isn't terribly hard.

Would you put all pages in a single flat table, or concoct some kind of
tree representation? Either way, it seems your module would have to do
this:

1. Translate the URI into a SQL query.
2. Perform the query and extract the requested "page".
3. Spit out the page to the client.

-Andy


On Mon, 24 Jun 2002 11:03:24 -0500
"Dean Grant" wrote:

> I understand that, for the moment, storing and distributing a website
> from a database is not as fast or efficient as running from the file
> system. But, I do believe that, eventually, the speed gap will be
> reduced sufficiently that the difference will be negligible. Currently,
> my reasons for wanting things done in this manner are two-fold:
>
> 1. To increase organization and allow inherent searching abilities of
> the
> web site without the need of a crawler.
>
> 2. To see if it can be done.
>
> Dean
>
>
>
> -----Original Message-----
> From: Andrew Hawkes [mailto:ahawkes@unicon.net]
> Sent: Monday, June 24, 2002 10:08 AM
> To: users@httpd.apache.org
> Subject: Re: forcing apache to process files read from a database by php
>
> On Mon, 24 Jun 2002 09:56:07 -0500
> "Dean Grant" wrote:
>
> > Ok, I apologize if I did not give adequate information.
> >
> > I have a database that stores files in binary form. I have a PHP
> script
> > that, depending on a URL request, will grab one of the files and
> attempt
> > to display it in the browser. The problem is that PHP is not Apache.
> > There are certain types of files that are treated in a special way by
> > Apache - such as scripts (cgi, php, asp, etc.). Apache knows where
> the
> > perl and php interpreters are located and how to use them. What I
> > require is a way to feed the files from the database into Apache so
> that
> > Apache treats the file as though it was read from the file system like
> > usual. I thought about creating a temporary file and directing Apache
> > to that file, but it kind of defeats the idea I'm aiming for - which
> is
> > to store a website in a database.
>
> Why is the PHP script solution unsatisfactory? It sounds a lot more
> simple
> than any alternative I know.
>
> Also, if you don't mind telling, why do you want to store the entire
> site
> in a database? That doesn't really make sense to me since filesystems
> seem
> to work so nicely for that purpose.
>
> Anyway, it sounds if you really want to do this you'll need to write an
> Apache module (there are some books on that subject). The module would
> need to somehow translate URLs into a SQL statement and then select
> each file from the database, writing it to the client.
>
> -Andy
>
> ------------------------------------------------------------ ---------
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>
> ------------------------------------------------------------ ---------
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>

Re: forcing apache to process files read from a database by php

am 24.06.2002 21:40:19 von Saqib.N.Ali

Hi
Take a look at Wiki. http://c2.com/cgi/wiki

I think Wiki has similar functionality to what you are looking for.

In Peace,
Saqib Ali

Rid yourself of all thoughts!
Think of the One who created thought.




Andrew Hawkes
on.net> cc:
No Phone Info Subject: Re: forcing apache to process files read from a database by
Available php

06/24/2002
12:34 PM
Please
respond to
users






All right, that makes sense - it is an interesting idea.

If I were you I'd write a module. I think the book I've seen is "Writing
Apache Modules in Perl and C", an O'Reilly book. I've never written an
Apache module but get the idea it isn't terribly hard.

Would you put all pages in a single flat table, or concoct some kind of
tree representation? Either way, it seems your module would have to do
this:

1. Translate the URI into a SQL query.
2. Perform the query and extract the requested "page".
3. Spit out the page to the client.

-Andy


On Mon, 24 Jun 2002 11:03:24 -0500
"Dean Grant" wrote:

> I understand that, for the moment, storing and distributing a website
> from a database is not as fast or efficient as running from the file
> system. But, I do believe that, eventually, the speed gap will be
> reduced sufficiently that the difference will be negligible. Currently,
> my reasons for wanting things done in this manner are two-fold:
>
> 1. To increase organization and allow inherent searching abilities of
> the
> web site without the need of a crawler.
>
> 2. To see if it can be done.
>
> Dean
>
>
>
> -----Original Message-----
> From: Andrew Hawkes [mailto:ahawkes@unicon.net]
> Sent: Monday, June 24, 2002 10:08 AM
> To: users@httpd.apache.org
> Subject: Re: forcing apache to process files read from a database by php
>
> On Mon, 24 Jun 2002 09:56:07 -0500
> "Dean Grant" wrote:
>
> > Ok, I apologize if I did not give adequate information.
> >
> > I have a database that stores files in binary form. I have a PHP
> script
> > that, depending on a URL request, will grab one of the files and
> attempt
> > to display it in the browser. The problem is that PHP is not Apache.
> > There are certain types of files that are treated in a special way by
> > Apache - such as scripts (cgi, php, asp, etc.). Apache knows where
> the
> > perl and php interpreters are located and how to use them. What I
> > require is a way to feed the files from the database into Apache so
> that
> > Apache treats the file as though it was read from the file system like
> > usual. I thought about creating a temporary file and directing Apache
> > to that file, but it kind of defeats the idea I'm aiming for - which
> is
> > to store a website in a database.
>
> Why is the PHP script solution unsatisfactory? It sounds a lot more
> simple
> than any alternative I know.
>
> Also, if you don't mind telling, why do you want to store the entire
> site
> in a database? That doesn't really make sense to me since filesystems
> seem
> to work so nicely for that purpose.
>
> Anyway, it sounds if you really want to do this you'll need to write an
> Apache module (there are some books on that subject). The module would
> need to somehow translate URLs into a SQL statement and then select
> each file from the database, writing it to the client.
>
> -Andy
>
> ------------------------------------------------------------ ---------
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>
> ------------------------------------------------------------ ---------
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>

------------------------------------------------------------ ---------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org

RE: forcing apache to process files read from a database by php

am 24.06.2002 21:59:53 von Dean Grant

Right now I have been doing some testing of various other components of
the system I want to build. The table structure is as follows:

Files table
-file id
-filename
-etc

Directories table
-dir id
-dir name

Contains table
-parent id
-child id
-child type (file or directory)

In other words.....tree format.

-----Original Message-----
From: Andrew Hawkes [mailto:ahawkes@unicon.net]
Sent: Monday, June 24, 2002 2:35 PM
To: users@httpd.apache.org
Subject: Re: forcing apache to process files read from a database by php

All right, that makes sense - it is an interesting idea.

If I were you I'd write a module. I think the book I've seen is "Writing
Apache Modules in Perl and C", an O'Reilly book. I've never written an
Apache module but get the idea it isn't terribly hard.

Would you put all pages in a single flat table, or concoct some kind of
tree representation? Either way, it seems your module would have to do
this:

1. Translate the URI into a SQL query.
2. Perform the query and extract the requested "page".
3. Spit out the page to the client.

-Andy


On Mon, 24 Jun 2002 11:03:24 -0500
"Dean Grant" wrote:

> I understand that, for the moment, storing and distributing a website
> from a database is not as fast or efficient as running from the file
> system. But, I do believe that, eventually, the speed gap will be
> reduced sufficiently that the difference will be negligible.
Currently,
> my reasons for wanting things done in this manner are two-fold:
>
> 1. To increase organization and allow inherent searching abilities of
> the
> web site without the need of a crawler.
>
> 2. To see if it can be done.
>
> Dean
>
>
>
> -----Original Message-----
> From: Andrew Hawkes [mailto:ahawkes@unicon.net]
> Sent: Monday, June 24, 2002 10:08 AM
> To: users@httpd.apache.org
> Subject: Re: forcing apache to process files read from a database by
php
>
> On Mon, 24 Jun 2002 09:56:07 -0500
> "Dean Grant" wrote:
>
> > Ok, I apologize if I did not give adequate information.
> >
> > I have a database that stores files in binary form. I have a PHP
> script
> > that, depending on a URL request, will grab one of the files and
> attempt
> > to display it in the browser. The problem is that PHP is not
Apache.
> > There are certain types of files that are treated in a special way
by
> > Apache - such as scripts (cgi, php, asp, etc.). Apache knows where
> the
> > perl and php interpreters are located and how to use them. What I
> > require is a way to feed the files from the database into Apache so
> that
> > Apache treats the file as though it was read from the file system
like
> > usual. I thought about creating a temporary file and directing
Apache
> > to that file, but it kind of defeats the idea I'm aiming for - which
> is
> > to store a website in a database.
>
> Why is the PHP script solution unsatisfactory? It sounds a lot more
> simple
> than any alternative I know.
>
> Also, if you don't mind telling, why do you want to store the entire
> site
> in a database? That doesn't really make sense to me since filesystems
> seem
> to work so nicely for that purpose.
>
> Anyway, it sounds if you really want to do this you'll need to write
an
> Apache module (there are some books on that subject). The module would
> need to somehow translate URLs into a SQL statement and then select
> each file from the database, writing it to the client.
>
> -Andy
>
> ------------------------------------------------------------ ---------
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>
> ------------------------------------------------------------ ---------
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>

------------------------------------------------------------ ---------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org

Re: forcing apache to process files read from a database by php

am 25.06.2002 07:52:18 von Robert Andersson

Perhaps I've misunderstood you, but is the problem the "special" files, like
CGI, PHP, SHTML, etc?
I don't think writing a new module would help, if you want these files to
execute, as they are interpreted by external programs.
Hmm, although (I just thought of this now), you could probably, if you make
or modify a module, have, say, a perl script parsed by STDIN to the perl
interpreter, and perhaps you could something similar for other types...

Sorry, this message got screwed up ;-)

Regards,
Robert Andersson

----- Original Message -----
From: "Dean Grant"
To:
Sent: Monday, June 24, 2002 4:56 PM
Subject: RE: forcing apache to process files read from a database by php


> Ok, I apologize if I did not give adequate information.
>
> I have a database that stores files in binary form. I have a PHP script
> that, depending on a URL request, will grab one of the files and attempt
> to display it in the browser. The problem is that PHP is not Apache.
> There are certain types of files that are treated in a special way by
> Apache - such as scripts (cgi, php, asp, etc.). Apache knows where the
> perl and php interpreters are located and how to use them. What I
> require is a way to feed the files from the database into Apache so that
> Apache treats the file as though it was read from the file system like
> usual. I thought about creating a temporary file and directing Apache
> to that file, but it kind of defeats the idea I'm aiming for - which is
> to store a website in a database.
>
> I hope this sheds a bit more light on the situation. If there are
> specifics that I am forgetting or other details you are curious about
> please let me know.
>
> Thanks again,
>
> Dean
>
> -----Original Message-----
> From: Dmitry Medvedev [mailto:medvedev@rsdsoft.msk.ru]
> Sent: Monday, June 24, 2002 9:43 AM
> To: users@httpd.apache.org
> Subject: Re: forcing apache to process files read from a database by php
>
> Please, give more detailed info regarding what you are doing and what
> the
> Apache should do or not do.
> ============================================================ ============
> ====
> ===
> ----- Original Message -----
> From: "Dean Grant"
> To:
> Sent: Monday, June 24, 2002 6:21 PM
> Subject: forcing apache to process files read from a database by php
>
>
> > I am trying to build an application that stores a website entirely
> > within a database. There is no problem processing plain-text and html
> > documents, but I need to find a way to utilize apache in
> > processing/parsing the more complicated files that I read out with php
> > (ie. .pl .pdf, etc.) so that they are treated properly by the web
> > browser. Can anyone think of something that might allow me to do
> this?
> > The whole idea is to keep the database activity transparent to the
> user
> > so that it appears they are surfing a typical website.
> >
> > Thanks,
> >
> > Dean
> >
> >
> > ------------------------------------------------------------ ---------
> > To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> > For additional commands, e-mail: users-help@httpd.apache.org
> >
> >
>
>
>
> ------------------------------------------------------------ ---------
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>
> ------------------------------------------------------------ ---------
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>