php-fpm 7.4 via Docker method
You may wish to consider installing PHP 7.4 in a Docker container, while Apache runs in the host system.
I posted a full guide on Stack Overflow to cover the general (version-independent) steps necessary, but in this post I will focus on the specific considerations of using PHP 7.4 on Ubuntu 22.10 -- especially now that PHP considers 7.4 to be past end of life.
Rationale
I decided to go this route as I don't think the usual ppa:ondrej/php
PPA will be updated to include 7.4. Per their website, "Only Supported Versions of PHP . . . Don't ask for end-of-life PHP versions." PHP 7.4 is now EOL, so we should not expect this PPA to be added.
Additionally, as others have mentioned in this thread already, mixing PPAs designed for different releases may result in future dependency errors.
Consideration: Updates
The official PHP 7.4 Docker image is no longer updated (based on the github for it), so don't use the php:7.4-fpm
image in production (or any internet-facing usage) as-is. It should be reasonably safe in a localhost development environment, though.
Note -- Debian / Ubuntu will continue to receive PHP 7.4 updates for some time, even after PHP has already declared it EOL. It should be possible to set up a docker container based on Debian/Ubuntu's 7.4 php-fpm which should still be supported until 20.04 reaches EOL. There are 1,515 results for PHP7.4 on dockerhub, so there's a good chance someone is already doing this.
Also, if you go this route because you intend to deploy to production, you will also likely want to investigate automated build methods to keep the container updated. Though it's generally non-advisable to deploy a production web server on a non-LTS release.
Consideration: Tuning
It should also be noted that tuning settings or adding future plugins is cumbersome because it requires a full docker rebuild instead of just editing a config file or running a single apt command.
A possible workaround is that you could share the php-fpm config on a virtual host folder.
Next steps
Follow the main guide here for general instructions. Instead of using the official php:7.4-fpm
package, you may wish to explore non-official images to mitigate the EOL issue.