phpMan

Unix Man Page / Perldoc / Info Page Web Interface

About

phpMan is a single-file PHP web interface for Unix man, perldoc, info, and apropos commands. It makes it easier to read lengthy manual pages in your browser — with syntax highlighting, section navigation, and a floating table of contents.

Originally created in 2002 by Che Dong, phpMan has been continuously maintained and is compatible with PHP 8.x on GNU/Linux and FreeBSD.

PHP 8.x GPLv2 Single-file XHTML 1.0 Markdown output JSON API MCP Server MCP Format TOC sidebar

Screenshot

phpMan: perldoc page rendered with syntax highlighting and TOC sidebar
phpMan displaying a perldoc page with syntax highlighting and TOC sidebar

Live Demo

The phpMan demo is hosted on chedong.com with full PHP support. Try it now:

🔍 Open Live Demo

Direct link: https://www.chedong.com/phpMan.php

Features

Man Pages — Browse any Unix/Linux manual page by section
Perldoc — Read Perl module documentation in-browser
Info Pages — View GNU info documentation
Apropos Search — Full-text search across man page summaries
TOC Sidebar — Two-level floating table of contents
JSON / Markdown / MCP — Append /json, /markdown, or /mcp for structured output
🆕 MCP Server — Model Context Protocol endpoint for AI agent integration
SEO Optimized — Canonical URLs, meta description, robots directives
Clean URLs — PATH_INFO routing: /man/ls/1

🆕 MCP Server — AI Agent Integration

phpMan now exposes a Model Context Protocol (MCP) endpoint, enabling AI agents to query Unix manual pages programmatically. Compatible with Hermes Agent, Claude Desktop, and any MCP-compatible client.

Endpoint:

POST https://www.chedong.com/phpMan.php/mcp

Available Tools:

  • cli_help(command, section?) — Structured man/perldoc page with sections, subsections, and synopsis
  • cli_search(query, section?) — apropos keyword search across all man pages

Hermes Agent Config:

# ~/.hermes/config.yaml
mcp_servers:
  phpman:
    url: "https://www.chedong.com/phpMan.php/mcp"
    timeout: 30

All HTML pages include MCP discovery via the Link: </phpMan.php/mcp>; rel="mcp-server" HTTP header.

🆕 MCP Format — REST GET

Append /mcp to any detail page URL for MCP-compatible output. The /mcp REST endpoint and POST /mcp tools/call return identical content format — one code path, zero redundancy.

# REST GET: same output as MCP POST tools/call
curl https://www.chedong.com/phpMan.php/man/ls/1/mcp
# → {"content":[{"type":"text","text":"{\"name\":\"ls(1)\",...}"}]}

# Search with MCP format
curl https://www.chedong.com/phpMan.php/search/cron/mcp

# Perldoc with MCP format
curl https://www.chedong.com/phpMan.php/perldoc/Digest::MD5/mcp

# Plain JSON still works unchanged:
curl https://www.chedong.com/phpMan.php/man/ls/1/json

The /json format is unchanged for backward compatibility. Use /mcp when you need the MCP content wrapper.

JSON API Output

Append /json to any detail page URL for structured JSON output:

# Man page with sections and subsections
curl https://www.chedong.com/phpMan.php/man/ls/1/json

# Apropos search results
curl https://www.chedong.com/phpMan.php/search/git/json

# Or use Accept header (works on any URL)
curl -H "Accept: application/json" https://www.chedong.com/phpMan.php/man/bash

Quick Start

Deploy phpMan on any PHP 8.x server with a single file:

# Clone the repository
git clone https://git.code.sf.net/p/phpunixman/code phpman

# Copy to your web server's document root
cp phpman/phpMan.php /var/www/html/

# Access in browser
# https://your-server/phpMan.php

For Apache 2.x, ensure AcceptPathInfo On is configured to enable clean URL routing.

Links