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
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:-
What you have to do is, change this to point to the correct version of the php.
Although not a direct answer to your question Mamp pro enables you to switch PHP versions easily. It made my development life much easier.
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.