CentOS 7 - 500 internal error for php files

General support questions
Post Reply
Posts: 1
Joined: 2019/09/16 15:49:44

CentOS 7 - 500 internal error for php files

Post by armada » 2019/09/17 11:42:20

Fresh installed Centos 7, created a user account.
On the user account file manager, on public_html folder, i have
created 2 files.
The first is test1.html, which works fine, and content is displayed
in the browser.
The second is test2.php which returns 500 internal server error.

Why is this happening?

The php file has only an echo statement, nothing else.
Both files have 644 permissions and both are owned by the user i
No apache errors regarding to this issue.

Can somebody help me please?

User avatar
Forum Moderator
Posts: 28505
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: CentOS 7 - 500 internal error for php files

Post by TrevorH » 2019/09/17 15:46:06

Most likely selinux. Did you create the file in one location and then mv it to where it ended up? If you use mv it tries to preserve the selinux context of the file from teh original location. If you copy it then it assigns it a context based on the target location. To fix this, try running restorecon -RFv $file against the file in question.
CentOS 6 will die in November 2020 - migrate sooner rather than later!
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 is dead, do not use it.
Full time Geek, part time moderator. Use the FAQ Luke

Post Reply

Return to “CentOS 7 - General Support”