PHP extension stopped working right after installing another extension

I am using a NGINX server on a VPS enviorment where i have enabled the following extensions: sqlite3, gd, curl. When i tested my application on local host with the same extensions enabled everything seems to work fine, but when i tried to set it up on my server it does not recognize gd anymore. What is more weird is that this happened right after i installed curl, which makes no sense.

I have enabled the extensions in php.ini + I have the accordingly versions installed on my Ubuntu distribution. i have tried phpinfo() and it does not seem to say anything about gd at all, besides curl and sqlite, while running php -m does show the gd module.

I am using FastCGI to run php on nginx and it fails everytime just like this when i try to create an image:
*1 FastCGI sent in stderr: "PHP message: PHP Fatal error: Uncaught Error: Call to undefined function imagecreate() in /home/panel/captcha.php:6

I tried restarting nginx multiple times but to no avail.

When I didn’t have curl installed it ran completely fine, I have genuinely no idea how it ended up like this.
I am using PHP 8.1.2-1ubuntu2.14, and have installed php8.1-gd and curl 7.81.0