To modify your PHP settings you need to edit the php.ini file.
There are some possible locations on Ubuntu for php.ini like
# locate php.ini
/etc/php/8.3/apache2/php.ini
/etc/php/8.3/cgi/php.ini
/etc/php/8.3/cli/php.ini
The three files are each meant for different uses.
/etc/php/8.3/cli/php.ini is for the CLI PHP program, which you found by running php on the terminal.
/etc/php/8.3/cgi/php.ini is for the php-cgi system which isn’t specifically used in this setup.
/etc/php/8.3/apache2/php.ini is for the PHP plugin used by Apache. This is the one you need to edit for changes to be applied to your Apache setup which utilizes the in-built PHP module to Apache.
/etc/php/8.3/fpm/php.ini is for the php8-fpm processor, which is a fastcgi-compatible ‘wrapper’ for PHP processing (such as to hand off from NGINX to php8-fpm) and runs as a standalone process on the system (unlike the Apache PHP plugin).
I hope this was helpful.