Re: [users@httpd] .phps extension with mod_fastcgi

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thursday 14 July 2005 13:27, Chris Hall wrote:

> it's a PHP thing.
>
> add:
>
> # display formatted, syntax hilighted php source code
> AddType application/x-httpd-php-source .phps
>
> to httpd.conf and restart the server

It's seems to be only the case that only mod_php supports it. The content type 
for .phps is application/x-httpd-php-source by default.

But thanks anyway!

You would have to do something like this for cgi:

in an .htaccess file for example:
RewriteRule (.*)\.phps$ /phpsource.php?$1

and the phpsource.php script could be like this (SECURITY!):
<?php
/**
 * Highlights a PHP file as PHP source.
 * The filename is taken of from PATH_INFO with the php extension added.
 *
 * We exclude files that are with "conf" or "cfg" in their name. Should be
 * probably even more adjusted!
 */

$file = $_SERVER['DOCUMENT_ROOT'].'/'.$_SERVER['PATH_INFO'].'.php';

if( !file_exists( $file ) || preg_match( '#conf|cfg#i', $file ) )
{
    header('Status: 404');
    ?>
    <html>
        <head><title>N0T F0UND</head></head>
        <body>
        <h1>NOT FOUND</h1>
        <h2>Please don't cheat!</h2>
        </body>
    </html>
    <?php
    return;
}

highlight_string( file_get_contents( $file  ) );
?>

>
> On 7/13/05, dAniel hAhler <apache-users@xxxxxxxxxx> wrote:
> > Hi,
> >
> > is the handling of .phps extensions (probably as text/html, with syntax
> > coloured php source code) a feature of mod_php only or can I activate/use
> > it with mod_fastcgi (+PHP) also?
> >
> > Thank you.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx



[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux