๐ ZTeraDB Troubleshooting Guide
If you see errors like:
Connection failed
Invalid configuration
FilterCondition error
PHP Fatal error: Class not found
Could not connect to host
This guide will help you fix them quickly.
๐ 1. Configuration Errors
โ Error:โ
Missing or invalid client_key / access_key / secret_key
โ Fix:โ
Make sure your .env contains all required fields:
CLIENT_KEY=your-client-key
ACCESS_KEY=your-access-key
SECRET_KEY=your-secret-key
DATABASE_ID=your-database-id
ZTERADB_HOST=db1.zteradb.com
ZTERADB_PORT=7777
And load them correctly:
getenv('CLIENT_KEY');
โ Error:โ
Invalid value for env
โ Allowed values:
dev
staging
qa
prod
๐ 2. Connection Errors
โ Error:โ
Connection refused
โ Fix:โ
- Check host
Should be something like:
db1.zteradb.com - Check port
Usually:7777 - Ensure WiFi / VPN / Firewall is not blocking outbound TCP
โ Error:โ
Connection timeout (ETIMEDOUT)
โ Fix:โ
- Retry
- Ensure server is reachable
- Try simple curl test
curl http://db1.zteradb.com:7777
๐ฆ 3. Class / Import Errors
โ Error:โ
PHP Fatal error: Class "ZTeraDB\Config\ZTeraDBConfig" not found
โ Fix:โ
Run:
composer dump-autoload
Ensure autoload is included:
require_once "vendor/autoload.php";
๐งฑ 4. Query Errors
โ Error:โ
Missing query type: select / insert / update / delete
โ Fix:
(new ZTeraDBQuery("user"))->select();
โ Error:โ
Fields are required for INSERT or UPDATE
โ Fix:
$query->insert()->fields(['email' => 'test@test.com']);
๐ 5. FilterCondition Errors
โ Error:โ
Invalid parameters passed to ZTMUL
โ Fix: Always pass arrays:
ZTMUL(['price', 'quantity']);
โ Error:โ
Invalid filter: expected array
โ Fix:
ZTAND([$condition1, $condition2]);
๐งช 7. Debugging Tips
โ Tip 1 โ Print Raw Queryโ
echo $query->generate();
โ Tip 2 โ Try a Simple Queryโ
(new ZTeraDBQuery("user"))->select();
โ Tip 3 โ Re-check Keysโ
Most errors come from wrong credentials.
๐ If Still Not Working
Share the error message, and Weโll fix it immediately.