Reputation: 2486
I followed a guide which used home-brew to install the lastest version of php (5.4.8) on OSX Mountain Lion.
I then followed a guide which showed me how to setup and use the pre-installed apache on OSX.
However when I try running up a base Symfony 2 project I get a bunch of errors relating to missing date.timezone in the php.ini.
However I have this correctly setup the php.ini but doing a quick phpinfo() in the Symfony project shows that its using the old preinstalled version of php (5.3) rather than the new one.
In terminal if I type which php
& php -v
, It shows the correct new version is being used.
But the phpinfo()
shows
Upvotes: 29
Views: 25495
Reputation: 111
Today I have same issue for updating php 7.2 to 7.3 as requirement of Laravel 6. Here is my solution.
Then, your php version in local web server (apache2) will be updated
Upvotes: 1
Reputation: 72991
Apache is not aware of the homebrew version of PHP (i.e. /usr/bin/php
). You see it on the command line because you've likely modified your PATH
(i.e. /usr/local/bin/php
).
You can modify this in your httpd.conf file.
I am not a fan of homebrew or other package libraries. Primarily because Mac OS X is built atop Unix. Furthermore, all but MySQL are installed natively. Here's an article on installing Apache, MySQL, and PHP on Mac OS X.
Disclaimer: I wrote that article.
Upvotes: 4
Reputation: 29897
Did you follow all the instructions provided in the Caveats?
Run brew info php54
to see them again.
Especially the line:
To enable PHP in Apache add the following to httpd.conf and restart Apache:
LoadModule php5_module /usr/local/Cellar/php54/5.4.8/libexec/apache2/libphp5.so
Upvotes: 80