1000 FAQs, 500 tutorials and explanatory videos. Here, there are only solutions!
Understand connection times to MySQL / MariaDB
This guide concerns the time limits for connection to MySQL databases on the Web hosting Infomaniak in the context of a web application using PHP to interact with the database.
Connection time to MySQL databases
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 the necessary operations before the connection is automatically closed by the MySQL server.
This limit is usually defined in the MySQL server configuration and can be adjusted to the specific needs of the application.
PHP CPU time
Limited to 10 seconds
This limit refers to the CPU time allocated to running PHP scripts on the server; when a PHP script is executed, the Web server allocates some CPU time to process this script... so if the script takes more than 10 seconds to run, it will be automatically interrupted by the Web server to avoid excessive consumption of server 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 the queries and process the results, while respecting the limit of 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, as the case may be, which may result in unexpected errors or behaviors in the application.