PHP is not insecure if you use a supported version:
https://www.php.net/supported-versions.php
Apple is not the only company to stop bundling it and give the responsibility to the end user. Claris also used to ship PHP with FileMaker Server and removed that. So Claris had to provide instructions to get your own php set up for custom web publishing in the Claris Engineering blog:
https://support.claris.com/s/answerview?anum=000035470&language=en_US
These instructions were helpful, as were Tim Perfitt's instructions at Two Canoes for installing PHP on Monterey as he did for his MDS project:
https://twocanoes.com/knowledge-base/installing-php-7-on-macos-12-monterey/
Of course, in Monterey you have to code-sign the PHP you install. But it is not so hard if you follow the method from Rich Trouton at "Der Flounder":
https://derflounder.wordpress.com/2019/04/10/notarizing-automator-applications/
Using all this, I have had great success installing my own PHP on both my macOS FileMaker Server for custom PHP web publishing and my macOS Web Server (for a web site, munki server and munkireport server and various remote proxies. (both Macs on Monterey).
I presented on this topic along with my methodology including a "recipe" at the MacDevOps YVR conference 2022:
https://www.youtube.com/watch?v=XzxxLHojXhk&t=1s
In short, PHP on the Mac still lives - but its up to the end user to maintain it.