I'm running apache2 + php5.

When I go to www.mysite.com/index.php, everything's fine.

When I got to www.mysite.com/ (i.e., no specific file name), the server just serves the text of that PHP file, so the interpreter does not run. Why?

There's no other file in the web root directory.

What am I missing here?

  • OK, this is becoming even more weird... Apparently the above behaviour is only displayed with Google Chrome. With Firefox and IE everything is working well. To summarize: When accessing my website at mysite.com using IE or Firefox, the PHP script at index.php is executed fine. When accessing my website at mysite.com using Chrome, the index.php is returned as a text file. When accessing mysite.com/index.php, the PHP script is executed. How strange. – Sleepster Oct 13 '09 at 22:09
  • OK, apparently solved by clearing the Google Chrome cache. I guess there are times when hitting the refresh button on Chrome doesn't really work. – Sleepster Oct 13 '09 at 22:42

Make sure the DirectoryIndex directive includes index.php; otherwise it won't automatically go to that file.

  • The index.php is in the DirectoryIndex. That is the reason that the server fetches the file and serves it to the client. The problem is that it is not running the PHP interpreter on that file. Weird. – Sleepster Oct 13 '09 at 21:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.