tags:

views:

368

answers:

2

my code works fine if I remove the leading dots on file names, but breaks otherwise.

[edit]
The file starts with a dot (period) character
[end edit]

require_once('.htMyClass.inc.php'); //fails

require_once('htMyClass.inc.php'); //works

I wanted to keep the dots for security -- the leading ht is just a hold over from apache. i don't expect that to do anything special on windows.

A: 

I just run a test code, and worked fine. I am using xammp in windows, it could be apache or php configuration in your machine.

<?php
require_once(".htphp.inc.php");
?>

<?php
echo "test";
?>
Mohamed
Should be a comment, as this is not an answer to the question.
strager
it might not be the answer but proves that PHP can include/require any file no matter what the file name or extension is.
Mohamed
Ran same test, worked fine. Config issues maybe.
random
I'm not using XAMMP or Apache. Including dotted files in Apache always worked for me. Currently, I'm working with a manual install of (I think 5.2.8) php and IIS 5 on xp pro. I haven't installed on windows server yet, but that will be IIS 6.
42
Are there php.ini settings that control access to hidden files?
42
A: 

Reading this Microsoft article, "IIS Hidden Static Files Return HTTP 404 or Access Denied Errors," it could be failing on purpose. Extend that to not even being able to include the file.

random
Thanks Random Echo. Looks like you're right. I suppose that means I need to look into securing files with NTFS permissions. I'll start looking into best-practices for doing that.
42