Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't increase MAMP php memory limit

I've been trying to increase the php memory_limit in MAMP (Mac OSX). The version of PHP I'm using is 5.4.1.0. I've read about creating a new template for MAMP Pro, but I'm using the standard version of MAMP.

I've tried all of the below, but nothing seems to have worked. Any help would be much appreciated.

Thank you for your time.


I've added the following to my site's htaccess file, which is read by the site and works (ExpressionEngine). But the master PHP limit is still not updating.
php_value memory_limit 128M

I've changed the following from 32M to 128M in the following file:

/Applications/MAMP/conf/php5.4.10
memory_limit = 128M ;

I then quit MAMP entirely and restarted it, but in MAMP phpInfo it still reads:
memory_limit 32M


Virtual Hosts

I am using Virtual Hosts to set my own URLs. I read somewhere that it may be necessary to increase the memory limit here. So I added this to the 'php_value memory_limit 128M':

/Applications/MAMP/conf/apache/extra/httpd-vhosts.conf

<VirtualHost *:80>
 DocumentRoot /Applications/MAMP/htdocs
 ServerName localhost
 php_value memory_limit 128M
</VirtualHost>

and lower down in the same file in the relevant site's configuration:

<VirtualHost *:80>
  DocumentRoot "/Users/Username/Dropbox/Dev/sitename.dev"
  ServerName sitename.dev
  php_value memory_limit 128M
</VirtualHost>

(By the way, I keep my MAMP folder (Dev) in Dropbox and it works fine)


php.ini

I also added a php.ini file with the following contents in both the root of my site directory and the root of my MAMP directory:

memory_limit = 128M
like image 717
jx3 Avatar asked Sep 23 '14 13:09

jx3


People also ask

How do I increase max upload size in Mamp?

Fortunately, configuring MAMP to increase its upload size is simple. All you have to do is update three directives within your local php. ini file: memory_limit , post_max_size , and upload_max_filesize .

What is the maximum PHP memory limit?

Using the memory_limit directive By default, a PHP script can allocate up to 128 megabytes of memory. To verify the current value of the memory_limit directive and other directives, you can use the phpinfo() function.

How do I increase memory limit in WP config PHP?

Edit your wp-config.Open the wp-config. php file and search for this text string: define('WP_MEMORY_LIMIT', '32M'); Then, modify it to read define('WP_MEMORY_LIMIT', '128M'); You can go as high as 256MB, but in most cases, you won't need this much memory.


3 Answers

Managed to solve it ;-)

The correct one is:

/Applications/MAMP/bin/php/php[your_php_version]/conf/php.ini

find 'memory_limit' and increase the number:

memory_limit = [number]M

Thanks!

like image 142
jx3 Avatar answered Sep 19 '22 14:09

jx3


Make an phpinfo.php and put there the phpinfo(); in the output you can see the loaded configuration files and the values.

Edit the loaded php.ini file and set the memory limit. I think you have edited the wrong php.ini file or your application set the value over memory_limit.

like image 26
René Höhle Avatar answered Sep 17 '22 14:09

René Höhle


I have been chasing this for a couple hours, trying to scrub through all my php.ini files trying to update the settings with a text editor and saving it. And every time I'd restart MAMP the settings would get changed back and the file would be overwritten. So here's how I did it where I finally didn't get overwritten by MAMP.

In MAMP, use the menu to get to version of PHP you are using. Mine is 7.3.1 at this time.

  1. MAMP > File > Edit Template > PHP(php.ini) > 7.3.1
  2. An editor window will open, then use the search bar to find your setting... memory_limit
  3. Update your setting
  4. Cmd + S then close the editor window OR just close the editor window and click "Save" when you are prompted
  5. MAMP will then automatically re-start the servers with the new settings
like image 35
Shane McCurdy Avatar answered Sep 18 '22 14:09

Shane McCurdy