How do I find out where to install PHP and where php.ini is installed in Homebrew?

Asked 2 years ago, Updated 2 years ago, 129 views

I installed php using Homebrew on mac OS (Sierra).

I want to edit php.ini, but I don't know where it is.
Also, please let me know the location of the folder containing the php body.
How to find it.

Thank you for your cooperation.

add

 $php-i | grep "Loaded Configuration File"

This command identifies the location of the ini file.

But I don't know where the folder where php is installed.
Please tell me how to find it.

php macos homebrew

2022-09-30 14:41

2 Answers

Use the which command to locate specific commands (execution files) in Unix-like operating systems such as Macs.

whichphp displays the highest priority executable used when you enter php.
If there are multiple executables with the same name, which-aphp displays them all.

In addition, information about php packages in brew can be found in brew info php, so
Among them was the following description.
You can also find the location of php.ini using this method.

The php.ini and php-fpm.ini file can be found in:
/usr/local/etc/php/7.3/

Also, files are distributed in multiple locations based on Filesystem Hierarchy Standard adopted by Unix-affiliated operating systems.

Each distribution has slightly different rules and it's hard to memorize them all, so
First of all, I think it's good to remember that there are rules like that.


2022-09-30 14:41

If you are in a Homebrew environment, you might want to check with brews<PACKAGE> instead of the which command.

$brewls<PACKAGE>

Note:
List all files in a homebrew package-Stack Overflow


2022-09-30 14:41

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.