在htaccess中设置内存限制


Set Memory Limit in htaccess

我正在开发WordPress。我需要增加内存,所以我在.htaccess文件中添加了以下行

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index'.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
php_value memory_limit 64M

我的示例php页面

<?php
phpinfo(); 

但是它抛出500内部服务器错误。这里有什么问题。。

.htaccess中,您可以添加:

PHP 5.x

<IfModule mod_php5.c>
    php_value memory_limit 64M
</IfModule>

PHP 7.x

<IfModule mod_php7.c>
    php_value memory_limit 64M
</IfModule>

若页面再次中断,那个么您在apache中使用PHP作为mod_PHP,但错误是由于其他原因造成的。

如果页面没有中断,那么您将使用PHP作为CGI模块,因此不能使用PHP值-在我提供的链接中,这可能是解决方案,但我不确定您是否能够应用它。

在上阅读更多信息http://support.tigertech.net/php-value