Zend certified PHP/Magento developer

PDOException: SQLSTATE[HY000] [2002] No such file or directory error fixed, but now website is very slow / unresponsive

Before the fix, I tried to install the printful module, got through to Step 3 to where you enable the module and paused half way through execution. The front or back-end wasn’t loading and after ages of trying to load it, it gave me this error on my browser:

error

I followed this link on fixing this error, changing localhost to 127.0.0.1. This worked, as I can log in to the back-end and the front-end loads but is taking forever to load to the next page that I navigate to, sometimes so long that it times the admin account out and goes back to the login.

I’ve allocated 2G in the PHP memory_limit, but when I go to bin/magento c:c
I get this error:

mmap() failed: [12] Cannot allocate memory
PHP Fatal error:  Out of memory (allocated 10485760) (tried to allocate 12288 bytes) in /var/www/html/vendor/zendframework/zend-uri/src/Uri.php on line 1024

I am so confused.