Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where is PHP.ini in Mac OS X Lion?

Tags:

php

macos

People also ask

Where is PHP ini location?

user. ini file is the default configuration file for running applications that require PHP. It is used to control variables such as upload sizes, file timeouts, and resource limits. This file is located on your server in the /public_html folder.

Where is PHP ini on Mac Catalina?

ini File at MacOS Catalina. For my MacOS Catalina, the location of php. ini is located at /etc/. As you can see there is no php.


To locate the ini file on your machine, open Terminal.app and run the following command:

php --ini

If you need a template for Lion, try this.


You should find it in /private/etc if it exists, otherwise:

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

In terminal do php -i | grep php.ini. Should give you some clues ;)


Answers from @Cronk and @Justin got me close on Mac OS X 10.9 Mavericks. In fact, on my system the /etc/php.ini file was missing completely, and it wasn't until I ran phpinfo() on the web server that I observed there was no configuration file. Copying the file from /etc/php.ini.default and adding the fully qualified path to the mcrypt.so library to the config file solved the problem:

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

Then in /etc/php.ini add the following line (using the correct path to your mcrypt.so file):

extension="/usr/local/Cellar/php54-mcrypt/5.4.29/mcrypt.so"

Then restart Apache2:

apachectl restart

As pointed out, the php --ini command will tell you where PHP is expecting to find the php.ini file.

For a standard installation, it's likely to be looking for /etc/php.ini

If you've used macports then PHP may be looking for /opt/local/etc/php5/php.ini


Run phpinfo() from any file and it tells you where it is. Here is a screenshot.

enter image description here