To install BCMath (PHP BCMath extension), use the command based on your OS and PHP version.
Ubuntu / Debian
For the default PHP version:
apt updateapt install php-bcmath -y
For a specific PHP version:
apt install php8.2-bcmath -y
## Replace 8.2 with your installed PHP version if needed.
Restart Web Server
After installation, restart your web server.
Apache
systemctl restart apache2
Nginx + PHP-FPM
systemctl restart php8.2-fpmsystemctl restart nginx
Verify BCMath Installation
php -m | grep bcmath
Or:
php -i | grep BCMath