1000 FAQs, 500 tutorials and explanatory videos. Here, there are only solutions!
Understand the connection durations to MySQL / MariaDB
This guide concerns the connection time limits for MySQL databases on Infomaniak Web Hosting in the context of a Web application using PHP to interact with the database.
MySQL database connection time
Limited to 30 real seconds
This means that when a connection is established between the PHP application and the MySQL database, it has 30 seconds to perform all necessary operations before the connection is automatically closed by the MySQL server.
This limit is generally set in the MySQL server configuration and can be adjusted according to the specific needs of the application.
PHP CPU time
Limited to 10 seconds
This limit refers to the CPU time allocated to the execution of PHP scripts on the server; when a PHP script is executed, the web server allocates a certain amount of CPU time to process this script... so if the script takes more than 10 seconds to execute, it will be automatically interrupted by the web server to avoid excessive consumption of the server's resources.
By combining these two limits, this means that for any operation involving a connection to a MySQL database from PHP, the application has 30 real seconds to establish the connection, execute queries, and process results, while respecting the 10 seconds of CPU time allocated to the execution of the PHP script.
If an operation exceeds one of these limits, it may be interrupted by the MySQL server or the web server, depending on the case, which can result in errors or unexpected behavior in the application.