How to prevent import from max_execution_time error or import stops before done

How to prevent import from max_execution_time error or import stops before done

in General Tags: errorimportmax_execution_timephpserver

Some users might experience “errors”, mostly when trying to import the demo data of our product, most returning something about the max_execution_time or a blank screen (in case debug is OFF and error_reporting is OFF).

What is max_execution_time

This is a server setting that tells the server how much time should it give to any script/function to be run before cutting it out. The idea is simple, let’s say for example that you have a large file that you want to process (our import case). Parsing and processing it might take some time (for example 40 secs), but if your server PHP setting for max_execution_time is set to 30 sec (this is common for most hostings) the script will cut out after 30 seconds, meaning that the whole file will not be processed, because it needed 40 seconds to do it, but the server gave it only 30 seconds for the run.

What to do and how to fix this

We have some system requirements for our products, and one of them says that you server must have max_execution_time set to 90. A good option would be to set this out for your server so you don’t get into trouble for any other things. It’s quite simple to do this as well. For this, we would recommend to open your wp-config.php file and add this at the top of the file. (make sure you include this after the <?php tag).

ini_set('max_execution_time', 300); //300 seconds = 5 minutes

You can set any value instead of 300, but we recommend using at least 90 to let your server download the demo data nicely.

The second way is to simply do the import process multiple times. The importer knows which file was already imported and will not import it again. So you should be able to get everything from 2-3 runs. The bad part is that you get multiple menus imported and some of the posts/items will be duplicated.

It doesn’t do anything, it doesn’t work

Well, that’s not the theme’s fault either. You are most probably on a shared hosting.¬†Shared hosting is Web hosting in which the service provider serves pages for multiple Web sites, each having its own Internet domain name, from a single Web server. Most Web hosting companies provide shared hosting. Although shared hosting is a less expensive way for businesses to create a Web presence, it is usually not sufficient for Web sites with high traffic. These sites need a dedicated Web server, either provided by a Web hosting service or maintained in-house or at least a VPS.

Because you are using a shared server, you are not offered the possibility to change and manipulate the PHP settings as this is done by the hosting provider. The best is to try reach them out and ask them to increase the max_execution_time for you. If they say they can’t do this, you’re left only with multiple imports.

0

0

Related Articles

Leave a Reply