最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

plugin development - How to set init for maximum script execution, memory limit and max files upload in wordpress

programmeradmin0浏览0评论

Am trying to set maximum execution time, memory limit, max upload that can be execute by the script. I can do that in php as follows.

ini_set('max_execution_time', '300'); //300 seconds = 5 minutes
ini_set('memory_limit', '64M'); //maximum mb to be consumed by script
ini_set('upload_max_size', '4M'); //maximum mb to be uploaded by script

My question is what is the wordpress equivalent ways of doing that. Thanks

Am trying to set maximum execution time, memory limit, max upload that can be execute by the script. I can do that in php as follows.

ini_set('max_execution_time', '300'); //300 seconds = 5 minutes
ini_set('memory_limit', '64M'); //maximum mb to be consumed by script
ini_set('upload_max_size', '4M'); //maximum mb to be uploaded by script

My question is what is the wordpress equivalent ways of doing that. Thanks

Share Improve this question asked Sep 30, 2019 at 13:15 chinazaikechinazaike 1072 bronze badges 1
  • Answer: No. WordPress is not scripting or programming language and is not a server environment. It is just a content management system. – Max Yudin Commented Sep 30, 2019 at 13:42
Add a comment  | 

3 Answers 3

Reset to default 0

Have you tried this?

Add the following to wp-config.php:

set_time_limit(300);

Add the following to .htaccess:

php_value max_execution_time 300

You can set all those into wp-config.php file. You can see that file in WordPress root.

ini_set('max_execution_time', '300'); //300 seconds = 5 minutes
ini_set('memory_limit', '64M'); //maximum mb to be consumed by script
ini_set('upload_max_size', '4M'); //maximum mb to be uploaded by script

Apart from this you can set that into .htaccess file as well.

php_value max_execution_time 300
php_value memory_limit 64M
php_value upload_max_size 4M

if you have user.ini file you can define those values as well

max_execution_time = 300
memory_limit = 64M
post_max_size = 4M

The best option that I have was to set the codes below on top of the page of every script that runs my applications

ini_set('max_execution_time', '300'); //300 seconds = 5 minutes
ini_set('memory_limit', '64M'); //maximum mb to be consumed by script
ini_set('upload_max_size', '4M'); //maximum mb to be uploaded by script

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论