Which php.ini file do I have to edit on Mountain Lion?

I recently upgraded to Mountain Lion and reconfigured my apache2 (https.conf) file in the terminal to load PHP and start automatically.

My localhost/~username/phpinfo.php page comes up to show my PHP configuration (php.ini). I see that upload_files is set to ON and the max_size_upload is set to 20MB. However, the upload_tmp_dir isn't set (it says NO VALUE). I assume the default tmp directory is "/tmp".

When I do

$ cd /etc/
$ sudo nano php.ini.default 

goto the upload_tmp_dir and I remove the ; in front of it and enter the value /tmp (save and exit).

I still see NO VALUE for the upload_tmp_dir when I load my phpinfo.php. I just wonder if I'm doing something wrong. Any help is appreciated.


/etc/php.ini.default serves only as a reference and is not read out by PHP at all. The built-in PHP installation will look for the file /etc/php.ini instead. This file is not present by default, but you can copy /etc/php.ini.default to /etc/php.ini and make your modifications in there. You could also just create an empty file and only add any directives you want to change from the default.

Make sure you copy or create the file as root, so in Terminal you could do:

sudo cp /etc/php.ini.default /etc/php.ini

After modifying the php.ini, also make sure you restart Apache for the settings to take effect.

It is good practice to not modify /etc/php.ini.default directly, so you can use it as a reference if anything goes wrong with your /etc/php.ini.