Check out my blog for more articles like this: //hbakouane.dev/blog
Updating PHP in a macOS machine can be difficult, you cannot just install Xampp, MAMP, or WAMP, run it, and then you have PHP 8 in your machine, you have to go through some steps that we will be showing in this article.
If you want to upgrade to a version between 5.3 and 7.3
If so, there is an easy solution called “PHP for OS X”, which doesn’t support any version higher than PHP 7.3.
to profit from this solution: //php-osx.liip.ch/
Upgrading to PHP 8
First things first, we have to install PHP on our machine
// Install PHP 8
// This will install the latest PHP version
brew install php// To install a specific version, run this command:
brew install
Now if we check the current PHP version, we will still see 7.1 or another one, which means we have to make the system consider PHP 8 as the default version, to do that we have to run this command:
brew link --force
Restart the services:
brew services start
we still cannot see PHP 8.0 when we run
php -v or php --version
2 commands are left to make this work:
export PATH="/usr/local/opt//bin:$PATH"
export PATH="/usr/local/opt//sbin:$PATH"
And voila, we have successfully installed PHP 8.0 on our machine
php -v
// Output:
PHP 8.0.9 [cli] [built: Aug 2 2021 22:56:15] [ NTS ]Copyright [c] The PHP GroupZend Engine v4.0.9, Copyright [c] Zend Technologieswith Zend OPcache v8.0.9, Copyright [c], by Zend Technologies
I passed 3 days trying to solve this and upgrade PHP from 7.1 to 8.0 in a 2011 MacBook, no results and suddenly I ran into this answer in StackOverflow which helped me a lot and I said why not share it with others!
I hope this helped.
Check out my blog for more articles like this: //hbakouane.dev/blog
Read More:
Integration of Laravel + VueJs + AdminLTE made easy
Models Pruning in Laravel 8.50.0 explained
5 Javascript libraries that will help you build your stunning Portfolio
A Laravel SaaS Boilerplate to start working on your next project
General-purpose scripting language
//www.php.net/
License: PHP-3.01
Formula JSON API: /api/formula/
Bottle JSON API: /api/bottle/
Formula code:
on GitHub
Bottle [binary package] installation support provided for:
monterey | ✅ |
big sur | ✅ |
catalina | ✅ |
64-bit linux | ✅ |
monterey | ✅ |
big sur | ✅ |
Current versions:
Other versions:
7.4.32 | General-purpose scripting language | |
7.3.33 | General-purpose scripting language | |
7.2.34 | General-purpose scripting language |
Keg-only
Depends on:
apr | 1.7.0 | Apache Portable Runtime library |
apr-util | 1.6.1 | Companion library to apr, the Apache Portable Runtime library |
argon2 | 20190702 | Password hashing library and CLI utility |
aspell | 0.60.8 | Spell checker with better logic than ispell |
autoconf | 2.71 | Automatic configure script builder |
curl | 7.85.0 | Get a file from an HTTP, HTTPS or FTP server |
freetds | 1.3.13 | Libraries to talk to Microsoft SQL Server and Sybase databases |
gd | 2.3.3 | Graphics library to dynamically manipulate images |
gettext | 0.21 | GNU internationalization [i18n] and localization [l10n] library |
gmp | 6.2.1 | GNU multiple precision arithmetic library |
icu4c | 71.1 | C/C++ and Java libraries for Unicode and globalization |
krb5 | 1.20 | Network authentication protocol |
libpq | 14.5 | Postgres C API library |
libsodium | 1.0.18 | NaCl networking and cryptography library |
libzip | 1.9.2 | C library for reading, creating, and modifying zip archives |
oniguruma | 6.9.8 | Regular expressions library |
openldap | 2.6.3 | Open source suite of directory software |
1.1.1q | Cryptography and SSL/TLS Toolkit | |
pcre2 | 10.40 | Perl compatible regular expressions library with a new API |
sqlite | 3.39.4 | Command-line interface for SQLite |
tidy-html5 | 5.8.0 | Granddaddy of HTML tools, with support for modern standards |
unixodbc | 2.3.11 | ODBC 3 connectivity for UNIX |
Depends on when building from source:
httpd | 2.4.54 | Apache HTTP server |
pkg-config | 0.29.2 | Manage compile and link flags for libraries |
To enable PHP in Apache add the following to httpd.conf and restart Apache:
LoadModule php_module $[brew --prefix]/opt//lib/httpd/modules/libphp.so
SetHandler application/x-httpd-php
Finally, check DirectoryIndex includes index.php
DirectoryIndex index.php index.html
The php.ini and php-fpm.ini file can be found in:
$[brew --prefix]/etc/php/8.0/
Analytics [macOS]:
| 19,054 |
| 18,778 |
| 3 |
| 51,295 |
| 50,583 |
| 172,169 |
| 166,277 |
Analytics [Linux]:
| 115 |
| 110 |
| 0 |
| 351 |
| 336 |
| 1,252 |
| 1,140 |