PHPackages                             wunderio/drupal-ping - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [HTTP &amp; Networking](/categories/http)
4. /
5. wunderio/drupal-ping

ActiveWeb-dropin[HTTP &amp; Networking](/categories/http)

wunderio/drupal-ping
====================

Drupal health check endpoint for load balancers

2.5.6(1y ago)4241.7k—4.4%5[10 issues](https://github.com/wunderio/drupal-ping/issues)[2 PRs](https://github.com/wunderio/drupal-ping/pulls)1MITPHP

Since Jun 8Pushed 1y ago8 watchersCompare

[ Source](https://github.com/wunderio/drupal-ping)[ Packagist](https://packagist.org/packages/wunderio/drupal-ping)[ Docs](https://github.com/wunderio/drupal-ping)[ RSS](/packages/wunderio-drupal-ping/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (3)Versions (28)Used By (1)

Drupal ping helper
==================

[](#drupal-ping-helper)

[![Build Status](https://camo.githubusercontent.com/19684944a86de86ec646022413a730f5b2604a2e36de03516c7f8081e5188930/68747470733a2f2f7472617669732d63692e6f72672f77756e646572696f2f64727570616c2d70696e672e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/wunderio/drupal-ping) [![Latest Stable Version](https://camo.githubusercontent.com/5c28d91dc72ebf6f56cd99ad27ca3f861c83c830bb7c6abb0f942ad7a2b7e5e0/68747470733a2f2f706f7365722e707567782e6f72672f77756e646572696f2f64727570616c2d70696e672f762f737461626c65)](https://packagist.org/packages/wunderio/drupal-ping) [![Total Downloads](https://camo.githubusercontent.com/bc097cef06b4c4ab90a5aaebf7eedb494b156f499d41ea71714092c9a530ab8b/68747470733a2f2f706f7365722e707567782e6f72672f77756e646572696f2f64727570616c2d70696e672f646f776e6c6f616473)](https://packagist.org/packages/wunderio/drupal-ping) [![Latest Unstable Version](https://camo.githubusercontent.com/b587b9f484754fc0dd5228a997a1088558edda5d67c5647025d33355004f54c9/68747470733a2f2f706f7365722e707567782e6f72672f77756e646572696f2f64727570616c2d70696e672f762f756e737461626c65)](https://packagist.org/packages/wunderio/drupal-ping) [![License](https://camo.githubusercontent.com/73cf886c77084784d0319c26fb56948422baf50f08ebe02af0c227d9f2ab68dc/68747470733a2f2f706f7365722e707567782e6f72672f77756e646572696f2f64727570616c2d70696e672f6c6963656e7365)](https://packagist.org/packages/wunderio/drupal-ping)

This script can be used for Drupal8 through Drupal11 uptime monitoring. It is not suitable for subsystem health-checks for things like container or load balancer.

Installation
------------

[](#installation)

1. Add this to your `composer.json`:

```
{
    "extra": {
        "dropin-paths": {
            "web/": [
                "type:web-dropin",
                "package:wunderio/drupal-ping:_ping.php"
            ]
        }
    }
}
```

2. Then install the composer package as usual with:

```
composer require wunderio/drupal-ping:^2

```

3. Add `_ping.php` into the main project's `.gitignore`.

Changelog
---------

[](#changelog)

See [Releases](https://github.com/wunderio/drupal-ping/releases).

Usage
-----

[](#usage)

- Visit `/_ping.php` to get a system status
- By using `?debug=token` additional status check table and time profiling information is displayed
    - See [Debug Mode](#debug-mode) how to obtain the `token` value
- Find slow checks and checks errors in logs

Checks
------

[](#checks)

### Main database

[](#main-database)

User #1 record is fetched from the database.

### Memcache

[](#memcache)

Assumes `$settings['memcache']['servers']` presence in the `settings.php`.

Following statuses are issued:

- `disabled` - No memcached servers defined in settings
- `success` - All connections succeed
- `warning` - At least one connection succeeds, at least one connection fails
- `error` - All connections fail

Basic networking is used, no `Memcached` or `Memcache` class.

### Redis

[](#redis)

By using `Redis` class, connection is established to the server.

In `settings.php` following has to be defined:

- `$settings['redis.connection']['host']`
- `$settings['redis.connection']['port']`

This test works on both TCP and Unix Sockets. For the latter only `host` has to be defined as path.

### Elasticsearch

[](#elasticsearch)

In `settings.php` following has to be defined:

```
$settings['ping_elasticsearch_connections'] = [
  [
    'host' => 'hostname',
    'port' => 1234,
    'proto' => 'http', // http or https
    'severity' => 'warning', // warning or error
  ],
];

```

Elasticsearch check requires separate setting, because there are too many ways how Elasticsearch config can be defined in the `settings.php` file, depending on many factors.

The connection is establised by PHP `curl`, and then `/_cluster/health` is being visited. The check expects to get `green` status in the response.

Following statuses are issued:

- `disabled` - No Elasticsearch servers defined in settings
- `success` - All connections succeed
- `warning` - At least one connection failed, and all failed connections have been configured with 'severity' = 'warning'
- `error` - At least one connection failed, and at least one of the failed connections have been configured with 'severity' = 'error'

### FS Scheme

[](#fs-scheme)

Consists of 3 tests:

- Check if a file can be created within the public filesystem.
- Check if the test-file can be deleted from the public filesystem.
- Check if there are any leftover test-files, and remove them.

### Custom ping

[](#custom-ping)

If a site needs any custom checks, then just create `_ping.custom.php`. Use of `$status->setName()` and `$status->set()` to define the result. The PHP file does not need to contain functions, just plain PHP is enough. Check it out how other checks are created in the `_ping.php`.

Debug Mode
----------

[](#debug-mode)

`_ping.php` can be accessed over the web. For example `https://example.com/_ping.php`. It can also be accessed from the shell `cd /path/web ; php _ping.php`. From the shell output the debug token can be attained. Then visit the ping again with `https://example.com/_ping.php?debug=token`.

The token is generated in one of the following ways. These methods are listed by precedance. If earlier fails (is empty), then next one is tried.

- Drupal settings `$settings['ping_token']`
- Environment variable `PING_TOKEN`
- Md5 of the combination of environment variable values where the variable names matches regex `/^(DB|ENVIRONMENT_NAME|GIT|PHP|PROJECT_NAME|S+MTP|VARNISH|WARDEN)/` - NB! This method assumes environment variable consistency between webserver and shell.
- Md5 of Drupal settings `$settings['hash_salt']`
- Md5 of the hostname

Ping Development &amp; Testing
------------------------------

[](#ping-development--testing)

### Setting up development environment

[](#setting-up-development-environment)

1. Clone development and testing environment

- `git clone git@github.com:wunderio/drupal-project.git ~/projects/drupal-ping`
- Yes, save it as `drupal-ping`.

1. `cd drupal-ping/`
2. Clone the ping project itself

- `git clone git@github.com:wunderio/drupal-ping.git`
- Yes, save it as `drupal-ping` too, inside the folder of the same name. It is the actual repo we are going to work with.
- Checkout or create your development branch.

1. Link `.lando.yml`

- `rm -f .lando.yml` - at the top-level folder, remove the Lando conf file.
- `ln drupal-ping/.lando.yml` - link the Lando conf from the ping repo folder. Don't create this as a soft (`-s`) link because Lando would mount the project where the original file is. Therefore create the hard link which is indistinguishable for Lando.

1. Link `.lando/`

- `rm -rf .lando` - at the top-level folder, remove the Lando folder.
- `ln -s drupal-ping/.lando` - link the Lando scripts folder from the ping repo folder.

1. `lando start`
2. Note that the Drupal install will mess up `settings.php` a bit, don't commit.
3. [https://ping.lndo.site/\_ping.php](https://ping.lndo.site/_ping.php)
4. `lando scan`
5. `lando test`

### Development commands

[](#development-commands)

- `lando test` - Execute phpunit tests
- `lando scan` - Run coding standard checks

Maintainers
-----------

[](#maintainers)

- [Janne Koponen](https://github.com/tharna)
- [Ragnar Kurm](https://github.com/ragnarkurmwunder)
- [Juhani Moilanen](https://github.com/Juhani-moilanen)

License
-------

[](#license)

MIT

###  Health Score

43

—

FairBetter than 91% of packages

Maintenance24

Infrequent updates — may be unmaintained

Popularity39

Limited adoption so far

Community23

Small or concentrated contributor base

Maturity73

Established project with proven stability

 Bus Factor1

Top contributor holds 65.3% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~141 days

Recently: every ~170 days

Total

21

Last Release

439d ago

Major Versions

1.0.2 → 2.0.02022-03-30

2.2.2 → 7.x-dev2022-04-27

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/3274758?v=4)[Wunder](/maintainers/wunderio)[@wunderio](https://github.com/wunderio)

---

Top Contributors

[![ragnarkurmwunder](https://avatars.githubusercontent.com/u/28702260?v=4)](https://github.com/ragnarkurmwunder "ragnarkurmwunder (79 commits)")[![Juhani-moilanen](https://avatars.githubusercontent.com/u/107038594?v=4)](https://github.com/Juhani-moilanen "Juhani-moilanen (16 commits)")[![tharna](https://avatars.githubusercontent.com/u/809233?v=4)](https://github.com/tharna "tharna (10 commits)")[![hkirsman](https://avatars.githubusercontent.com/u/492375?v=4)](https://github.com/hkirsman "hkirsman (6 commits)")[![onnimonni](https://avatars.githubusercontent.com/u/5691777?v=4)](https://github.com/onnimonni "onnimonni (4 commits)")[![ArtisKrumins](https://avatars.githubusercontent.com/u/17612248?v=4)](https://github.com/ArtisKrumins "ArtisKrumins (1 commits)")[![tormi](https://avatars.githubusercontent.com/u/146800?v=4)](https://github.com/tormi "tormi (1 commits)")[![floretan](https://avatars.githubusercontent.com/u/159229?v=4)](https://github.com/floretan "floretan (1 commits)")[![Jancis](https://avatars.githubusercontent.com/u/635571?v=4)](https://github.com/Jancis "Jancis (1 commits)")[![laurisigaunis](https://avatars.githubusercontent.com/u/11645313?v=4)](https://github.com/laurisigaunis "laurisigaunis (1 commits)")[![Rade333](https://avatars.githubusercontent.com/u/922901?v=4)](https://github.com/Rade333 "Rade333 (1 commits)")

---

Tags

drupalpinghealthcheck

### Embed Badge

![Health badge](/badges/wunderio-drupal-ping/health.svg)

```
[![Health](https://phpackages.com/badges/wunderio-drupal-ping/health.svg)](https://phpackages.com/packages/wunderio-drupal-ping)
```

###  Alternatives

[acquia/orca

A tool for testing a company's software packages together in the context of a realistic, functioning, best practices Drupal build

32902.4k](/packages/acquia-orca)[garf/laravel-pinger

Ping search engines about website updates

2422.2k](/packages/garf-laravel-pinger)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
