PHP Server Health Wiki - birender/PHP-SERVER-HEALTH GitHub Wiki

PHP Server Health

PHP Server Health is a lightweight Linux server health monitoring and performance-tuning CLI tool written in pure PHP.

It helps PHP developers and Linux administrators quickly inspect the health of a production server and identify potential PHP-FPM, Apache, PHP, and system-level performance issues.

🚀 What Does It Do?

PHP Server Health brings several common server checks into a single command:

                    PHP Server Health
                           │
          ┌────────────────┼────────────────┐
          │                │                │
          ▼                ▼                ▼
       System             PHP           Services
          │                │                │
     ┌────┼────┐      ┌────┴────┐      ┌────┴────┐
     │    │    │      │         │      │         │
    CPU  RAM  Disk   PHP     OPcache  PHP-FPM  Apache
     │    │    │
     └────┴────┘
          │
          ▼
    Health Analysis
          │
          ▼
   Performance Tuning

✨ Key Features

System Health

  • CPU information

  • CPU load

  • Memory usage

  • Swap usage

  • Disk usage

  • System uptime

  • Operating system information

  • Kernel information

PHP

  • PHP version

  • PHP configuration

  • PHP extensions

  • OPcache status

  • OPcache configuration

PHP-FPM

  • PHP-FPM service status

  • Worker configuration

  • Worker utilization

  • Average worker memory

  • Maximum worker memory

  • pm.max_children

  • pm.start_servers

  • pm.min_spare_servers

  • pm.max_spare_servers

Apache

  • Apache service status

  • Apache version

  • Apache MPM

  • MaxRequestWorkers

  • ThreadsPerChild

  • ServerLimit

Performance Tuning

The tuning engine analyzes the server's:

  • CPU capacity

  • Available memory

  • PHP-FPM worker memory

  • PHP-FPM configuration

  • Apache configuration

and generates recommendations.

[!IMPORTANT]
PHP Server Health provides recommendations. It does not automatically modify your production configuration.


📦 Installation

Clone from GitHub

git clone https://github.com/birender/PHP-SERVER-HEALTH.git
cd PHP-SERVER-HEALTH

Make the CLI executable:

chmod +x bin/php-server-health

Run:

./bin/php-server-health

Global Installation

If the installation script is available:

sudo ./install.sh

Then:

php-server-health

⚡ Quick Start

Run the normal health check:

php-server-health

Run performance analysis:

sudo php-server-health --tune

Display help:

php-server-health --help

🔧 Performance Tuning

The --tune command is one of the main features of PHP Server Health.

sudo php-server-health --tune

It analyzes the relationship between:

CPU
 │
 ├── CPU cores
 │
 └── Load

Memory │ ├── Available RAM │ └── PHP-FPM Worker RSS

PHP-FPM │ ├── max_children ├── start_servers ├── min_spare_servers └── max_spare_servers

Apache │ ├── MaxRequestWorkers ├── ThreadsPerChild └── ServerLimit

The result is a set of recommended values that can be reviewed before applying changes.


🛡️ Safety

PHP Server Health is designed to be a diagnostic tool.

The tuning engine should not directly overwrite production configuration files.

Before applying any recommendation:

  1. Backup the configuration.

  2. Review the recommended values.

  3. Apply changes gradually.

  4. Validate the configuration.

  5. Reload the affected service.

  6. Monitor the server.

Example:

sudo cp /etc/php/8.3/fpm/pool.d/www.conf 
/etc/php/8.3/fpm/pool.d/www.conf.backup

🖥️ Typical Production Stack

PHP Server Health is particularly useful for servers running:

Ubuntu / Debian
│
▼
Apache
│
▼
PHP-FPM
│
▼
PHP
│
▼
MySQL

It can help investigate problems such as:

  • High CPU

  • High RAM consumption

  • PHP-FPM worker saturation

  • Too few PHP-FPM workers

  • Too many PHP-FPM workers

  • Apache worker limitations

  • OPcache configuration issues

  • Low disk space

  • Swap pressure

  • Failed services


📚 Documentation

Topic Description
Installation Installing PHP Server Health
Quick Start Run your first health check
Commands CLI commands and options
Server Health Checks Understanding health checks
PHP-FPM Tuning PHP-FPM analysis and tuning
Apache Tuning Apache performance analysis
Configuration Configuration options
Troubleshooting Common problems
Development Development environment
Contributing How to contribute
Roadmap Planned features

🏗️ Project Architecture

PHP-SERVER-HEALTH/
│
├── bin/
│   └── php-server-health
│
├── config/
│
├── src/
│   ├── System/
│   ├── PHP/
│   ├── PHPFPM/
│   ├── Apache/
│   └── ...
│
├── systemd/
│
├── install.sh
├── composer.json
├── LICENSE
└── README.md

The application is designed around independent health-check modules so that additional checks can be added without rewriting the entire application.


🎯 Project Goals

The long-term goal is to provide a practical command-line toolkit for PHP production environments.

Planned areas include:

  • MySQL health

  • Network health

  • TCP connections

  • Port monitoring

  • PHP-FPM statistics

  • Apache statistics

  • Historical metrics

  • Health scoring

  • JSON output

  • CI/CD integration

  • Alerting

  • Web dashboard


🤝 Contributing

Contributions are welcome.

You can contribute by:

  • Reporting bugs

  • Improving documentation

  • Adding health checks

  • Improving Linux compatibility

  • Improving tuning algorithms

  • Adding tests

  • Improving performance

See the Contributing page for details.


🔗 Links

GitHub Repository

https://github.com/birender/PHP-SERVER-HEALTH

Issues

https://github.com/birender/PHP-SERVER-HEALTH/issues


⭐ Support

If PHP Server Health is useful to you:

⭐ Star the repository

🐛 Report bugs

💡 Suggest features

🤝 Contribute


Know your server before your server tells you there is a problem.

# PHP Server Health

PHP Server Health is a lightweight Linux server health monitoring and performance-tuning CLI tool written in pure PHP.

It helps PHP developers and Linux administrators quickly inspect the health of a production server and identify potential PHP-FPM, Apache, PHP, and system-level performance issues.

🚀 What Does It Do?

PHP Server Health brings several common server checks into a single command:

                    PHP Server Health
                           │
          ┌────────────────┼────────────────┐
          │                │                │
          ▼                ▼                ▼
       System             PHP           Services
          │                │                │
     ┌────┼────┐      ┌────┴────┐      ┌────┴────┐
     │    │    │      │         │      │         │
    CPU  RAM  Disk   PHP     OPcache  PHP-FPM  Apache
     │    │    │
     └────┴────┘
          │
          ▼
    Health Analysis
          │
          ▼
   Performance Tuning

✨ Key Features

System Health

  • CPU information
  • CPU load
  • Memory usage
  • Swap usage
  • Disk usage
  • System uptime
  • Operating system information
  • Kernel information

PHP

  • PHP version
  • PHP configuration
  • PHP extensions
  • OPcache status
  • OPcache configuration

PHP-FPM

  • PHP-FPM service status
  • Worker configuration
  • Worker utilization
  • Average worker memory
  • Maximum worker memory
  • pm.max_children
  • pm.start_servers
  • pm.min_spare_servers
  • pm.max_spare_servers

Apache

  • Apache service status
  • Apache version
  • Apache MPM
  • MaxRequestWorkers
  • ThreadsPerChild
  • ServerLimit

Performance Tuning

The tuning engine analyzes the server's:

  • CPU capacity
  • Available memory
  • PHP-FPM worker memory
  • PHP-FPM configuration
  • Apache configuration

and generates recommendations.

Important

PHP Server Health provides recommendations. It does not automatically modify your production configuration.


📦 Installation

Clone from GitHub

git clone https://github.com/birender/PHP-SERVER-HEALTH.git
cd PHP-SERVER-HEALTH

Make the CLI executable:

chmod +x bin/php-server-health

Run:

./bin/php-server-health

Global Installation

If the installation script is available:

sudo ./install.sh

Then:

php-server-health

⚡ Quick Start

Run the normal health check:

php-server-health

Run performance analysis:

sudo php-server-health --tune

Display help:

php-server-health --help

🔧 Performance Tuning

The --tune command is one of the main features of PHP Server Health.

sudo php-server-health --tune

It analyzes the relationship between:

CPU
 │
 ├── CPU cores
 │
 └── Load

Memory
 │
 ├── Available RAM
 │
 └── PHP-FPM Worker RSS

PHP-FPM
 │
 ├── max_children
 ├── start_servers
 ├── min_spare_servers
 └── max_spare_servers

Apache
 │
 ├── MaxRequestWorkers
 ├── ThreadsPerChild
 └── ServerLimit

The result is a set of recommended values that can be reviewed before applying changes.


🛡️ Safety

PHP Server Health is designed to be a diagnostic tool.

The tuning engine should not directly overwrite production configuration files.

Before applying any recommendation:

  1. Backup the configuration.
  2. Review the recommended values.
  3. Apply changes gradually.
  4. Validate the configuration.
  5. Reload the affected service.
  6. Monitor the server.

Example:

sudo cp /etc/php/8.3/fpm/pool.d/www.conf \
        /etc/php/8.3/fpm/pool.d/www.conf.backup

🖥️ Typical Production Stack

PHP Server Health is particularly useful for servers running:

Ubuntu / Debian
      │
      ▼
    Apache
      │
      ▼
   PHP-FPM
      │
      ▼
     PHP
      │
      ▼
    MySQL

It can help investigate problems such as:

  • High CPU
  • High RAM consumption
  • PHP-FPM worker saturation
  • Too few PHP-FPM workers
  • Too many PHP-FPM workers
  • Apache worker limitations
  • OPcache configuration issues
  • Low disk space
  • Swap pressure
  • Failed services

📚 Documentation

Topic Description
[Installation](Installation) Installing PHP Server Health
[Quick Start](Quick-Start) Run your first health check
[Commands](Commands) CLI commands and options
[Server Health Checks](Server-Health-Checks) Understanding health checks
[PHP-FPM Tuning](PHP-FPM-Tuning) PHP-FPM analysis and tuning
[Apache Tuning](Apache-Tuning) Apache performance analysis
[Configuration](Configuration) Configuration options
[Troubleshooting](Troubleshooting) Common problems
[Development](Development) Development environment
[Contributing](Contributing) How to contribute
[Roadmap](Roadmap) Planned features

🏗️ Project Architecture

PHP-SERVER-HEALTH/
│
├── bin/
│   └── php-server-health
│
├── config/
│
├── src/
│   ├── System/
│   ├── PHP/
│   ├── PHPFPM/
│   ├── Apache/
│   └── ...
│
├── systemd/
│
├── install.sh
├── composer.json
├── LICENSE
└── README.md

The application is designed around independent health-check modules so that additional checks can be added without rewriting the entire application.


🎯 Project Goals

The long-term goal is to provide a practical command-line toolkit for PHP production environments.

Planned areas include:

  • MySQL health
  • Network health
  • TCP connections
  • Port monitoring
  • PHP-FPM statistics
  • Apache statistics
  • Historical metrics
  • Health scoring
  • JSON output
  • CI/CD integration
  • Alerting
  • Web dashboard

🤝 Contributing

Contributions are welcome.

You can contribute by:

  • Reporting bugs
  • Improving documentation
  • Adding health checks
  • Improving Linux compatibility
  • Improving tuning algorithms
  • Adding tests
  • Improving performance

See the [Contributing](Contributing) page for details.


🔗 Links

GitHub Repository

https://github.com/birender/PHP-SERVER-HEALTH

Issues

https://github.com/birender/PHP-SERVER-HEALTH/issues


⭐ Support

If PHP Server Health is useful to you:

⭐ Star the repository

🐛 Report bugs

💡 Suggest features

🤝 Contribute


Know your server before your server tells you there is a problem.``

⚠️ **GitHub.com Fallback** ⚠️