Welcome to Abdul Malik Ikhsan's Blog

Install php 8.0 in MacOS Sierra with Macports

Posted in php, Teknologi by samsonasik on December 6, 2020

Yes, you read it right. I live in the past, with old hardware, with legacy operating system. There is homebrew that previously still works in php 7.4 in early releases, but now no longer works. There is an alternative like a one click install app like MAMP PRO but didn’t support php 8.0 yet. XAMPP ? not really extension installable user friendly (as far as I tried)!

I don’t want to lost hope, I give a Macports a try, and it works while it not documented in the wiki yet. If you are using MacOS Sierra and want to try, you can do the following steps:

1. First, you need to have Macports installed first, that we can read in the documentation.
2. Install php 8.0

sudo port install php80

You will get the following note in the end of installation process:

 To customize php80, copy /opt/local/etc/php80/php.ini-development (if this is a development server) or /opt/local/etc/php80/php.ini-production (if this is a production server) to /opt/local/etc/php80/php.ini and then make changes.

You can follow that if you want to changes the PHP configuration.

3. Install common extensions

For example, you will need intl and mbstring extension, you can run:

sudo port install php80-intl
sudo port install php80-mbstring 

You can search already available extensions in the search page.

4. Now, you can check if it is actually installed:

php80 --version

That’s it 😉

6 Responses

Subscribe to comments with RSS.

  1. George said, on May 19, 2021 at 3:16 pm

    Is it possible to install PHP 7.4-8.0 on High Sierra and keep the server app working.(Home-brew fails to install PHP on 10.13)

    • samsonasik said, on May 19, 2021 at 9:13 pm

      I don’t have high sierra installed in my local dev, but if it works on Sierra, it should works on High Sierra with MacPorts, you may search on https://ports.macports.org/?search=php74&search_by=name

      • George said, on May 20, 2021 at 12:55 pm

        Hi thank you for the answer. MacPorts installs PHP on High Sierra but I have not found a way to use it in the Apple supplied Apache installation. Macports creates a new Apache enviroment which is “incompatible with the Apple Server app for High Sierra. Do you have any ideas how to use the Php from Macports in the Apple standard installation of Apache?

      • samsonasik said, on May 20, 2021 at 8:59 pm

        For integration with apache, I think you may need to follow this documentation https://trac.macports.org/wiki/howto/PHP#install

  2. namrehcram said, on March 1, 2023 at 6:31 am

    Is it possible to install php 8.0 on MacOS X Server Sierra with Macports?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: