Installing PHP 7.4 on macOS Sierra without brew?

Viewed 1789

I am unable to find any info on installing PHP 7.4, all the info seems to go untill 7.3 but that has not been helpful.

What I have done so far is execute:

curl -s https://php-osx.liip.ch/install.sh | bash -s 7.4

And this is the message I got:

enter image description here

It doesn't seem to install. How can I solve this problem?

2 Answers

Yes, you can install and upgrade to latest php version on mac without homebrew. For me I use MacPorts a package manager for MacOS which is similar to HomeBrew but more stable.

Example to upgrade to php74:

sudo port install php74

Install the extensions you need

sudo port install php74-cgi php74-gd php74-curl php74-intl php74-iconv php74-gettext php74-mbstring php74-imap php74-mcrypt php74-xmlrpc php74-mysql php74-openssl php74-sockets php74-zip php74-tidy php74-opcache php74-xsl php74-sqlite

Select php74 as the active PHP version. With this command you can have multiple php version and quickly switch from one to the other.

sudo port select php php74

Check which PHP binary is used (should return /opt/local/bin/php). Perhaps you may need to restart you terminal.

which php

Check the version (should return “PHP 7.4.XX (cli)…”)

php --version

Also, If you use XAMPP ensure to restart Apache Web server.

(Article Reference)

Related