Page 1 of 2

Increase PHP memory limits

Posted: Mon Sep 28, 2015 7:10 am
by egeyazilim
I use Vestacp,
Centos 6 64 bit.
I want Memory_limit increase 128M,
master value memory_limit128M ok. but local value 32M


Changes that I made
1-etc/php.ini changed

Code: Select all

memory_limit = 128M


2-wp-config.php add this code,

Code: Select all

define('WP_MEMORY_LIMIT', '128M');
default-constants.php changed

Code: Select all

	if ( !defined('WP_MEMORY_LIMIT') ) {
		if ( is_multisite() ) {
			define('WP_MEMORY_LIMIT', '128M');
		} else {
			define('WP_MEMORY_LIMIT', '128M');
3-.htaccess adding

Code: Select all

php_value memory_limit 128M
4-php.ini moving wp-admin directory

5-restart apache and reboot server.
phpinfo();

memory_limit local value: 32M Master value: 128M
How do increase memory_limit local value?

Re: Increase PHP memory limits

Posted: Mon Sep 28, 2015 10:51 am
by skurudo
Show us please full output from phpinfo

Code: Select all

<?php phpinfo(); ?>

Re: Increase PHP memory limits

Posted: Mon Sep 28, 2015 11:21 am
by egeyazilim
skurudo wrote:Show us please full output from phpinfo

Code: Select all

<?php phpinfo(); ?>
phpinfo link I sent a private message

Re: Increase PHP memory limits

Posted: Mon Sep 28, 2015 11:55 am
by skurudo
You have master value, it means you changed memory_limit in php.ini. But somewhere you have settings with 32mb - may me it's a hidden .htaccess file in the site root and that one was overriding all other values.

Re: Increase PHP memory limits

Posted: Mon Sep 28, 2015 12:41 pm
by egeyazilim
skurudo wrote:You have master value, it means you changed memory_limit in php.ini. But somewhere you have settings with 32mb - may me it's a hidden .htaccess file in the site root and that one was overriding all other values.
I found the solution

Code: Select all

Include /home/$user/conf/web/httpd.conf
memory_limit will change in this file

Re: Increase PHP memory limits

Posted: Mon Sep 28, 2015 12:46 pm
by skurudo
egeyazilim wrote:I found the solution

Code: Select all

Include /home/$user/conf/web/httpd.conf
memory_limit will change in this file
somewhere you have settings with 32mb
You found your somewhere , nice! ;-)

Re: Increase PHP memory limits

Posted: Sun Dec 11, 2016 10:28 am
by indteam
I have same problem, php.ini alredy set 4000M and .htaccess php_admin_value memory_limit 4000M.

But wordpress always get Fatal Error: Allowed Memory Size of 33554432 Bytes Exhausted. I check from phpinfo also showing memory limit 4GB or 4000M , no hidden file or hidden php.ini on home/admin/web/

Previously my wordpress run on cpanel with ram 1GB no problem and fast. Now i moving to own vps.

Vps:
Centos 6.8 x64, Apache => default template
Ram: 6GB
Disk: 120GB


How to wordpress can work?
Tanks very much if anyone can share idea

Re: Increase PHP memory limits

Posted: Tue Dec 13, 2016 8:07 pm
by Felix
To increase PHP memory limits...

For Ubuntu Servers
Change setting php_admin_value memory_limit in file:

Code: Select all

/home/[user]/conf/web/apache2.conf
If you want the setting to apply to all new web sites that you create, change the setting in template files at:

Code: Select all

/usr/local/vesta/data/templates/web/apache2
For CentOS Servers
Change setting php_admin_value memory_limit in file:

Code: Select all

/home/[user]/conf/web/httpd.conf
If you want the setting to apply to all new web sites that you create, change the setting in template files at:

Code: Select all

/usr/local/vesta/data/templates/web/httpd

Re: Increase PHP memory limits

Posted: Thu Dec 15, 2016 10:28 am
by locus
I went through this recently too, updating the templates and creating new ones, then rebuilding web was pretty straight forward.

Re: Increase PHP memory limits

Posted: Thu Feb 02, 2017 1:19 am
by pandabb
Hello, how can i apply this to my wordpress site using nginx only and phpfpm (no apache)

1. upload_max_filesize = 64M
2. post_max_size = 64M
3. max_execution_time = 300

i tried creating a php.ini on my root of my website but it doesnt work. any solutions?

Thanks