skip to Main Content

My previous php version is 7.3 and it was default in mac os. After installing new PHP version 7.4 with homebrew I update the php path.
When I run php –version it shows me php v7.4.23 but when I run any php code it doesn’t work. I think I need to do some configuration in my settings. I follow some tutorial but nothing resolve my issue

Whenever I run any php it gives me this error

Fatal error: require(): Failed opening required '/Users/Raymond Tucker/projects/test/vue-test/foridpur_ict/vendor/autoload.php' (include_path='.:/usr/local/Cellar/[email protected]/7.4.22/share/[email protected]/pear') in /Users/Raymond Tucker/projects/test/vue-test/foridpur_ict/artisan on line 18

This is my output of $ where php

➜  ~ where php
/usr/local/opt/[email protected]/bin/php
/usr/local/opt/[email protected]/bin/php
/usr/local/bin/php
/usr/bin/php
➜  ~ 

3

Answers


  1. To use the new PHP version you have to edit the Apache file:

    Open the httpd.conf file and find the LoadModule. it should have the correct version of the PHP. It will look something like this:-

    LoadModule php7_module /usr/local/opt/[email protected]/lib/httpd/modules/libphp7.so
    

    What you have to do is, change this to point to the correct version of the php.

    LoadModule php7_module /usr/local/opt/[email protected]/lib/httpd/modules/libphp7.so
    
    Login or Signup to reply.
  2. Although not a direct answer to your question Mamp pro enables you to switch PHP versions easily. It made my development life much easier.

    Login or Signup to reply.
  3. I have Mac El Capitan. Nothing worked for me except this article (super fast).

    It allowed me to update php5 to php7, I don’t know why, and honestly I don’t feel it was real, but I don’t understand how has the php5 became php7.

    Back in the day, I did it with Macports, but I couldn’t install Macports this time, so I had to use this new method.

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