WordPress Errors and Solutions
Infinite redirect loop
If there is infinite redirect loop, put this line in functions.php of current theme.
remove_filter('template_redirect', 'redirect_canonical');
WordPress asks for FTP credentials
Change ownership of your WordPress directory.
chown –R www-data:www-data
Nginx: 413 Request Entity Too Large Error
Change Nginx config file
sudo nano /etc/nginx/nginx.conf
# set client body size to 128M #
client_max_body_size 128M;
sudo service nginx reload
Change PHP config file
sudo nano /etc/php5/fpm/php.ini
max_execution_time = 600
;This sets the maximum amount of memory in bytes that a script is allowed to allocate
memory_limit = 32M
;The maximum size of an uploaded file.
upload_max_filesize = 2M
;Sets max size of post data allowed. This setting also affects file upload. To upload large files, this value must be larger than upload_max_filesize
post_max_size = 3M
sudo service php5-fpm restart
WordPress Fatal error: Allowed memory size of 41943040 bytes exhausted
Go to wp-includes and change WP_MEMORY_LIMIT to 128M in default-constants.php
Cannot modify header information – headers already sent Error Message in WordPress
This error occurs when headers come after the content. You can use couple of ways to fix that.
1. Turn on buffer in php.ini
Find the following line output_buffering = Off
in php.ini and change it to output_buffering = 4096
2. Use ob_start() and ob_end_flush()
In addition to turning buffer on all the time for all the pages in the php.ini we can also turn it on on a page by page basis. We can do that by using function called ob_start() for output buffer start and then when we are done ob_end_flush(). So that’s going to start the buffer. Everything that happens after that will go in the buffer. And at the end we have to say okay, we are done now. You’re free to flush this over to the web server. Very important though, ob_start()has to come before any content. Just the same as the headers, otherwise we won’t have started the output buffer. When we output a little bit of HTML, the headers are already sent, then we turn on the buffer but it’s too late.