简体   繁体   中英

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

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!

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 .

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

In Mamp Pro and PHP version 7.2.8 ,you can find configuration file in this path:

/Applications/MAMP/bin/php/php7.2.8/conf/php.ini

But according to phpinfo(); My loaded configuration file is in different path! It is here:

/Library/Application Support/appsolute/MAMP PRO/conf/php7.2.8.ini

Also don't forget restart Mamp Pro.

Coming here after facing the same problem with PHP v.7.2 . To fix this I needed to go to the path /usr/local/etc/php/7.2/conf.d/php-memory-limits.ini and change the following:

; Max memory per instance
memory_limit = 2048M

Anything else I tried would not change it.

Now I don't get this errors when trying to pull packages with composer in my projects (Fatal error: Allowed memory size of 536870912 bytes exhausted...)

I was able to set memory_limit with MAMP PRO 5.5 on MacOS here :

/Applications/MAMP/bin/php/php7.3.8/conf/php.ini

PHP mode is Individual PHP version for every host (CGI mode)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM