CentOS 7 - 500 internal error for php files

General support questions
Post Reply
armada
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

Hello,
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?

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

Can somebody help me please?

User avatar
TrevorH
Forum Moderator
Posts: 26862
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 5 died in March 2017 - migrate NOW!
CentOS 6 goes EOL sooner rather than later, get upgrading!
Full time Geek, part time moderator. Use the FAQ Luke

Post Reply

Return to “CentOS 7 - General Support”