Pages

Thursday, July 30, 2015

Connection Timed-out

When your server reaches maximum usage and uses up all the server resources, this error usually pops up. The problem could be hidden in one of the themes and plugins that you are using.

Solution

It is advisable to start switching to default theme and see if the problem persists. If the problem continues, try to deactivate all plugins and activate one plugin after another to detect which plugin is resulting in this resource utilization. If you detect the plugin that is causing this problem, there are chances that this plugin uses more memory resources from your hosting server.

The ideal way to fix this issue is to first consider if the plugin in question is worth using all the resources – meaning, is it coded properly enough to justify the usage of the server resources. If yes, then you can ask your hosting provider to increase the memory limit or the memory execution time. If you already have the access to php.ini, then you can increase the memory execution time on your own using this code:

max_execution_time = 60;

Alternatively, you can also edit the .htaccess file and add this line:

php_value max_execution_time 60


If you edit .htaccess, make sure you update your permalinks by going to Settings in WordPress dashboard.

Wednesday, July 29, 2015

How to fix "Call to Undefined Function" in WordPress?

If you happen to get an error message with the words “Call to Undefined Function”, then you are in for a serious business to dig out a little further the culprit function.

Solutions for "Call to Undefined Function"

You need to understand that this error usually appears in four different circumstances. You need to determine which one of them will likely be the situation in your case.

  1. 1. Installing a new theme or plugin: When installing a new plugin or a new theme, you need to check if it is compatible with current version of WordPress. Most likely the Call to Undefined Function error shows up because the theme or plugin there might be some functions that use some related functions of an old WordPress version and hence cannot be defined. The error message usually points out the line number and the file name. This is the starting point to fix. You need to understand why such code was used in that line and see the possibility of modifying it or rather removing it altogether.  

  
  1. 2.       Auto-Upgrading Theme or Plugin: It may so happen that such errors can occur during auto-upgrading a theme or plugin. In such cases, first delete the theme or plugin and try to reinstall the updated version manually.


  1. 3.       Installing Multisite plugin on a single site: Some multisite plugins do not work on single sites because they are specifically designed to work on multi-site. Likewise, some single site plugins do not work on multisites. This is because the functions in one installation may not be defined for another type of installation. If this is the case, then make sure you install the right plugin for the right type of installation.


  1. 4.       Function does not exist: If you delete a function or a file within a theme or a plugin folder, then there is a high likelihood that you will get a ‘call to undefined function’. To debug this, you need to follow the error message carefully to see which function or file it is calling and throwing this error. Although it needs a deeper investigation, sometimes fresh re-installation of that particular theme or plugin also works fine. 

The Famous Fatal Error - PHP Memory Allocation

Memory Allocation in PHP apparently is the most common error that WordPress users would have come across. PHP by its very nature consumes memory on the server. Your hosting provider would either allocate the memory or may even allow you to increase the allocation. Most hosting providers might allocate only 8MB for PHP. Normally, single installation of WordPress can make PHP consume atleast 16MB of memory. Also, there are possibilities that you are using some other PHP application or CMS on your server which is also taking away the allocated PHP memory. In all such cases where memory is not sufficient, WordPress throws an error which is usually in this format:

 "Allowed memory size of NNN bytes exhausted". 

Solution for PHP Memory Allocation

Firstly, check if you have the rights to change memory allocation. If you do not have, proceed straight to your hosting service provider to increase the PHP memory limits. If you have the rights to change memory allocation, then open wp-config.php file in a text editor and add this line:
define( 'WP_MEMORY_LIMIT', '64M' ); 
You can change 64M to the desired value. You need to add this line just above this line:
 /* That's all, stop editing! Happy blogging. */ 

By writing this piece of code, you are instructing WordPress to increase PHP Memory allocation exclusively for WordPress only. This will resolve most of the errors caused due to lower PHP memory allocation.