{"id":43287068,"url":"https://github.com/ofbeaton/db-ping","last_synced_at":"2026-02-01T18:03:16.215Z","repository":{"id":57030330,"uuid":"64902605","full_name":"ofbeaton/db-ping","owner":"ofbeaton","description":"Verify a Database server is responding.","archived":false,"fork":false,"pushed_at":"2019-03-17T18:48:57.000Z","size":49,"stargazers_count":5,"open_issues_count":6,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-12-04T22:46:08.872Z","etag":null,"topics":["mysql-server","odbc","php","ping","sql-server"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ofbeaton.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-08-04T04:30:26.000Z","updated_at":"2019-04-09T15:50:46.000Z","dependencies_parsed_at":"2022-08-23T18:50:36.950Z","dependency_job_id":null,"html_url":"https://github.com/ofbeaton/db-ping","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/ofbeaton/db-ping","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ofbeaton%2Fdb-ping","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ofbeaton%2Fdb-ping/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ofbeaton%2Fdb-ping/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ofbeaton%2Fdb-ping/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ofbeaton","download_url":"https://codeload.github.com/ofbeaton/db-ping/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ofbeaton%2Fdb-ping/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28984831,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-01T17:52:09.146Z","status":"ssl_error","status_checked_at":"2026-02-01T17:49:53.529Z","response_time":56,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["mysql-server","odbc","php","ping","sql-server"],"created_at":"2026-02-01T18:03:14.007Z","updated_at":"2026-02-01T18:03:16.199Z","avatar_url":"https://github.com/ofbeaton.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# db-ping\ndb-ping verifies a database server is responding by executing a query in a timed loop.\n\n[![Latest Stable Version](https://img.shields.io/packagist/v/ofbeaton/db-ping.svg?style=flat-square)](https://packagist.org/packages/ofbeaton/db-ping)\n[![Minimum PHP Version](https://img.shields.io/badge/php-%3E%3D%205.6-8892BF.svg?style=flat-square)](https://php.net/)\n[![Build Status](https://img.shields.io/travis/ofbeaton/db-ping/master.svg?style=flat-square)](https://travis-ci.org/ofbeaton/db-ping)\n\nOptionally includes slave replication checks.\n\nPHP 5.6+ console command that uses PDO to provide the database drivers:\n- [x] MySQL\n- [x] ODBC (i.e. Microsoft SQL Server ...)\n\n## Updates\n\nThe project is considered in a usable state and feature complete.\n\nThis project is used in corporate applications. As such, the authors are unlikely to update it on a regular basis, but instead when the corporate applications that use it run into problems. You should expect updates in the 5-10yr range. \n\nIssues and PRs will be monitored, and we will continue to work with the community to provide updates as they are contributed.\n\n## Installing via phar\n\nBefore proceeding, you need a working PHP 5.6+ installation.\n\nThe recommended way to install db-ping is by downloading the phar. \n\nSee [Releases](https://github.com/ofbeaton/db-ping/releases) for downloads.\n\nNext, run the phar from the command line:\n\n\n```bash\nphp db-ping.phar help\n\nphp db-ping.phar mysql --pass=mysecretpassword\n\nphp db-ping.phar ODBC -d OdbcName -u user -p password\n```\n\n## Testing\n\n### Smoke test\nIf there is no mysql server running locally, pinging will give a `connection refused` error as below\n\n```bash\n$ php bin/db-ping mysql\nDB-PING 127.0.0.1:3306\nfrom 127.0.0.1:3306: connection refused. delay=2000ms, exec=0ms, since success=0s, since fail=0s\nfrom 127.0.0.1:3306: connection refused. delay=2000ms, exec=0ms, since success=0s, since fail=2.0006s\n```\n\n### Against a real MySql server\nLaunch a temporary mysql server:\n\n`docker run --name some-mysql --rm -e MYSQL_ROOT_PASSWORD=my-secret-pw -e MYSQL_USER=user -e MYSQL_PASSWORD=pass -p 3306:3306 mysql`\n\nWait a few seconds while it initializes, then open another terminal and ping it:\n\n```bash\n$ php bin/db-ping mysql -u user -p pass\nDB-PING 127.0.0.1:3306\nfrom 127.0.0.1:3306: connected. delay=2000ms, exec=0ms, since success=0s, since fail=0s\nfrom 127.0.0.1:3306: check passed. delay=2000ms, exec=0ms, since success=0s, since fail=0s\nfrom 127.0.0.1:3306: check passed. delay=2000ms, exec=0ms, since success=2.0022s, since fail=0s\nfrom 127.0.0.1:3306: check passed. delay=2000ms, exec=0ms, since success=4.0028s, since fail=0s\n```\n\nTo stop the dockerfile: `docker stop some-mysql`\n\n\n### Against a real database server via ODBC\n\n1. Set up your php server for [ODBC](http://php.net/manual/en/ref.pdo-odbc.php)\n2. Add the server you'd like to test against to the `/etc/odbc.ini` file (on linux)\n3. Ping it\n\n```bash\n$ php bin/db-ping ODBC -d MarketflowAcc -u rou -p rou\nDB-PING odbc:MarketflowAcc\nfrom odbc:MarketflowAcc: connected. delay=2000ms, exec=0ms, since success=0s, since fail=0s\nfrom odbc:MarketflowAcc: check passed. delay=2000ms, exec=0ms, since success=0s, since fail=0s\nfrom odbc:MarketflowAcc: check passed. delay=2000ms, exec=0ms, since success=2.0058s, since fail=0s\nfrom odbc:MarketflowAcc: check passed. delay=2000ms, exec=0ms, since success=4.0071s, since fail=0s\nfrom odbc:MarketflowAcc: check passed. delay=2000ms, exec=0ms, since success=6.0083s, since fail=0s\n```\n\nThe ping SQL query can be repeated more than once per ping with the `repeat` option. This is useful to make the ping test more stressful:\n\n```bash\n$ php bin/db-ping ODBC -d MarketflowAcc -u rou -p rou --repeat 100\n```\n\nThe output format can be controlled with the `format` option:\n\n```bash\n$ php bin/db-ping ODBC -d MarketflowAcc -u rou -p rou --repeat 100 --format te\nDB-PING odbc:MarketflowAcc\n2017-01-11 14:55:35, 0\n2017-01-11 14:55:35, 3\n2017-01-11 14:55:37, 3\n2017-01-11 14:55:39, 3\n2017-01-11 14:55:41, 3\n```\n\nAlso, `et` instead of `te` would shuffle the order\n\n### Unit tests\nRun `vbin/phing check`\n\n## License\n\nThis software is distributed under the MIT License. Please see [License file](LICENSE) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fofbeaton%2Fdb-ping","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fofbeaton%2Fdb-ping","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fofbeaton%2Fdb-ping/lists"}