Over the weekend one of our websites went down but we didn’t notice it till we got back to work on Monday.
The strange part was that wp-admin was working as nothing happened and only the front-end was disabled. We tried everything from the standards:
and none of these gave any results..
However, the solution here was way simpler than what we expected. Simply update to the latest WordPress version.
That worked for us, however, if you are experiencing the same issue and just updating the WordPress core doesn’t solve the problem for you, I recommend opening the inspect element tool in Chrome and check for any errors.
[Mon Aug 18 17:36:30 2014] [error] [client 18.104.22.168] PHP Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 7680 bytes) in /var/www/index.php on line 18
Looks like your are running up against the PHP memory limit. Edit the file
/etc/php5/apache2/php.ini and increase the memory limit. Find this part of the file:
; Maximum amount of memory a script may consume (128MB) ; http://php.net/memory-limit memory_limit = 128M
and increase the number to something higher. Then restart Apache with:
sudo service apache2 restart
Though this also suggests that you should audit your plugins to see what’s using the memory.
Consider this only when there is no WordPress core update available, to replace the core files.
To do this, go to WordPress.org and download the latest version. Unzip it on your pc and remove the wp-content folder. Afterwards, compress the files again and upload to your domain. Unpack and replace all files on the server. Since we removed the wp-content folder earlier, that contains your media, plugins and themes, only the core will be replaced. This helps if there is a script added to that page to make it overload.
It’s time to step up your server security game so that this doesn’t happen again.