Solve internal server error for wordpress

Many times we face the issue of internal server error for many wordpress sites. To Solve internal server error for wordpress sites. You can use the following techniques and tips. First do not hurry to take action. Before doing anything you need to take database backup first then you need to see the apache server logs and mysql db slow logs. If you are using the shared hosting then you can check the access and error logs.

we face the issue of internal server error for wordpress for many wordpress sites. To Solve internal server error for wordpress sites. first check error log

HTTP 500 Internal Server Errors , if you seeing on the sites. then do not get worried. Internal Server Error is one of the common WordPress errors. All types of errors can be fixable so don’t worry. There should be some reasons behind internal server errors.

Solve internal server error for wordpress
Solve internal server error for wordpress

Note: First take the database backup and If possible to take the filesystem backup easily then take filesystem backup.

Solve internal server error for wordpress

PHP memory limit issue

Many times php memory limit will cause the internal server error. If you have dedicated server then you can easily change the php memory limit. you need increase the memory limit and restart the apache server. Many times if you use the new theme or new plugin. After activating the theme or plugin you might face the internal server error issue. Because new theme or plugin might need more memory for execution.

But if you are using the shared hosting then you need to set memory limit in your own php.ini file and put that file into your root folder of hosting.

Check the .htaccess file

Due to some issue your .htaccess file is corrupted which is present in your root directory folder of wordpress installation. Before doing anything first take backup of .htaccess file using filezilla or any ftp client. Then rename the .htaccess file to .htaccess-old and after that login to wordpress admin panel. Go to Permalink section and save it again. That will regenerate the .htaccess file again.

I think this will solve your issue.

Deactivate all the plugins

If you are able to login to wordpress admin panel then go to plugin section and deactivate all the plugins. It is possible, any plugin is breaking your site. If you are not able to login to wordpress admin panel then follow the following steps.

Use ftp client and go to wp-content folder and rename the plugins folder to plugins-backup. Then create the empty plugins folder in same place.

This way you are deactivating the all the plugins. I think this will solve your issue 100%.

Delete or Deactivate used theme

Many times I faced the issue when I activate the new theme. Site stops working. Not too worry. Just use any ftpclient and delete the new theme from themes folder. First take backup of your theme folder.

Contact to your hosting provider

If you are using the shared hosting then only you can contact to your hosting provider. Write a email about your site issue and when that happened.

I Hope above article will help you about solving the issue. Still you are facing issue then check the http error and access logs. You can write to me about issue.

Using above steps you will able to Solve internal server error for wordpress.

If wordpress site is hacked then how to fix issue

Recently one of my wordpress site is hacked which is on wordpress. There is something wrong happening on server. We fixed issue with some steps, we given full steps for fixing issue. Due to disk I/O notification and CPU usages notification email I got to know.

If wordpress site is hacked then how to fix issue

There is something wrong happening on server.

First thing I did which is checking the apache access logs and error logs. I was getting per second 100 request from some IP addresses.

I stoped apache server and I took my database and filesystem backup. Deleted my admin username and added new administrator with new username.

You should use the Better WP Security wordpress plugin. This is very useful plugin.

iThemes Security (formerly Better WP Security)

I added following code in my .htaccess file

 # BLOCK BAD IPS
 <limit GET POST PUT>
 Order Allow,Deny
 Allow from all
 # uncomment/edit/repeat next line to block IPs
 # Deny from 123.456.789
 Deny from 192.111.152.122
 Deny from 192.111.144.233
 Deny from 110.85.90.123
 </limit>

If wordpress site is hacked then how to fix issue
If wordpress site is hacked then how to fix issue

But above code was still not helpful to me because disk I/O and apache process was taking time to sending the request to 403.

Then I blocked the IP Address on My Linux server using following commands.

 iptables -A INPUT -s 192.111.144.789 -j DROP
 iptables -A INPUT -s 192.111.152.122 -j DROP
 iptables -A INPUT -s 192.119.144.123 -j DROP

This solved my issue.

Solved: Access denied with code 400 (phase 2).

When I restarted my apache server. I am using the fedora 9 here.

I did not get my default page opened in browser.
When I opened the apache error log file. I saw following error.

ModSecurity: Access denied with code 400 (phase 2). Pattern match “%0[ad]” at REQUEST_HEADERS:Cookie. [id “950910”] [msg “HTTP Response Splitting Attack. Matched signature <%0a>”] [severity “ALERT”] [hostname “localhost”] [uri “/”] [unique_id “SuWoGH8AAAEAAFF3rKEAAAAA”]

I after doing some R&D but I did not got any perfect soluction.
Then I cleared the whole browser cookies. That solves my problem.

solution – clear the browser cookies…

Solved issue -Directory index forbidden by Options directive:

I want to change the default location of Apache folder which is (var/www/html).
I am using the Fedora as OS and apache 2 here. you can use following code with any linux box like centos or ubuntu. Here we solved the issue of directory.

When I inserted the following code in bottom of the httpd.conf file.
<VirtualHost *:80>
Options +FollowSymLinks
ServerAdmin siwan@yahoo.co.in
DocumentRoot /var/www/html/testfolder
ErrorLog logs/error_log_net
TransferLog logs/access_log_net
</VirtualHost>

When tried the http://localhost/ in browser, I got the default browser page.
Then I tried to look my apache error using following command:
#[root@localhost ]# tail -f /var/log/httpd/error_log

In apache error log I got following error.
[Wed Oct 07 15:59:50 2008] [error] [client 127.0.0.1] Directory index forbidden by Options directive: /var/www/html/testfolder/

I changed the AllowOverride option but nothing is happens. Then I read the welcome page text
“To prevent this page from ever being used, follow the instructions in the file /etc/httpd/conf.d/welcome.conf.”
I opend the welcome.conf file.

I found following lines in welcome.conf file.
<LocationMatch “^/+$”>
Options -Indexes
ErrorDocument 403 /error/noindex.html
LocationMatch>

I changed that to as follows:

[viral-lock message=”Solution code is Hidden! It’s Visible for Users who Liked/Shared This article on Facebook or Twitter or Google+. Like or Tweet this article to reveal the content.”]

<LocationMatch “^/+$”>
Options Indexes
ErrorDocument 403 /error/noindex.html
</LocationMatch>

[/viral-lock]

That solve my problem. Some time your selinux will cause the issue so you need to deactivate the selinux.
Some time File permission will also cause the issue.
You can change the file permission using following command, go to that directory and run following command.
#chmod 777 *

You can use above commands on any linux box. Ubuntu, centos, redhat or on fedora box.. still solution will be same.