Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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?

share|improve this question
    
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. –  bosh 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. –  bosh Oct 13 '09 at 22:42

1 Answer 1

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

share|improve this answer
    
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. –  bosh Oct 13 '09 at 21:44

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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