Tweaking php for maximum execution time for script

Q. I’ve been trying to migrate my two webblogs into one using WordPress inbuilt import facility. I’m clicking on Manage > Export on your on my current blog and following on screen instructions.

After downloading the .xml file, navigate to my new blog’s admin area and click on Manage > Import and follow the instructions. However import failed after importing 50-60% posts only.

After close inspection apache and php log files I realized that script was timed out. How do I fix this problem?

A. PHP by default places resource limits on all php scripts using 3 directives:

=> max_execution_time : Maximum execution time of each script, in seconds (default 30 sec)

=> max_input_time : Maximum amount of time each script may spend parsing request data (60 )

=> memory_limit : Maximum amount of memory a script may consume (default 8MB)

Your php script was timed out because of resource limits. All you need to do is setup a new resource limits so that script will get executed:

Open /etc/php.ini (or /etc/php5/php.ini) file:
# vi /etc/php.ini
Setup new resource limits:
max_execution_time = 600
max_input_time = 120
memory_limit = 64M

Restart Apache or lighttpd web server:
# /etc/init.d/httpd restart
# /etc/init.d/lighttpd restart

*I hope you will find this article useful for your reference 🙂


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s