Mazatec
Mazatec

Reputation: 11649

MAMP PHP config file help

When I modify the php.ini document found in

Applications/MAMP/conf/php5/php.ini

The changes are not reflected in the php info page in the MAMP interface

WHY?

Upvotes: 1

Views: 14671

Answers (3)

Starkers
Starkers

Reputation: 10541

You need to restart MAMP (Or indeed any Apache Server) for changes in php.ini to take effect. Restart MAMP using the GUI.

If you are still experiencing no changes, it's possible you are editing the wrong php.ini file. In MAMP, each php version has it's own php.ini file.

To make utterly sure you are editing the right php.ini file, use the following steps:

  1. Create a new .php file in your favourite text editor.
  2. Type

    <?php phpinfo(); ?> 
    

    and save it in MAMP's htdocs directory.

  3. Save it as index.php

  4. Make sure MAMP is running!
  5. Start Safari, or any browser, and type "localhost:8888" into your URL bar.
  6. You should see a purple table filled with information about your apache server.
  7. The 6th row should be titled "Configuration File (php.ini)", and on the right of this, a path should be displayed to the php.ini file apache is currently using. It should look like this: "/Applications/MAMP/bin/php/php5.4.4/conf"
  8. Now, either use Finder to look browse to this location and edit the .ini file with Text Edit, or use Terminal.
  9. If you want to use Terminal, open a new window and type the following: 'cd (and then copy and paste the path you gained from step 6)'. It should look like something like this: 'cd /Applications/MAMP/bin/php/php5.4.4/conf'
  10. Now type 'ls'
  11. Typing ls will show you the files within the 'conf' directory. The correct php.ini file should be displayed amongst other files such as 'pear.conf'. If you can see 'php.ini', we're nearly there. If not, you've gone wrong somewhere, so read over the previous steps.
  12. Now type 'sudo nano /Applications/MAMP/bin/php/php5.4.4/conf/php.ini'
  13. And give Terminal your password when it asks for it
  14. The php.ini file will be opened in Terminal's integrated text-editor, nano. Edit it, and save it using Nano.
  15. Simply quit terminal. 15) Restart Apache using MAMP's GUI 16) Browse to localhost:8888 in your favourite browser. Your changes should be reflected in the configuration screen.

I understand this instructions may be hard to follow, but just contact me if you want to use team viewer or something to get this working! Good luck

Upvotes: 6

Mike M
Mike M

Reputation: 5122

It seems that there are 2 php.ini files in the MAMP installation. The one that seems to be parsed in my case is not in the config/ folder but in the bin/php/php5.3.14/conf/php.ini

Upvotes: 0

nfechner
nfechner

Reputation: 17525

Possible answers:

  • You forgot to restart the Apache webserver after the change
  • PHP uses a php.ini from a different location (Check the PHPIniDir setting in your Apache config).

Upvotes: 1

Related Questions