From your details, what's happened is pretty clear. An installer (or you) selected a non-universal build of php
and the migration has caused the breakage.
You can confirm this from your command line with this tool:
which php
You also might check out your $PATH by this command:
echo $PATH
Below is what my Air has for a clean and current OS.
bmike@m2 ~ % echo $PATH /usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin bmike@m2 ~ % sw_vers ProductName: macOS ProductVersion: 13.3.1 BuildVersion: 22E261
The reason for the path is you can inspect any paths that aren't the default (those that differ from the one I posted above) to inspect what else you might have installed that you can watch for / reinstall.
As for removing and reinstalling, I would suggest a far more easy sequence for you:
- Make a back up now before changing anything. Time Machine is ideal IMO, but you do what you are most comfortable in for a restore and backup.
- Install php for your new architecture. (I saw new since the old install was on Apple Silicon, and you need a new install for Intel, not that one CPU type is newer - this is about you not them.) I would go with homebrew to install brew itself for Intel and then php for Intel (ask a new question if you can't get brew install php to work)
- Forget about cleaning up the old
php
if you can get the new working - Make a backup and then plan your next steps no matter if these worked or not.
The reason to not uninstall is you didn't provide any sort of hint how you got it installed. That would be a different question if you had listed the exact source / steps and wanted just an uninstall. You were focused on getting something working and I find getting a new build is the same as having a few versions of PHP and choosing them - just choose the one you want and forget the old until it's time to clean house with an erase install.