0

I can't open .doc files from my browser on my website (PHP).

Rather my 404 page opens.

Could it be my htaccess settings?

nbanic
  • 1,270
  • 1
  • 8
  • 11
  • We cant tell you unless you show us how you link the file. May be you are linking it wrong too. – Shoban Feb 09 '10 at 18:31
  • Remember, that your PHP script runs the same UID/GID as Apache server. Also check file permissions and also directory permissions (for the whole path): they should be `r+x` for Apache UID, or Apache GID, or for other. And provide us with Apache error log file entry. – dma_k Feb 09 '10 at 18:36
  • I believe it's a mime type setup problem, are you using Apache? – Keith Adler Feb 09 '10 at 18:38
  • What name does your file have? May be it contains some non-ASCII symbols? – Vladislav Rastrusny Feb 10 '10 at 09:37

2 Answers2

1

You recieve a 404 because the URL you are using is not correct.

Make sure the URL is exactly right, the file exists in the place you expect and the permissions are correct on the web server.

Jon Winstanley
  • 23,010
  • 22
  • 73
  • 116
0

Following on from Jon Winstanley's answer:

You can use the file_exists and is_readable functions to help you diagnose the cause of the problem. eg.

if (!file_exists('path/to/file/filename')) {
    die("Couldn't find the file, my path is wrong");
}
if (!is_readable('path/to/file/filename')) {
    die("Couldn't read the file, my permissions are wrong");
}
Blair McMillan
  • 5,299
  • 2
  • 25
  • 45