views:

466

answers:

2

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!!

+2  A: 

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

Best wishes,
Fabian

halfdan
keep in mind that you have to revert to (f)cgi. From the documentation: "These files are processed only by the CGI/FastCGI SAPI"
VolkerK
Indeed, this was meant for his first question. I forgot to point that out. Thank you.
halfdan
I would like to change it by domain, not user. thanks
Gaia
FYI, i have reverted to fcgi.
Gaia
That is by domain. Just put the .user.ini into your domains webroot.
halfdan
.user.ini is getting ignored. worth noting for future reference that .user.ini is only read when using CGI/FCGI. mod_apache requires the directive to be in .htaccess.
Gaia
and it is only for PHP > 5.3.0
Gaia
...that's what I said.
halfdan
+2  A: 

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');
cdonner
thanks. i changed it to:`if ( !defined('WP_MEMORY_LIMIT') ) define('WP_MEMORY_LIMIT', '64M');`but i still get ``mod_fcgid: stderr: PHP Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 4344 bytes) in /var/www/vhosts/` AFTER restarting apache...BTW is it better to change this value in wp-config or wp-settings ?
Gaia
did it in wp-content because the only scripts that require more memory are there.
Gaia
I am not a PHP expert, but I still wonder if it works this way. Maybe someone else can explain. I would imagine that a PHP application does not dynamically change the memory allocation based on the settings of individual pages, but that this is done once when the app loads, which would mean that it has to be done in your app root.
cdonner
it is my impression that this setting can be used to specify max memory used by WP **within** the upper limit specified in php.ini
Gaia