Martin Johnson | 3 Oct 23:40 2005

PHP: requests for non-existent files

Hi,

I use Mathopd with PHP.  There's a minor problem: requests for
non-existent files return "200 OK" and execute index.php (as if
index.php had been requested).

I'd prefer "404 Not Found".  Can I fix this in mathopd.conf?

   ...
   Server {
        Port 8888
        Virtual {
                Host www.example.com
                Control {
                        Alias /
                        Location /webpub/example.com
                        PutEnv { PHPRC=/etc/php/example.com }
                        External {
                                /usr/bin/php { php }
                        }
                        IndexNames { index.html index.php  }
                }

Thanks for any thoughts,

- Martin.

Janusz Gumkowski | 4 Oct 07:59 2005
Picon

Re: PHP: requests for non-existent files

On Mon, Oct 03, 2005 at 10:40:31PM +0100, Martin Johnson wrote:

> I use Mathopd with PHP.  There's a minor problem: requests for
> non-existent files return "200 OK" and execute index.php (as if
> index.php had been requested).
> 
> I'd prefer "404 Not Found".  Can I fix this in mathopd.conf?

Add "PathInfo Off" somewhere inside Control{} block.

--

-- 
Janusz Gumkowski
http://www.am.torun.pl/~ja             Janusz.Gumkowski <at> am.torun.pl

Martin Johnson | 4 Oct 09:59 2005

Re: PHP: requests for non-existent files

On Tue, 2005-10-04 at 07:59 +0200, Janusz Gumkowski wrote:
> On Mon, Oct 03, 2005 at 10:40:31PM +0100, Martin Johnson wrote:
> 
> > I use Mathopd with PHP.  There's a minor problem: requests for
> > non-existent files return "200 OK" and execute index.php (as if
> > index.php had been requested).
> > 
> > I'd prefer "404 Not Found".  Can I fix this in mathopd.conf?
> 
> Add "PathInfo Off" somewhere inside Control{} block.

Thanks, that's fixed it!

Quentin Gouedard | 13 Oct 14:52 2005

log files rotation


Hello,
I currently use a daily rotation for the mathopd log files: 

Log /home/log/mathopd/log.%Y%m%d 

However I recently reached a point where my log files reach the OS max file 
size in one day.
Is there a way I can have mathopd rotate files:
 - on an hourly basis ?
 - on a 15 minutes basis ? 

Also, am I correct if i say that to increase the max file size (under RH 
linux) I would have to overwrite the value in
/proc/sys/fs/file-max
?
Do i have to restart anything for this change to be taken into account ? (i 
realize this is more of a linux question but well :) ). 

Thanks!

Piotr Meyer | 13 Oct 16:38 2005
Picon

Re: log files rotation

> 
> Hello,
> I currently use a daily rotation for the mathopd log files: 
> 
> Log /home/log/mathopd/log.%Y%m%d 
> 
> However I recently reached a point where my log files reach the OS max
> file 
> size in one day.

Wow. What is size of Your logfile? AFAIR kernel 2.4.x has limit 2TB
on single file (ext3 filesystem).

> Is there a way I can have mathopd rotate files:
> - on an hourly basis ?
> - on a 15 minutes basis ? 

From mathopd (1.5) manual:

         for distinct time periods. Before Mathopd tries to open the
         log file, it will expand any '%' constructs in the log file
         name, similar to date(1) and strftime(3). 

So, Log /var/mathopd/log.%Y%m%d%H probably will works an made logs like
/var/mathopd/log.2005101301 
/var/mathopd/log.2005101302
/var/mathopd/log.2005101303
and so on... 

> Also, am I correct if i say that to increase the max file size (under
(Continue reading)

Piotr Meyer | 14 Oct 00:34 2005
Picon

extra security check for CGI

Mathopd passes files to interpreter even they are word-writable
or located in world-writable directory. IMO this is bad idea so
I made small patch that makes some, simple checks for these things:

http://smutek.pl/~aniou/mathopd-cgi1.diff

--

-- 
Piotr 'aniou' Meyer
http://smutek.pl/~aniou/

Quentin Gouedard | 14 Oct 08:53 2005

Re: log files rotation


Thanks for your answers.
Actually, I'm not sure about the log file thing.
Thing is, for the past few days, mathopd stopped working in the 11pm-ish 
hours (not serving requests anymore).
The fact that it started working again at 12pm (date of the log file 
rotation) had me loook at the log files, and they were all of size
2147483647 (which is ~2 gigs, not all that big), so i extrapolated (maybe i 
was wrong) that it could be the file max size that was reached.
I'm running on a kernel 2.4 on a RH7.2 (yeah i know) and i beleive the FS is 
ext2 (maybe there's a lower limit for this type of file system ?). 

Thanks anyway :-)
Quentin 

Piotr Meyer writes: 

>> 
>> Hello,
>> I currently use a daily rotation for the mathopd log files:  
>> 
>> Log /home/log/mathopd/log.%Y%m%d  
>> 
>> However I recently reached a point where my log files reach the OS max
>> file 
>> size in one day.
> 
> Wow. What is size of Your logfile? AFAIR kernel 2.4.x has limit 2TB
> on single file (ext3 filesystem). 
> 
(Continue reading)

Piotr Meyer | 14 Oct 09:57 2005
Picon

Re: log files rotation

On Fri, Oct 14, 2005 at 08:53:12AM +0200, Quentin Gouedard wrote:

> I'm running on a kernel 2.4 on a RH7.2 (yeah i know) and i beleive the FS 
> is ext2 (maybe there's a lower limit for this type of file system ?). 

RH7.2? Of course - older installations of linux has 2GB filesize limit.
Look at this: http://linuxmafia.com/faq/VALinux-kb/2gb-filesize-limit.html

BTW: don't try upgrade of glibc by hand - if You don't have enough
experience it's may make Your system unusable. I see two ways:
- test witch per-hour log name
- reinstall/upgrade system to newer distro

--

-- 
Piotr 'aniou' Meyer
http://smutek.pl/~aniou/

Lou Kamenov | 14 Oct 16:54 2005
Picon

Re: log files rotation

On 14/10/05, Piotr Meyer <aniou <at> smutek.pl> wrote:
> On Fri, Oct 14, 2005 at 08:53:12AM +0200, Quentin Gouedard wrote:
>
> > I'm running on a kernel 2.4 on a RH7.2 (yeah i know) and i beleive the FS
> > is ext2 (maybe there's a lower limit for this type of file system ?).
>
> RH7.2? Of course - older installations of linux has 2GB filesize limit.
> Look at this: http://linuxmafia.com/faq/VALinux-kb/2gb-filesize-limit.html
>
> BTW: don't try upgrade of glibc by hand - if You don't have enough
> experience it's may make Your system unusable. I see two ways:
> - test witch per-hour log name
> - reinstall/upgrade system to newer distro

Somewhere there I had a patch which makes mathopd to log to stderr
so I can use mutlitlog, to rotate the files when certain size has been reached.
mutlilog log files also have a nice timestamp (if you want it), it can also
filter things into different files. its from the daemontools package -
http://cr.yp.to/

if you want that patch I can try and hunt around. i also have 2 patches that:
1. add Daemon on/off, Version on/off
2. find configfile from env - HTTPCFG

all these changes are pretty subjective, so cant say they might be
useful to anyone else - but who knows.

Juergen Daubert | 14 Oct 18:06 2005
Picon

Re: log files rotation

On Fri, Oct 14, 2005 at 10:54:01AM -0400, Lou Kamenov wrote:
> Somewhere there I had a patch which makes mathopd to log to stderr
> so I can use mutlitlog, to rotate the files when certain size has been reached.
> mutlilog log files also have a nice timestamp (if you want it), it can also
> filter things into different files. its from the daemontools package -
> http://cr.yp.to/
> 
> if you want that patch I can try and hunt around. i also have 2 patches that:
> 1. add Daemon on/off, Version on/off
> 2. find configfile from env - HTTPCFG
> 
> all these changes are pretty subjective, so cant say they might be
> useful to anyone else - but who knows.

wouldn't be the mathod wiki the right place to publish patches ?

Greetings
J├╝rgen

--

-- 
Juergen Daubert  |  mailto:jue <at> jue.li  
Korb, Germany    |  http://jue.li/crux


Gmane