Page 1 of 1

CentOS 7 - 500 internal error for php files

Posted: 2019/09/17 11:42:20
by armada
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?

Re: CentOS 7 - 500 internal error for php files

Posted: 2019/09/17 15:46:06
by TrevorH
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.