John Davidson

apache - MasOS Monterey: Unable to switch PHP versions using brew

0 comments
Message:


I upgraded my OS to Monterey and meanwhile I installed multiple versions using brew.
Basically I followed this post: https://getgrav.org/blog/macos-monterey-apache-multiple-php-versions


I am not getting any error while I do switch but in the end php-v shows my default php version which is 5.6
Also I have tried to do switch without phpSwitcher script:


brew unlink [email protected] && brew link --overwrite --force [email protected]

but without any success. Trace of running script:


sphp 8.1
Switching to [email protected]
Switching your shell
Unlinking /usr/local/Cellar/[email protected]/5.6.40_4... 25 symlinks removed.
Unlinking /usr/local/Cellar/[email protected]/7.4.28... 0 symlinks removed.
Unlinking /usr/local/Cellar/[email protected]/8.0.16... 0 symlinks removed.
Unlinking /usr/local/Cellar/php/8.1.3... 0 symlinks removed.
Linking /usr/local/Cellar/php/8.1.3... 24 symlinks created.
Switching your apache conf
Restarting apache
Stopping `httpd`... (might take a while)
==> Successfully stopped `httpd` (label: homebrew.mxcl.httpd)
==> Successfully started `httpd` (label: homebrew.mxcl.httpd)

PHP 5.6.40 (cli) (built: Jan 20 2022 03:46:40)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies

All done!

My httpd.conf:


LoadModule php5_module /usr/local/opt/[email protected]/lib/httpd/modules/libphp5.so
#LoadModule php7_module /usr/local/opt/[email protected]/lib/httpd/modules/libphp7.so
#LoadModule php_module /usr/local/opt/[email protected]/lib/httpd/modules/libphp.so
#LoadModule php_module /usr/local/opt/[email protected]/lib/httpd/modules/libphp.so

Does anyone have idea what is preventing version to be changed?


Thanks in advance.



My Answer:
php56
brew link [email protected]

But still, php -v shows the default version. Any idea how to fix this issue?

Rate this post

3 of 5 based on 7648 votes

Comments




© 2024 Hayatsk.info - Personal Blogs Platform. All Rights Reserved.
Create blog  |  Privacy Policy  |  Terms & Conditions  |  Contact Us