Monday, 31 July 2017

How I Solved 500 error in Wordpress After Editing PHP File

I have recently trying to use JavaScript inside wordpress post by simply editing post but failed to make it work. Decided to use apply some jQuery from Stack Overflow in php file, in a hope it may work. The moment I posted it in extras.php, and clicked on update file button, my whole website starts giving 500 Error.

Very soon I realised its giving 500 error because of editing php file, because my other website on same server is working fine. To get this problem solve, I contacted my hosting provider (a kind of friend) on facebook, but he was outside and ensure me that he will fix it in couple hours when he will be back to home.

So, I headed towards google with my query, and got hints that it can also be fixed using backup. But when I accessed cpanel I didn't find any backup. But in a hope that there should be some place where that corrupt extras.php should be available. So, I accessed File Manager from cPanel. And found extras.php file from public_html >> >> wp-content >> themes >> Fashionistas (current theme your website is using) >> inc >> extras.php. Then simple right click on extras.php to edit it and replace the addition you made right before getting 500 Error and then click on Save Changes. Thats it. Now Your site should be working fine. Look below screenshot for better understanding of steps I followed.

Thank you!

No comments:

Post a Comment