PHP ini_set内存限制 [英] PHP ini_set memory limit
问题描述
当我们在代码中使用下面的ini_set时,所有其他代码的内存限制都一样吗?或仅对我们添加了哪些代码有效?
When we use ini_set like below in code, will memory limit be the same for all other codes? or only valid for in which code we added ?
ini_set('memory_limit', '512M');
谢谢
推荐答案
它仅适用于要写入的文件. 更改同一文件夹中多个PHP设置的最佳方法是:
It is only working for the file where it is written. Best way to change settings for multiple phps in the same folder are:
php_value memory_limit'512M'
php_value memory_limit '512M'
请记住,只有在服务器配置允许该目录使用"AllowOverride"指令的情况下,此方法才有效
Keep in mind, this only works, if you server configuration allowes "AllowOverride" directive for this directory
您可以在php.ini中进行此操作.
You can do this in php.ini.
但这会影响到您正在运行的所有php文件
but this will take affect to ALL php-files you are running
这篇关于PHP ini_set内存限制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!