skip to Main Content

So I have a versioning problem with my php on my macOSX. The version showed on my terminal is correct and shows PHP 7.4.2. However, when I open up phpinfo() on my project I get PHP 7.1.23

All the posts I keep finding on this subject is how the terminal is behind what is shown on phpinfo(), while I get the opposite. I installed php using homebrew since I needed to work with 7.4. However, I feel like php 7.1 was there prior to me installing 7.4, maybe it’s the built-n php version on my mac?

Things I tried that did not work:

  • Putting “export PATH=”/usr/local/opt/[email protected]/sbin:$PATH”” in my .bash_profile
  • Removing and reinstalling php using homebrew
  • Restarting Apache server thousands of times using “apachectl restart”
  • Removed XCode and it’s developer folder
  • Cried in a corner in a fetal position

Anyone has other suggestions?

2

Answers


  1. Chosen as BEST ANSWER

    The answer posted by @vadim is technically right, but since a2enmod doesn't work on my mac, I needed to manually change it in the httpd.conf file. The php7_module was pointing to the 7.1 libphp7.so file. What I did was simply found the libphp7.so file installed by homebrew and change the location in the httpd.conf to point to that one.


  2. You have multiple versions of php installed and you should change the one used by apache. First you disable old module sudo a2dismod php7.1, then you enable new module sudo a2enmod php7.4.
    Don’t forget to restart apache after this operation.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search