Update PHP to 7.4 macOS Catalina with brew

To update PHP to version 7.4 on macOS Catalina using Homebrew, you can use the following steps:

  1. Run brew update to ensure your Homebrew installation is up-to-date.

  2. Run brew uninstall php to remove any previous PHP versions that may be installed.

  3. Run brew install [email protected] to install the latest version of PHP 7.4.

  4. Verify that PHP 7.4 is now the active version by running php -v.

  5. If you are using a web server like Apache or Nginx, you will need to configure it to use the new PHP version. For example, for Apache, you will need to edit the httpd.conf file and update the PHP module path.

  6. Restart your web server to ensure it's using the new version of PHP

  7. To update your PHP extensions, you can run pecl channel-update pecl.php.net and pecl upgrade.

Watch a course Learn object oriented PHP

Please note that these steps may not be suitable for all use cases and you should backup your data before proceeding with any updates.