• xampp
  • how to install and enable gmp in xampp ubuntu?

how to install and enable gmp in xampp ubuntu?

Error
[20-Dec-2024 13:56:33 UTC] PHP Warning: PHP Startup: Unable to load dynamic library 'gmp' (tried: /opt/lampp/lib/php/extensions/no-debug-non-zts-20220829/gmp (/opt/lampp/lib/php/extensions/no-debug-non-zts-20220829/gmp: cannot open shared object file: No such file or directory), /opt/lampp/lib/php/extensions/no-debug-non-zts-20220829/gmp.so (/opt/lampp/lib/php/extensions/no-debug-non-zts-20220829/gmp.so: cannot open shared object file: No such file or directory)) in Unknown on line 0

Run following commands

$ sudo apt update
$ sudo apt install libgmp-dev -y
$ dpkg-query -L php8.2-gmp
$ cd /opt/lampp/lib/php/extensions/no-debug-non-zts-20220829/
$ cp /usr/lib/php/20220829/gmp.so .
$ chmod 755 .
$ /opt/lampp/lampp restart

and then make a changes in php.ini

vi /opt/lampp/etc/php.ini

with following lines
extension=gmp

and then
sudo /opt/lampp/lampp restart