To edit php.ini file in ubunto needs to follow this code .
sudo -i gedit /etc/php/7.4/cli/php.ini
7.4 here is php version. Needs to adjust the correct php version before executing this command.
After editing needs to restart apache server.
sudo systemctl restart apache2