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

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

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

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745112371a4611921.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信