需要增加特定目录而不是整个服务器的PHP内存限制

发布于 2024-08-13 14:28:08 字数 1389 浏览 5 评论 0原文

我在 plesk9/centOS64 上运行 wordpress 2.8.6 作为 fcgi,并设置 safe_mode=on。 wordpress 是通过 installatron 安装的。正在从 /etc/etc/php.ini 读取 php.ini

我需要增加 php 的内存限制,因为我收到许多 mod_fcgid: stderr: PHP Fatal error: Allowed memory size of 33554432 bytes exceded (tried to allocate 40961 bytes) )当我尝试升级大多数 WP 插件时,X 线上的 /var/www/vhosts/domain.com/httpdocs/wp-content/plugins/blah/blah.php 中。

按照 http://www.sakinshrestha.com/ 上的说明进行操作wordpress/fix-php-fatel-error-for-wordpress/,我尝试创建 php.ini 和 htaccess 文件并将其放置在 /var/www/vhosts/domain.com/httpdocs/wp-内容/。它不起作用。我没有尝试同时使用这两个文件。每次我创建这些文件时,apache 都会重新启动。

我认为无法使用每个文件夹的设置可能是由于我使用的是 fcgi。我将域名切换为使用 mod_php。现在,当我尝试升级插件时,我会收到一个询问 FTP 登录信息的框(如 http://www.chrisabernethy.com/why-wordpress-asks-connection-info/)。我输入了正确的 FTP 登录信息,但是当我单击继续时,服务器尝试让我下载 update.php。

所以现在我有两个问题:

1)如何仅在 FCGI 下增加该文件夹的内存限制?

2) 我如何切换到 mod_php 并将 WP 配置为不需要 FTP 连接信息?我尝试按照上面最后一个链接中的说明进行操作,但是 PHP 阻止警告:出于安全原因,第 3 行的 /var/www/vhosts/domain.com/httpdocs/whoami.php 中的 exec() 已被禁用。我关闭了 safe_mode=off 但这没有什么区别。

啊啊啊啊!!

I'm running wordpress 2.8.6 as fcgi with safe_mode=on, on plesk9/centOS64. wordpress was installed by installatron. php.ini is being read from /etc/etc/php.ini

I need to increase php's memory_limit, because I get many mod_fcgid: stderr: PHP Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 40961 bytes) in /var/www/vhosts/domain.com/httpdocs/wp-content/plugins/blah/blah.php on line X when I try to upgrade most WP plugins.

Following instructions on http://www.sakinshrestha.com/wordpress/fix-php-fatel-error-for-wordpress/, i tried creating both a php.ini and an htaccess file and placing it in /var/www/vhosts/domain.com/httpdocs/wp-content/. It didnt work. I did not try using both files at the same time. apache was restarted each time i created those files.

I thought not being able to use the setting per folder could be due to the fact that I am using fcgi. I switched the domain to use mod_php. Now when I try to upgrade a plugin I get a box asking for FTP login info (as seen in http://www.chrisabernethy.com/why-wordpress-asks-connection-info/). I put in the correct FTP login info, but when I click continue, the server tries to get me to download update.php.

So now i have two questions:

1) how do i increase memory_limit for that folder only under FCGI?

2) how do i switch to mod_php and configure WP to NOT need FTP connection info? I tried following the instructions in the last link above, but <?php echo(exec("whoami")); ?> is blocked by PHP Warning: exec() has been disabled for security reasons in /var/www/vhosts/domain.com/httpdocs/whoami.php on line 3. i turned safe_mode=off but it didnt make a difference.

arrrrghhhhh!!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

迷途知返 2024-08-20 14:28:08

从 PHP 5.3 开始,您可以使用 .user.ini 作为每个用户一个配置文件。

最美好的祝愿,
法比安

As of PHP 5.3 you can use .user.ini as an configuration file per User.

Best wishes,
Fabian

因为看清所以看轻 2024-08-20 14:28:08

为什么在 wp-content 中?尝试在 /var/www/vhosts/domain.com/httpdocs 中创建 php.ini。

另外,你编辑了wp-settings.php吗?这是默认值:

if ( !defined('WP_MEMORY_LIMIT') )
    define('WP_MEMORY_LIMIT', '32M');

Why in wp-content? Try creating a php.ini in /var/www/vhosts/domain.com/httpdocs.

Also, did you edit wp-settings.php? This is the default:

if ( !defined('WP_MEMORY_LIMIT') )
    define('WP_MEMORY_LIMIT', '32M');
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文