I recently set up my Apache server (2.2) with PHP (5.3) on my Oracle Linux computer. Initially, I created three files: index.html
, index.php
, and countries.html
. I believe (do not recall 100%) that I created these files in my /var/www/html/
folder, and these files were automatically given root permissions for both owner and group. However, when I copied my index.html
into my home directory (not root), I was no longer able to access the file (403 Message - Forbidden access), even after I moved it back into it's original /var/www/html/
folder and changed its permissions for owner and group back into root.
Notably, my index.php
file was the default page, even though it wasn't listed in the DirectoryIndex
. Furthermore, I experimented with my index.php
file by copying it, deleting the original, moving the copied version back into the /var/www/html/
folder, and changing the permissions. Same result, where it didn't work. Only difference is that the php file threw an internal server error (HTTP Error 500).
I have added my countries.html
file into my DirectoryIndex
line, and it will now display as the default page. However, if I remove it and leave my DirectoryIndex
line as it is:
DirectoryIndex index.html index.html.var
then it will default to my index.php
page and output the internal server error.
Right now, I see a couple of problems:
- The copied files do not work, despite having the same permissions. I believe my experiment with copying the
index.php
file is proof of this. - The default page, which was
index.php
, is not listed in theDirectoryIndex
, yet it still is the default.
Any help/insight would be appreciated.
This might also happen in case when you are using old php version and in your php file there is some syntax related to new php version. As in php 5.3 we don't have short array notation but in 5.5 we have also in 5.4 i guess that also can gives internal server error.
See your php version by
and if its version 5.3 or less check your php file if contains any new things like new short array notation [].
Don't know am i talking in the same context in which you want. As i didn't understand the question very well.