With php it actually makes a difference in which order the packages are installed so that no unnecessary php SAPIs are installed. In the description the packages are neatly sorted alphabetically but that is wrong. You should always install php8.2-cli first (to stay with version 8.2 in my example), otherwise SAPIs like php8.2-phpdbg are installed, which are absolutely superfluous. Then php-fpm packages are installed there, not only for 8.2 but also for 8.1 and 8.3.