473,388 Members | 1,188 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

PHP with no file extension

Hi, I'm running PHP as an Apache module. I've always wondered how you
set Apache up to parse a file as PHP without a file extension. Do you
use the AddType directive?

Sep 29 '06 #1
4 1935
On 29 Sep 2006 14:39:10 -0700, "Benjamin" <mu**************@gmail.comwrote:
>Hi, I'm running PHP as an Apache module. I've always wondered how you
set Apache up to parse a file as PHP without a file extension. Do you
use the AddType directive?
Some possibilities:

MultiViews - Apache picks an appropriate file based on the start of the
filename. You can have other types of files, e.g. images, in the same
directories, although there's some overhead to the way Apache picks files.

ForceType - force all files in a directory to be run as PHP. Pretty simple,
but don't put any other files in the same directory.

RewriteRule - mod_rewrite can do all sorts of transformations from URLs to
files, adding a .php extension would be a trivial rule.

The alt.apache.configuration group should be able to give more detail.

--
Andy Hassall :: an**@andyh.co.uk :: http://www.andyh.co.uk
http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool
Sep 29 '06 #2
RewriteRule - mod_rewrite can do all sorts of transformations from
URLs to files, adding a .php extension would be a trivial rule.
Question:
Is this slowing down website access and how much?

Thanks,
Jens

Sep 30 '06 #3
Jens Müller wrote:
>RewriteRule - mod_rewrite can do all sorts of transformations from
URLs to files, adding a .php extension would be a trivial rule.


Question:
Is this slowing down website access and how much?

Thanks,
Jens
Not significantly, unless you have a very busy site and complex rules.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Sep 30 '06 #4
If you want to have other file extentions treated as PHP, you can
simply use this line, as you suggested:

AddType php-cgi .html .htm .xml

For this example, html, htm, and xml files are treated as PHP.
Benjamin wrote:
Hi, I'm running PHP as an Apache module. I've always wondered how you
set Apache up to parse a file as PHP without a file extension. Do you
use the AddType directive?
Sep 30 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Phester | last post by:
If a file has a .inc extension, or if it has a .inc.php extension, is it treated differently by the php interpreter? Or is it just a convention? I've been calling my included files filename.php...
6
by: Els | last post by:
If I use <? include "file.html"; ?> in the html of my document, do I _have_ to change the extension of that document to .php, or would it still work and be valid if I let it remain .html? --...
3
by: Shapper | last post by:
Hello, I created a script to upload a file. To determine the file type I am using userPostedFile.ContentType. For example, for a png image I get "image/png". My questions are: 1. Where can...
0
by: troutbum | last post by:
I am experiencing problems when one user has a document open through a share pointing to the web site. I use the dsolefile to read the contents of a particular directory and then display them in a...
1
by: Brian Henry | last post by:
Just thought maybe someone here would like to know this. It's an example code I just created quickly on how to figure out the name of a type of file based on its extension (say for example .DOC)...
1
by: laredotornado | last post by:
Hi, I'm using PHP 4.4.4 on Apache 2 on Fedora Core 5. PHP was installed using Apache's apxs and the php library was installed to /usr/local/php. However, when I set my "error_reporting"...
0
by: rautsmita | last post by:
hello friends , i am using to jdk6 and JAXB2.0, i have geomtry.xsd file i am trying to compile this file using jaxb but i got some error i.e.The particle of the type is not a valid restriction of...
10
by: deciacco | last post by:
I'm writing a command line utility to move some files. I'm dealing with thousands of files and I was wondering if anyone had any suggestions. This is what I have currently: $arrayVirtualFile =...
36
by: Don | last post by:
I wrote an app that alerts a user who attempts to open a file that the file is currently in use. It works fine except when the file is opened by Notepad. If a text file is opened, most computers...
1
by: shahidrasul | last post by:
i want to download a file which user select from gridview, downloading is completing without problem but after download i want to refresh my page because i do some changes in db . but when...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.