A simple PHP script to test Shopware's MySQL/MariaDB database connection latency and optionally verify TLS/SSL connectivity.
- Measures database connection time in milliseconds
- Tests query execution latency
- Optional TLS/SSL connection support
- Verifies active TLS cipher when enabled
- Parses standard
DATABASE_URLenvironment variable
- PHP 7.4 or higher
- PDO MySQL extension
- MySQL or MariaDB database
Clone or download this repository:
git clone <repository-url>
cd shopware-db-connection-latency-testNo additional dependencies are required - this is a standalone PHP script.
Set the DATABASE_URL environment variable and run the script:
export DATABASE_URL="mysql://username:password@hostname:3306/database_name"
php db-latencty-test.phpTo enable TLS/SSL connection (with certificate verification disabled):
export DATABASE_URL="mysql://username:password@hostname:3306/database_name"
php db-latencty-test.php --tlsThe DATABASE_URL should follow this format:
mysql://[user]:[password]@[host]:[port]/[database]
Example:
mysql://root:mypassword@localhost:3306/shopware
Cloud Database Example:
mysql://dbuser:securepass@db.example.com:3306/production_db
The script provides the following information:
Connecting to: localhost:3306/shopware
TLS: Enabled (certificate verification disabled)
--------------------------------------------------
✓ Connection successful!
Connection time: 8.23 ms
TLS Status: Active (Cipher: TLS_AES_256_GCM_SHA384)
Query test time: 2.15 ms
- Connection time: Time to establish database connection
- TLS Status: Active cipher when TLS is enabled
- Query test time: Time to execute a simple
SELECT 1query
Make sure to set the DATABASE_URL before running the script:
export DATABASE_URL="mysql://user:pass@host:3306/dbname"Check that your DATABASE_URL follows the correct format with all required components.
- Verify database credentials
- Check that the database server is running
- Ensure network connectivity to the database host
- Verify firewall rules allow the connection
The database server may not support TLS or it's not configured. Check your MySQL/MariaDB server configuration.
- Testing database connection performance in different environments
- Diagnosing network latency issues
- Verifying TLS/SSL connectivity
- Comparing connection times between regions/cloud providers
- Performance benchmarking for Shopware or other PHP applications
MIT License.