I am experiencing a strange problem with PHP configurations file php.ini on Mac OS X. I have created a phpinfo file. Calling it in the browser shows the PHP settings with -
Configuration File (php.ini) Path: /etc
Loaded Configuration File: /private/etc/php.ini
However upon editing the php.ini file at this location, (and restarting Apache of course) the changes are not reflected in the PHP settings as well as the phpinfo file.
E.g.: changing the bcmath decimal digits, changing timezone settings, etc. Is there another primary location from where Apache will pick up the settings file?
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.
Use the Built-In Apache Web Server to Run PHP on Mac We can use the command sudo apachectl start in the terminal to start the webserver. Then, typing the URL http://localhost/index.php where our PHP file is index. html will run the PHP file. The PHP file should be in the root directory to run.
ini file: Whenever we install PHP, we can locate the configuration file inside the PHP folder. If using xampp, we can find the configuration file in one or many versions, inside the path '\xampp\php'.
I'm using native Mac OS X Apache 2 with Homebrew taps from josegonzales.
To quote my system administrator friend, "the answer should lie in restarting PHP-FPM instead of Apache. Apache uses mod_fastcgi to connect to PHP via a port or socket that PHP-FPM runs PHP with."
You need to load/unload the p-list file associated with your PHP-FPM install. First check ~/Library/LaunchAgents Not there? Mine was located here:
/usr/local/Cellar/php53/5.3.26/homebrew-php.josegonzalez.php53.plist
It's restarted like this:
launchctl unload -w /usr/local/Cellar/php53/5.3.26/homebrew-php.josegonzalez.php53.plist && launchctl load -w /usr/local/Cellar/php53/5.3.26/homebrew-php.josegonzalez.php53.plist;
I added the following to my ~/.bash_profile file so that I can restart PHP-FPM when I restart Apache. The command to invoke the following is "apachectlrestart"
function apachectlrestart () { sudo launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist && sudo launchctl load -w /System/Library/LaunchDaemons/org.apache.httpd.plist && launchctl unload -w /usr/local/Cellar/php53/5.3.26/homebrew-php.josegonzalez.php53.plist && launchctl load -w /usr/local/Cellar/php53/5.3.26/homebrew-php.josegonzalez.php53.plist;}
This is an old post, but I had this problem and scoured the Internet to no avail, so I answer here for posterity.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With