php修改内存大小
I see this message in the error log of httpd:
PHP Fatal error: Maximum execution time of 30 seconds exceeded in
and
和
PHP Fatal error: Allowedmemory size of 268435456 bytes exhausted
How to change them to a longer and larger value?
如何将它们更改为更长和更大的值?
To change the allowed maximum memory usage of PHP:
要更改PHP允许的最大内存使用量:
Set
组
memory_limit = 256M
in /etc/php.ini
.
在/etc/php.ini
。
To change the maximum allowed execution time of PHP:
要更改PHP的最大允许执行时间:
Set
组
max_execution_time = 300
in /etc/php.ini
.
在/etc/php.ini
。
You can also set these values in .htaccess
if it is allowed by the server. For example, to set the memory_limit
:
如果服务器允许,您还可以在.htaccess
设置这些值。 例如,设置memory_limit
:
php_value memory_limit 256M
You can also set the values in the PHP script:
您还可以在PHP脚本中设置值:
ini_set('memory_limit', '256M');
Some programs has internal defined variables. For example, WordPress has an configuration variable that can be defined in wp-config.php:
一些程序具有内部定义的变量。 例如,WordPress具有可在wp-config.php中定义的配置变量:
define('WP_MEMORY_LIMIT', '256M');
php修改内存大小