473,386 Members | 1,673 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,386 software developers and data experts.

PHP includes

Is it necessary to have your file named *.php to use PHP code in it, such as
for includes? Can't any extension be used?

Thanks
Jul 16 '05 #1
5 2486
ConTactMe wrote:
Is it necessary to have your file named *.php to use PHP code in it, such as
for includes? Can't any extension be used?

Thanks


Any extension can be used. I often use .inc myself.

Jul 16 '05 #2
On Sun, 14 Sep 2003 22:36:24 -0500, Joshua Ghiloni created an
award-winning crop circle <bk**********@eeyore.INS.cwru.edu>, which, when
translated into English, means this:
ConTactMe wrote:
Is it necessary to have your file named *.php to use PHP code in it,
such as for includes? Can't any extension be used?

Thanks

Any extension can be used. I often use .inc myself.


But it's safer to use .php because many web servers
are configured not to process .inc files. If a browser
requests the file, the server will send it in source
code form.

Jul 16 '05 #3
Gary Petersen wrote:
On Sun, 14 Sep 2003 22:36:24 -0500, Joshua Ghiloni created an
award-winning crop circle <bk**********@eeyore.INS.cwru.edu>, which, when
translated into English, means this:

ConTactMe wrote:
Is it necessary to have your file named *.php to use PHP code in it,
such as for includes? Can't any extension be used?

Thanks


Any extension can be used. I often use .inc myself.

But it's safer to use .php because many web servers
are configured not to process .inc files. If a browser
requests the file, the server will send it in source
code form.

.... Behaviour that you can prevent by using the server's authorization
mechanism (ie : .htaccess for Apache).

Using .php extensions prevents the server from displaying source code,
but not from executing it, which may not be such a good idea.

Bruno

Jul 16 '05 #4

"Bruno Desthuilliers" <bd***********@removeme.free.fr> wrote in message
news:3f***********************@news.free.fr...
Gary Petersen wrote:
On Sun, 14 Sep 2003 22:36:24 -0500, Joshua Ghiloni created an
award-winning crop circle <bk**********@eeyore.INS.cwru.edu>, which, when translated into English, means this:

ConTactMe wrote:

Is it necessary to have your file named *.php to use PHP code in it,
such as for includes? Can't any extension be used?

Thanks


Any extension can be used. I often use .inc myself.

But it's safer to use .php because many web servers
are configured not to process .inc files. If a browser
requests the file, the server will send it in source
code form.

... Behaviour that you can prevent by using the server's authorization
mechanism (ie : .htaccess for Apache).

Using .php extensions prevents the server from displaying source code,
but not from executing it, which may not be such a good idea.

Bruno


I tend to use .inc files in cases where I control the httpd.conf file and
can stop these files being displayed.

In the case where you do not control the webserver, a method I have used is
to call my files .ht_php_something

the "dot" ht is generally not output via the webserver - ala .htaccess
..htpasswd

Test it on the server you are using.

The best method of course is to use whatever extension you like and not have
the file in the web server path.

Bob
Jul 16 '05 #5
Thanks for all the great responses. I was more looking for the naming of the
display file, such as "guestbook.php" vs. "guestbook.html", and was
wondering if you can get the .html file to process PHP code as easily as the
..php file.
"B()_b" <bR*********@norcom.net.au.remove.me> wrote in message
news:10***************@challenger.norcom.net.au...

"Bruno Desthuilliers" <bd***********@removeme.free.fr> wrote in message
news:3f***********************@news.free.fr...
Gary Petersen wrote:
On Sun, 14 Sep 2003 22:36:24 -0500, Joshua Ghiloni created an
award-winning crop circle <bk**********@eeyore.INS.cwru.edu>, which, when translated into English, means this:
>ConTactMe wrote:
>
>>Is it necessary to have your file named *.php to use PHP code in it,
>>such as for includes? Can't any extension be used?
>>
>>Thanks
>>
>>
>>
>
>Any extension can be used. I often use .inc myself.
But it's safer to use .php because many web servers
are configured not to process .inc files. If a browser
requests the file, the server will send it in source
code form.
... Behaviour that you can prevent by using the server's authorization
mechanism (ie : .htaccess for Apache).

Using .php extensions prevents the server from displaying source code,
but not from executing it, which may not be such a good idea.

Bruno


I tend to use .inc files in cases where I control the httpd.conf file and
can stop these files being displayed.

In the case where you do not control the webserver, a method I have used

is to call my files .ht_php_something

the "dot" ht is generally not output via the webserver - ala .htaccess
.htpasswd

Test it on the server you are using.

The best method of course is to use whatever extension you like and not have the file in the web server path.

Bob

Jul 17 '05 #6

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

Similar topics

13
by: Tim Tyler | last post by:
A fairly simple question: I have a library A which depends on library B and C. Currently I have: <?php include("A.inc.php"); include("B.inc.php"); include("C.inc.php");
2
by: Joe Mowry | last post by:
First off, I'm posting this question for a friend that doesn't have access to the news groups. Problem: Using PHP as the base and has several PHP < includes > for various functions, all this...
4
by: Patrick | last post by:
I have an ASP site with about 50 ASP files, all of which are currently including a common "includes.asp" file near the top of the file, responsible for generating the <HEAD/> section of the HTML ...
4
by: Generic Usenet Account | last post by:
I am seeing some unexpected behavior while using the STL "includes" algorithm. I am not sure if this is a bug with the template header files in our STL distribution, or if this is how it should...
2
by: David Muoio | last post by:
I am trying to validate an XML file against an XSD that is stored in the assembly as an embedded resource. I can get it to work as long as the XSD does not include other XSDs. After a fair amount...
12
by: tshad | last post by:
I am not sure why I am getting this error: I have the following code I want to run from another include file that holds all my functions. functions.inc...
6
by: William F. Zachmann | last post by:
We've got a project going that involves moving an old web site with a massive dll written in C++ that produces most of the output from a SQL 7.0 data base on NT4 onto IIS on Windows 2003 Server...
3
by: Jeff | last post by:
I have an asp page. Now I know this is sortof OT, but I am not sure of the forum to get an answer. I have an include on this asp page <!-- #include file=\forum\includes\consts-inc.asp --> ...
4
by: Ron | last post by:
Hi all, Trying to work out a few problems in using php on my site. Partially this is a html question. I was reading a lot of the posts and it seems that some of the includes people are using are...
1
by: JRough | last post by:
I have includes at the top of the file and I have inline includes also includes in mysql queries. For example: include './includes/config.inc.php'; include $include_path.'dates.inc.php';...
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:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.