7

I have installed PHP 7.2.14 with brew.

brew install php@7.2

On CLI I have already the 7.2.14 version, but not on Apache. What should I do, so I can remove 7.3 from my Mac and use only 7.2.14

Mutatos
  • 1,675
  • 4
  • 25
  • 55

2 Answers2

2

you need to run

  brew link php@7.2

To force the link and overwrite all conflicting files:

  brew link --overwrite php@7.2

To list all files that would be deleted:

  brew link --overwrite --dry-run php@7.2
Naga Penmetsa
  • 384
  • 5
  • 16
0

The PHP version in your CLI has nothing to do with the version you have on your Apache module.

You need to disable/enable the right modules in apache in order for the right php version to take affect.

For enabling/disabling a mod, you have this nice helper commands:

a2enmod <MOD_NAME> // Enable a mod

a2dismod <MOD_NAME> // Disable a mod

This one is not tested, but you should be able to do:

a2dismod php7.3

a2enmod php7.2

P.S

Not sure the apache helper commands are available in mac so you can do it directly through the httpd.conf file.

checkout /etc/apache2/httpd.conf and make sure the right modules are loaded.

Hope it helps. Good luck :)

AfikDeri
  • 2,069
  • 17
  • 19
  • when i ran `a2dismod php7.3` `a2enmod php7.2` from terminal. I get `-bash: a2enmod: command not found` Any tips? – Xitcod13 Apr 09 '19 at 19:50
  • This commands are available in linux usually, try to open your apache configuration file and set your modules manually. (don't forget to restart the service when you'r done,) – AfikDeri Apr 09 '19 at 22:37
  • oh the question is about Mojave MacOs. Can i somehow change the default php being used everywhere (maybe except in apache server.) I have a docker image running linux but i install libraries through composer on my mac then pass the files to the docker. So i need the php versions to match in mac and my docker image – Xitcod13 Apr 09 '19 at 23:45