Page 1 of 1
Setting up Apache 2: .php-extensions
Posted: Thu Feb 05, 2004 8:56 am
by Derfel Cadarn
I just installed Apache-PHP-MySQL on my new computer. Since the last time was quite a while ago, I have forgotten a few details.
When I want to visit phpinfo.php on my localhost, I need to type: "
http://localhost/phpinfo.php". But I know it's possible to set up the Apache-server so I can type "
http://localhost/phpinfo", that is without the '.php-extension'! I just forgot how to do it
It's probably some setting in the http.conf-file, but I cannot find it!
Any ideas??
Posted: Thu Feb 05, 2004 9:45 am
by infolock
you have to put it in a php file..
in other words, create a file called "mypage.php"
in that file, put this line of code :
Posted: Thu Feb 05, 2004 12:46 pm
by Derfel Cadarn
Hi Infolock,
thanx for the reply, but I'm afraid I didn't make myself clear (apparantly).
I was playing with the
highlight()-function and the script shown on php.net. As php.net told, I added this to the httpd.conf-file:
Code: Select all
<Location /source>
ForceType application/x-httpd-php
</Location>
and then created a script containing this code:
Code: Select all
<html>
<head>
<title>Source Display</title>
</head>
<body bgcolor="white">
<?php
$script = getenv("PATH_TRANSLATED");
if (!$script) {
echo "<br /><b>ERROR: Script Name needed</b><br />";
} else {
if (ereg("(\\.php|\\.inc)$", $script)) {
echo "<h1>Source of: " . getenv("PATH_INFO") . "</h1>\n<hr />\n";
highlight_file($script);
} else {
echo "<h1>ERROR: Only PHP or include script names are allowed</h1>";
}
}
echo "<hr />Processed: " . date("Y/M/d H:i:s", time());
?>
</BODY>
</HTML>
?>
As said on php.net, I stored it as "source" in the apache-rootdirectory.
PHP.net says:
but that doesn't work for me! I need to store the file "source" as "source.php" and then I can use it like this:
Code: Select all
http://www.example.com/source.php/path/to/script.php
But I remember I had it setup (once upon a time) so that I could use it with:
Code: Select all
http://www.example.com/source/path/to/script.php
And THAT's what I want to be able to do again! Do you understand what I mean here?
Posted: Fri Feb 06, 2004 11:07 am
by Derfel Cadarn
* bump *
Anyone? Please?

Posted: Fri Feb 06, 2004 1:30 pm
by Derfel Cadarn