Ask Different is a question and answer site for power users of Apple hardware and software. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've edited every single php.ini on my Mac (at least all the ones found by "locate") and still can't seem to increase the memory_limit directive for PHP.

I'm using MAMP PRO and running PHP scripts in the terminal.

How to solve this?

share|improve this question

Instead of guessing which php.ini you need to alter, run this command to locate the file:

php -r 'phpinfo();' | grep 'php.ini'

Even though I use MAMP PRO, by default my command-line PHP commands are not executed using their copy of PHP. In my case it says the file is found at /etc/php.ini

Once you have located the file, follow the instructions on all of the other answers to bump the memory_limit setting:

memory_limit = 256M
share|improve this answer

From (drupal may be irrelevant for your needs, but their site had a good explanaton - wanted to source it for you, and give credit to them)

By default, MAMP has the memory limit that a script can use set at 8MB, which is the PHP default. Looking at PHP's php.ini-recommended file, this memory limit is normally set at 128MB. To adjust this amount, open the php.ini file in a text editor and change the following line (approximately on line 232):

memory_limit = 8M ; Maximum amount of memory a script may consume (8MB)

PHP.ini file locations:

In MAMP PRO, don't alter the file directly since it will be recreated at each server start. Please edit the appropriate template (menu File > Edit template > ...) instead.

Even with larger PHP memory limits you can get timeout errors trying to import large Drupal databases into MySQL. These issues are discussed at length elsewhere with regards to the cache and views cache. Generally the solution is to empty the Drupal cache before importing/exporting databases to/from MySQL.

share|improve this answer
No go, those limits were already at 128MB... – Alex Nov 22 '11 at 1:31
hmm. you have pro...try editing the template instead. Apparently the php.ini file gets recreated each time. Instructions here:… That work? What are you running on the mamp server? – dmg Nov 22 '11 at 2:37
still nothing, every single php.ini file i can find (and templates too) are all with 128MB but php -r "phpinfo();" | grep memory_limit still returns memory_limit => 8M => 8M – Alex Nov 22 '11 at 4:51

For me, I did the following:

Edit the /Applications/MAMP/conf/php5.4.4/php.ini



to be:

memory_limit = 128M      ; Maximum amount of memory a script may consume (8MB)

Then in finder simply make the php.ini and php.ini.temp read only for all users. This way, MAMP cannot overwrite it with default files. Restart the server and check your phpinfo.

share|improve this answer
the simplest things go unnoticed! Thanks for this idea! – kelly johnson Dec 27 '12 at 17:57
up vote 1 down vote accepted

After messing around for a while a found something that worked for me:

# backup original php.ini
sudo mv /usr/bin/php /usr/bin/php.bkp

# create a symlink from MAMP's php.ini in /usr/bin directory
# (I use 5.2, change the path for 5.3)
sudo ln -s /Applications/MAMP/bin/php/php5.2.17/bin/php /usr/bin/php


share|improve this answer

if you use brew, i found my php settings at:

  $ /usr/local/etc/php/<php version>
share|improve this answer

try one of those: php increase memory limit

share|improve this answer

We're looking for long answers that provide some explanation and context. Don't just give a one-line answer; explain why your answer is right, ideally with citations. Answers that don't include explanations may be removed.

Welcome to this site! Answers on AskDifferent should be more than just a link (which may break and make the answer useless). Can you please summarize the content of the linked page in the answer? Link-only answers will get deleted. – patrix Mar 28 '13 at 10:09

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.