Ubuntu 22.04.4: FreePBX install failed with Asterisk v20

I can not install FreePbx follow this guide: How to Install FreePBX on Ubuntu 22.04 / 23.04, my problem look like this post, but no answer:

root@ip-172-31-23-59:~/asterisk-20.7.0/freepbx# ./install -n
Assuming you are Database Root
Checking if SELinux is enabled...Its not (good)!
Reading /etc/asterisk/asterisk.conf...Done
Checking if Asterisk is running and we can talk to it as the 'asterisk' user...Yes. Determined Asterisk version to be: 20.7.0
Checking if NodeJS is installed and we can get a version from it...Yes. Determined NodeJS version to be: 12.22.9
Preliminary checks done. Starting FreePBX Installation
Checking if this is a new install...Yes (No /etc/freepbx.conf file detected)
Database Root installation checking credentials and permissions..Connected!
PHP Fatal error:  Declaration of FreePBX\Database::query() must be compatible with PDO::query(string $query, ?int $fetchMode = null, mixed ...$fetchModeArgs): PDOStatement|false in /root/asterisk-20.7.0/freepbx/amp_conf/htdocs/admin/libraries/BMO/Database.class.php on line 240

Can someone help? I am trying to build FreePBX on Amazon EC2

Had an issue with this because Ubuntu22 uses php8.x by default (which is not supported for FreePBX), you should install PHP7.x (7.4 in my case) and either remove those php8.x packets or set alternatives.