There may have many reasons to cause 500 Internal Server Error but today I met one which is first time for me.
A new client asked me to remove malware files from its WordPress site. I removed all malware data and upload all files to server to install WordPress. But I met 500 Internal Server Error as the following screen.
Here post how I fix it.
Step 1, check server log
Check server logs to see what's reason it is. This may save you many time to find out the reason.
The following screenshot is where to check in Hosing panel in Bluehost.
Step 2, check files permission
From the above server log it tells us caused by files writeable by group uses. I used the following way to check files permission on Mac.
Open Terminal and use the following command to move to the wordpress site folder.
{code type=php}
cd /Volumes/Disk 1/Application/XAMPP/xampfiles/htdocs/wordpress-site/
{/code}
Use the following command to check all files' permission:
{code type=php}
ls -al
{/code}
You'll see all files permission as the following screenshot.
Step 3, change permission to all files and directories
There are so many files and directories and it would be a nightmare to change ever file one by one. After learning I use the following command to do.
{code type=php}
find ./ -type d -exec chmod 755 {} ;
find ./ -type f -exec chmod 644 {} ;
{/code}
The first line change all directories' permission to only writable for owner. The second line change all files' permission to only writable for owner.
Step 4, check all changed files permission and upload to server
The updated permissions shown as the following:
Upload all changes to server again and now 500 Internal Server Error fixed.
Posted from my blog with SteemPress : https://waytowp.com/how-to-fix-500-internal-server-error/