Where are ini files on MacOsX Sierra?

Where are ini files on MacOsX Sierra?

  1. Blog
  2. 15 November 2026
  3. 3 min read

Stefan Bogdanescu

Founder & Senior Architect

Where Are Ini Files on macOS Sierra?

When you pull a fresh MacBook Pro out of the box and spin up PHP, the default behavior can be surprisingly sparse. Running php -i | grep ini on your new machine reveals a stark reality: the Configuration File (php.ini) Path is set to /etc, but when you run php --ini, the output explicitly states Loaded Configuration File: (none).

It is entirely possible for PHP to run without loading a standard php.ini file. This usually happens because the application server or CLI is configured to prioritize other initialization mechanisms, or simply because no file exists in the expected locations yet. However, relying on zero configuration means you lose immediate access to directives like memory_limit, display_errors, or custom extensions unless they are compiled directly into the binary.

To understand where your configuration actually lives on macOS Sierra (or later versions), you need to look beyond the standard /etc/php.ini. macOS does not ship with a pre-configured PHP installation in the root directory. Instead, modern PHP distributions on macOS typically use Homebrew or Apple's system package manager (on newer OSs, though Sierra often relied on third-party installs).

If you installed PHP via Homebrew, the default paths are usually located within your user home directory or inside the /usr/local tree. A common location for a custom php.ini in a Homebrew installation is /usr/local/etc/php/5.x/php.ini (where 5.x represents your specific version). To verify what PHP actually sees, you must inspect the environment variables that tell it where to look.

Run the following command to see the full configuration context:

php -i | grep "Configuration File"

If this still returns /etc and shows nothing loaded, check for a .ini file in your home directory. macOS supports user.ini files located at ~/.user.ini, though this is more common in web server contexts (like Apache or Nginx running PHP-FPM) than the CLI.

If you are managing a Laravel application, the location matters even less if you are using Composer dependencies, but it becomes critical for core functionality. For instance, if you need to tweak upload_max_filesize, you cannot do so in an empty configuration space.

You have three main options to resolve this:

  1. Create a Custom php.ini: Copy the default distribution file (often found at /usr/local/etc/php/7.x/php.ini.default) to your desired location and remove the .default suffix.
  2. Use php.ini.user or php.ini.local: In some setups, specifically when running PHP from a Homebrew tap, the configuration might be expected in ~/Library/Application Support/php/.
  3. Check for Environment Overrides: Sometimes, the PHPRC environment variable is set to point to a specific directory. Check with:
    echo $PHPRC
    

If php.ini is missing entirely, you can create one manually. Ensure you are editing the correct path identified by your specific installation method. If you are running a web server, ensure that your php.ini is not being shadowed by a .user.ini file in your project root, which might override settings you intend to apply globally.

The absence of a loaded configuration file is not an error; it is a feature of minimalistic systems designed to let you define exactly what you need. However, for production environments or development workflows requiring specific extensions or memory limits, manually placing and configuring a php.ini file in the standard Homebrew path (/usr/local/etc/php/[version]/) is the most reliable approach. This ensures that your settings persist across sessions and are not lost during future updates unless you explicitly backup your custom file.

Our network