Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mac completely uninstall php that was not installed from brew

Tags:

php

macos

I'm running Mac Catalina and want to remove the php version to downgrade to php7.2 possibly use brew from now on.

At the moment I have this.

I don't care much about the error but want I want to achieve is removing completely remove 7.3.11 and then reinstall from brew. I can't find anything about replacing php that is not coming from brew. Please help.

$ php -v
PHP Warning:  PHP Startup: Unable to load dynamic library 'php_imap.dll' (tried: /usr/lib/php/extensions/no-debug-non-zts-20180731/php_imap.dll (dlopen(/usr/lib/php/extensions/no-debug-non-zts-20180731/php_imap.dll, 0x0009): dlopen(): file not found: /usr/lib/php/extensions/no-debug-non-zts-20180731/php_imap.dll), /usr/lib/php/extensions/no-debug-non-zts-20180731/php_imap.dll.so (dlopen(/usr/lib/php/extensions/no-debug-non-zts-20180731/php_imap.dll.so, 0x0009): dlopen(): file not found: /usr/lib/php/extensions/no-debug-non-zts-20180731/php_imap.dll.so)) in Unknown on line 0
PHP 7.3.11 (cli) (built: Jun  5 2020 23:50:40) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.11, Copyright (c) 1998-2018 Zend Technologies
like image 804
rosia Avatar asked Nov 02 '20 16:11

rosia


1 Answers

I found myself how to do it. I was looking at my user folder while the .profile file was in the root folder. Then I just put this inside:

export PATH="/usr/local/opt/[email protected]/bin:$PATH"

If you want to change the php version see the versions you have in /usr/local/opt/ and change the .profile file. Just reboot after the change.

I hope it will help somebody.

like image 119
rosia Avatar answered Nov 09 '22 13:11

rosia