Hello guys I want to downgrade from PHP7.3 to 7.2 but after installing PHP 7.2 with
brew install php#7.2
and unlinking PHP 7.3 with brew unlink php#7.3 the problem that I have is when I relink PHP 7.2 with brew link php#7.2 it goes back to the 7.3 version has anyone ever faced this problem, the project that I am working with requires PHP 7.2?
Update: This problem is still not fixed, i still can't get the PHP version to go down from 7.3 to 7,2
Related
i've updated my mac os to Monterey (12) and then I can not use composer command or php command and get this error
env: php: No such file or directory
macOS 12 (Monterey) removes the system provided PHP and you will need to install it yourself.
It is easy to install if you have brew installed. Simply run the following:
brew install php#7.4 brew-php-switcher
brew link php#7.4
This will install the latest version of PHP 7.4 as well as a handy utility for switching between PHP versions if you need to.
PHP has been removed from MacOS since v12 (Monterey), so you first need to install it on your own to use it. From my POV, the easiest way to do this is using Homebrew
run brew install php , it will take php last version, then you will be be able to use php on your mac
When i got mac, it had already installed php 7.3. I installed new version of php with Brew to /usr/local/Cellar/php/7.4.9/bin/php and edited ~/bash_profile, where i added
export PATH="/usr/local/Cellar/php/7.4.9/bin:$PATH"
export PATH="/usr/local/Cellar/php/7.4.9/sbin:$PATH"
then did source .bash_profile. It worked for the current terminal window, but other terminal windows are still on older PHP version /usr/bin/php, even after restart. Even plugin in PhpStorm claims that php version is older. Any help?
You can try the following
brew unlink php#7.3
brew link php#7.4 --force --overwrite
brew services start php#7.4
I am trying to load either PHP 5.6 or PHP 7.0 module in the Apache httpd.conf config file on macOS 10.15 Catalina. But what I receive when starting the Apache server using sudo apachectl start in Terminal is the following error:
httpd: Syntax error on line 187 of /private/etc/apache2/httpd.conf: Cannot load /usr/local/opt/php#5.6/lib/httpd/modules/libphp5.so into server: dlopen(/usr/local/opt/php#5.6/lib/httpd/modules/libphp5.so, 10): Library not loaded: /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib\n Referenced from: /usr/local/opt/php#5.6/lib/httpd/modules/libphp5.so\n Reason: image not found
Since PHP versions 5.6, 7.0 and 7.1 have been deprecated and removed from Homebrew, following this guide, I had to use an older deprecated tap and installed both PHP 5.6 and 7.0 by running:
brew tap exolnet/homebrew-deprecated
brew install php#5.6
brew install php#7.0
For the sake of complete information, I have tried both the Apache which comes with macOS and the latest Apache 2.4.43 installed via Homebrew, but this should not make a difference.
So the question is, how can I solve these errors and make PHP 5.6 and 7.0 running on macOS using Homebrew?
The solution is to install an older version of the openssl library. To be more specific, PHP 5.6 and php 7.0 require openssl 1.0.2, which you can install via Homebrew by running the following in Terminal:
brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/8b9d6d688f483a0f33fcfc93d433de501b9c3513/Formula/openssl.rb
brew switch openssl 1.0.2t
However, after running the above, when using PHP 5.6, php 7.0 or php 7.1, another "Library not loaded" error might occur., in particular, this one:
httpd: Syntax error on line 183 of /usr/local/etc/httpd/httpd.conf: Cannot load /usr/local/opt/php#5.6/lib/httpd/modules/libphp5.so into server: dlopen(/usr/local/opt/php#5.6/lib/httpd/modules/libphp5.so, 10): Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.64.dylib\n Referenced from: /usr/local/opt/php#5.6/lib/httpd/modules/libphp5.so\n Reason: image not found
Here, another older library is required, icu4C in this case. The solution is to run the following:
brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/a806a621ed3722fb580a58000fb274a2f2d86a6d/Formula/icu4c.rb
brew switch icu4c 64.2
Note for switching to PHP 7.2, PHP 7.3 or PHP 7.4
Since PHP 7.2, PHP 7.3 and PHP 7.4 do not work with the above mentioned older, 64.3, version of the icu4c library, whenever you need to switch to these PHP versions, e.g., by using this easy brew PHP switcher script, you also hav to switch the version of the icu4c library by running this command:
brew switch icu4c 67.1
Resources
OpenSSL 1.0.2m on macOS - Stack Overflow.
homebrew-core/openssl.rb at 75b573845a17aaf3f7c84dc58e97cf5fe39a502b ยท Homebrew/homebrew-core.
node.js - dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.62.dylib error running php after installing node with brew on Mac - Stack Overflow.
macOS 10.15 Catalina Apache Setup: Multiple PHP Versions | Official home of Grav CMS.
I have 2 versions of php installed on my macOS. When I restart the computer it is set by default to php 5.6 (I have already twice installed php 7 and it is available only till the next restart). How can I set the default to be 7.0? what should I do in .bash_profile? (to what should I change the home path of the php variable?)
If you install PHP with Homebrew, you might need to unlink the 5.6 version. Like:
$ brew unlink php56
Then you may start to install PHP 7.2
You can get more information from my article:
Upgrade PHP version from 5.6 to 7.2 on macOS Sierra (10.12)
I have been wanting to upgrade php5 to php7 on my macbook but i just don't know how. I tried using homebrew and a couple other methods I found online but I just don't know how to complete it.
As a result php5 has been deleted from /usr/local.
How can i get php5 back and then how do i upgrade it to php7?
I want the newest version because I have a minecraft server that I run on my computer that used to use php5 but now requires php7. I have the latest macbook with the latest os.
As you are using homebrew, you can go with homebrew-php. You can install multiple version of PHP with this, and easily switch the version if you want
Or, you can use homebrew with php as usual
brew tap josegonzalez/php
brew tap homebrew/dupes
brew install php55
If you want to upgrade to PHP 7 but still keep current PHP 5, you should unlink PHP 5 first
brew unlink php55
brew install php70
Then you can use PHP 7.
And if you want to switch back to PHP 5, just unlink PHP 7 and link PHP 5
brew unlink php70
brew link php55