Another possibility is to write a healthcheck in whatever language on the web/application server, which also checks the backend database and use this healthcheck on the pool. Then, your backend server will be active only when also the database is OK.
So, for example:
- F5 does a HTTP healthcheck and requests /health_check.php every 5 seconds.
- On the backend server, the PHP-script health_check.php performs a simple DB request. If it's ok, the script returns "ALL OK", if it fails, the script writes "NOT OK".
- F5 healthcheck looks for "ALL OK" in server's response. If it's there, then the pool member is active, if not, then member is disabled.