Zen Cart Logo
Forums / General Questions / PHP Warning: mysqli_connect() - Operation not permitted

PHP Warning: mysqli_connect() - Operation not permitted

Views: 1

Results 1 to 1 of 1
22 Sep 2026, 8:00 AM [edited]
#1
yesaul avatar

yesaul

New Zenner

Join Date:
Apr 2011
Location:
Espoo, Finland
Posts:
72
Plugin Contributions:
0

PHP Warning: mysqli_connect() - Operation not permitted

Good day,

I have been using Hostinger's shared hosting (www.hostinger.com) for my Zen Cart store for a long time

(no setup changes, nor hosting plan changes recently)

A while ago, I started receiving the following error message:

PHP Warning: mysqli_connect(): (HY000/2002): Operation not permitted in /includes/classes/db/mysql/query_factory.php

which occurs at the following line in query_factory.php:

$this->link = mysqli_connect($db_host, $db_user, $db_password, $db_name, (defined('DB_PORT') ? DB_PORT : null), (defined('DB_SOCKET') ? DB_SOCKET : null));

Before contacting the hosting provider's support or asking stupid questions here, I checked Hostinger's knowledge base and found the following information:

If your website is showing a database connection error such as:

  • PHP Fatal error: Uncaught mysqli_sql_exception: Operation not permitted

  • Connection failed: Operation not permitted

  • ERROR: Could not connect. Operation not permitted

  • SQLSTATE[HY000] [2002] Operation not permitted

This means your website is likely opening a new MySQL connection on every page request, instead of reusing an existing one. Hostinger enforces a per-account MySQL connection rate limit (20 new connections per second) to ensure fair resource usage across all customers. Websites that open a fresh connection on every request can exceed this limit during traffic bursts, causing the error above.

To resolve the issue, you just need to switch to persistent MySQL connections.

Find the line that looks like this:

mysqli_connect("localhost", $user, $pass, $db);

Change "localhost" to "p:localhost":

mysqli_connect("p:localhost", $user, $pass, $db);

The "p:" prefix tells PHP to use a persistent connection, keeping it open across requests instead of creating a new one each time.

As I am definitely not an expert in databases, could some of the gurus here possibly share their opinion on whether this could really be a solution? (a reliable and safe solution, I mean - I am afraid to check this on my running database, but I cannot simulate this error in a test environment)

Thank you in advance

Zen Cart 2.2.2 PHP Version: 8.3.33 Database Engine: MySQL 11.8.9-MariaDB-log