php extensions

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
In most sites that, I guess, use php I don't see them use the php extension.

For example,

is search a php script?

Right now I have things like file.php?something

and I was wondering if that is ok or if I should look into changing it to  

That is, is there something bad about using the php exention? (or maybe it  
can be turned off or something similar?)


Re: php extensions

Jon Slaughter:

Quoted text here. Click to load it

You should have looked into that _before_ publishing URLs.

Quoted text here. Click to load it

URL "extensions" in general are worse than useless.

Quoted text here. Click to load it

Look into mod_rewrite or MultiViews.


Re: php extensions

On Wed, 02 May 2007 02:53:02 -0500, Jon Slaughter wrote:

Quoted text here. Click to load it
IIRC, Google use their own C/C++ based extensions.  

Re: php extensions

Jon Slaughter wrote:

Quoted text here. Click to load it

No -- Google primarily use C for their search. Some of the newer and less
data-intensive stuff is written in Python and Java.

Yahoo, on the other hand, use PHP almost exclusively.

Quoted text here. Click to load it

Or better yet:


Quoted text here. Click to load it

Firstly, there is the slight security issue. Occasionally, security issues
are discovered in PHP. If your site includes ".php" in URLs, then it's
blindingly obvious that you're using PHP, so you become a potential target
for attack. This generally isn't a huge issue if you keep your copy of PHP
up to date though.

More importantly though is the issue of "cool urls". You should start by
reading Sir Tim Berners-Lee's essay "Cool URLs Don't Change" (you ought to
be able to find it on Google).

In particular, a few points:

    1. What if, in 6 months time, you change to using Python? Do
       you want to change all your URLs to ".py", breaking incoming

    2. Do visitors care that you're using PHP? If not, why should
       they have to write ".php" when they're typing up one of your
       URLs, or speak it if they're reading it over the phone? Keep
       URLs short, and keep unneeded information (such as which
       scripting language you used) out of the URL.

The general tools you can use to ensure nice URLs are Apache's mod_rewrite
module, Apache's MultiViews option and PHP's $_SERVER['PATH_INFO']

The mindset you have to get into is: the URLs on my website don't have to
bear *any* relation to the filenames I use on my server.

Toby A Inkster BSc (Hons) ARCS
Geek of ~ HTML/SQL/Perl/PHP/Python/Apache/Linux

Site Timeline