Fixing WordPress Error: Maximum execution time of 30 seconds exceeded

If you have a WordPress install that is giving you this error:

Fatal error: Maximum execution time of 30 seconds exceeded in ...\wp-db.php on line ####

…It’s because PHP is timing out. The default timeout in PHP is 30 seconds, see here for details.

The fix:

The method I use for this is simple:

  1. Open your wp-config.php file in an editor (notepad, etc).
  2. Add this line to the top: set_time_limit(300);

The “300” can be any about of time (it’s seconds) you’d like.

The top of your file should like something like this:

wordpress-timeout

 

PS: You should only need to change this if you’re working on some kind of import /export or a one time process. If your blog requires this to run normally, their might be bad code or a server issue.

Fixing WordPress Error: Maximum execution time of 30 seconds exceeded

WordPress Multisite Windows / IIS Login Redirect / Loop Issue

wp_logoIf you have WordPress installed on Windows (2008 / IIS) with multisite + sub domains enabled you may have run into the issue of login loops / redirects when  accessing /wp-admin. Below are a few spots you may want to confirm you have the correct URLs:

In the database:

Table / Field

wp_blogs / domain
wp_options / siteurl
wp_options / home
wp_sitemeta / siteurl    (don't forget this one!)

Also check these tables in any additional sites (ie: wp_2_options).

Config Files
wp-config.php:

define('DOMAIN_CURRENT_SITE', 'www.yourdomain.com');

I also have this in my wp-config.php:

define('ADMIN_COOKIE_PATH', '/');
define('COOKIE_DOMAIN', '');
define('COOKIEPATH', '');
define('SITECOOKIEPATH', '');

Web Config
Below is my successful web.config

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <system.webServer>
    <rewrite>
      <rules>
        <rule name="WordPress Rule 1" stopProcessing="true">
          <match url="^index\.php$" ignoreCase="false" />
          <action type="None" />
        </rule>
        <rule name="WordPress Rule 2" stopProcessing="true">
          <match url="^([_0-9a-zA-Z-]+/)?wp-admin$" ignoreCase="false" />
          <action type="Redirect" url="{R:1}wp-admin/" redirectType="Permanent" />
        </rule>
        <rule name="WordPress Rule 3" stopProcessing="true">
          <match url="^" ignoreCase="false" />
          <conditions logicalGrouping="MatchAny">
            <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" />
            <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" />
          </conditions>
          <action type="None" />
        </rule>
        <rule name="WordPress Rule 4" stopProcessing="true">
          <match url="^" ignoreCase="false" />
          <conditions logicalGrouping="MatchAny">
            <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" />
            <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" />
            <add input="{URL}" pattern="([a-zA-Z0-9\./_-]+)\.axd" />
          </conditions>
          <action type="None" />
        </rule>
        <rule name="WordPress Rule 5" stopProcessing="true">
          <match url="^[_0-9a-zA-Z-]+/(wp-(content|admin|includes).*)" ignoreCase="false" />
          <action type="Rewrite" url="{R:1}" />
        </rule>
        <rule name="WordPress Rule 6" stopProcessing="true">
          <match url="." ignoreCase="false" />
          <action type="Rewrite" url="index.php" />
        </rule>
      </rules>
    </rewrite>
    <httpRedirect enabled="false" destination="http://www.yourdomain.com" />
  </system.webServer>
</configuration>
WordPress Multisite Windows / IIS Login Redirect / Loop Issue