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
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:
- Your PHP installation appears to be missing the MySQL extension which is required by WordPress
- What is MySQL?
- Import MySQL dumpfile, SQL datafile into my database
- Clear Linux / UNIX BASH Shell Command Line Cache / History
- Access NAS server using NFS protocol under Linux or UNIX
Discussion on This FAQ
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!
~ Last updated on: April 18, 2007



February 2nd, 2008 at 2:11 pm
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.