I have tried using MacPorts to update to the latest version of PHP. After typing
sudo port install php
and installing all the necessary packages, when I type php --version in the terminal, I still get:
PHP 7.3.29 (cli) (built: Aug 15 2021 23:10:16) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.29, Copyright (c) 1998-2018 Zend Technologies
Why does my computer still have an outdated version of PHP instead of PHP 8?
The
phpport in MacPorts is a shim, it only installs the/opt/local/share/doc/php/READMEfile and depends on (currently)php82. Click one of the Files links on https://ports.macports.org/port/php/details/ to see that.What gets run when you type
php --versionin your shell depends on the symlink/opt/local/bin/php, but that symlink is managed by the port select mechanism explained in the port-select(1) manpage:In your case, you have probably previously used
sudo port select --set php php73. To make PHP 8.2 your default, runsudo port select --set php php82. Runport select --summaryto see the currently selected option.