About Linux FAQ

Browse More FAQs:

Tweaking php for maximum execution time for script

Posted by Vivek on Wednesday April 18, 07 @6:03 pm

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
OR
# /etc/init.d/lighttpd restart

Subscribe to our free e-mail newsletter or RSS feed to get all updates. You can Email this page to a friend.

Related Linux / UNIX FAQ:

Discussion on This FAQ

  1. DaiLaughing Says:

    php.ini was in /etc/php5/apache2 for me and the apache2 restart is done by:

    /etc/init.d/apache restart

    which might help others with Ubuntu. Thanks for the tip.

Leave a Reply

We encourage your comments, and suggestions. But please stay on topic, be polite, and avoid spam. Please do not use the comment form to ask for help / question. Ask your question on the excellent Linux tech support forum. Thank you very much for stopping by our site!

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word

~ Last updated on: April 18, 2007

Copyright © 2006-2008 nixCraft. All rights reserved - TOS/Disclaimer - Privacy policy - Sitemap - Powered by Open source software.