So you’ve got XAMPP installed and a fresh local installation of WordPress set up. Next, time to install that perfect theme. But wait! What’s this business about a fatal error and maximum execution time? Just when you thought you were past all the hard stuff…
Running into issues when developing with XAMPP is normal, especially if you’re working with it for the first time. When using XAMPP, following installation, installing a plugin, importing a large database, and creating a backup of your local website are all opportunities for something to go wrong. Just like any other server, a local XAMPP server will have to be adjusted for your particular computer setup to get it running problem-free.
PHP errors and port conflicts are the most common examples of the bugs XAMPP developers run into. Some of these issues are just about guaranteed to show up when working with a local WordPress installation, and in this tutorial, I’ll show you how to overcome four of the most common XAMPP issues WordPress developers are likely to encounter.
Problem 1: Maximum PHP Execution Time Exceeded
This is probably the most common issue first-time XAMPP users encounter. Try to install a large plugin or update the WordPress core and you’re almost guaranteed to see a fatal error message letting you know that the Maximum execution time of 30 seconds was exceeded.
The good news is, this is a really simple problem to fix.
What’s going on is that the settings controlling the version of PHP running on your XAMPP installation are limiting script execution time to 30 seconds. However, it takes longer than 30 seconds to install large plugins, update the WordPress core or perform many other common WordPress operations.
To fix the issue, you need to adjust a single PHP setting in your XAMPP installation’s php.ini file.
There are two ways to get to this file.
- Open up XAMPP control panel, click on Config in the Apache row, and select PHP (php.ini). This will open the file in a text editor, but probably not your preferred text editor.
- Navigate to your root XAMPP folder, open the php directory and look for the file titled php.ini. Then open that file with your preferred text editor.
On my Windows laptop with XAMPP installed directly into the C: directory, the file is located at this address: C:\xampp\php\php.ini.
Open php.ini in a text editor and find the line
max_execution_time. If you’re running the latest version of XAMPP, it should appear on line 368 of the file. To increase the execution time, just input a larger number. The default value is 30 seconds, but many shared hosting environments set this limit at 120 seconds. Increasing this value to 120 should keep you from ever running into this particular issue again while working with WordPress websites.
Anytime you make a change to php.ini you must save the file, close it, and then stop and restart Apache in the XAMPP control panel. Apache only reads the values in php.ini when it starts up. So any changes made to php.ini while Apache is already running won’t take effect until Apache restarts and reads the new values.
Restart Apache and then reattempt the operation that caused the error to appear. You should now see things proceed as expected.
Problem 2: Maximum File Size Exceeded
This error can manifest itself for lots of different reasons. By far, the most common way to run into this error is when attempting to use the media uploader in WordPress to upload an image file larger than 2 MB. I’ve also run into this error while attempting to import a database using phpMyAdmin. Regardless of how you manage to trigger this fatal PHP error, the fix is the same.
This is another issue that can be resolved by making some changes to php.ini.
Head back to php.ini. This time, look for the line that defines the
upload_max_filesize. By default, this value is set to 2 megabytes. Increase the value to a number that will accommodate the size of the file or database you are trying to upload. Keep in mind that acceptable values are any number that is a power of two. So acceptable values are powers of two: 2M, 4M, 8M, 16M, 32M, 64M, 128M, and so forth. Use a different value, 20M for example, and Apache will round-down the effective value to the nearest acceptable value, which would be 16M if you were to input 20M.
Before closing php.ini, look for the line that defines
post_max_size. This value works hand-in-hand with
upload_max_filesize. Increasing one without increasing the other will cause the smaller of the two to be applied as the maximum uploadable file size. Find the line, and use the same value you used for
If you take the time to look carefully at the notes in the php.ini file, you’ll see that for many settings a URL is provided where you can learn more about the setting you’re adjusting. It’s always worth taking a moment to visit the referenced URL. For example, the documentation provided for the
post_max_size setting lets us know that the
memory_limit value should be at least as large as
post_max_size. A quick look at
memory_limit reveals that the default value is 128 megabytes. Unless you set a higher limit for
upload_max_filesize than 128M, you won’t need to adjust this value.
Problem 3: Fixing Apache Port Conflicts
Another error message that is pretty common to see when working with XAMPP is a notification in the XAMPP control panel that the ports Apache needs to use, ports 443 and 80, are already being used by another application.
In the case of the error message in the image above, this is a pretty easy fix. The offending application is Skype. If you see the same message, close Skype completely and restart XAMPP to solve the problem. Skype is a frequent-flier on the port-blocking scene and pretty easy to identify and remediate. Unfortunately, things aren’t always so simple. Other things you can try if quitting Skype doesn’t fix the issue are:
- Stop World Wide Web Publishing Service, a utility application pre-installed on many Windows computers. To stop it, open up Administrative Tools > Services in the Windows Control Panel, look for the application, select it, and click Stop.
- Use Windows Firewall to force the ports to remain unblocked. Do this by opening the Windows Control Panel and navigating to Windows Firewall > Advanced Settings. Then add a new inbound rule forcing ports 80 and 443 to remain unblocked.
These two fixes are covered in greater detail in our previous tutorial on setting up XAMPP so we won’t rehash all of the details here. Instead, check out that tutorial to try those port-clearing fixes.