A fast, dependency-free, single-file PHP tool for recursively searching files and directories on the server.
This project provides a powerful web-based interface to scan directories, filter files, and search content using plain text or regular expressions all from a single index.php file.
- ⚡ High-performance recursive search
- 🔎 Content-based search (text or regex)
- 📁 File filtering by extension, name, or path
- 🚫 Exclude/include directories and files
- 🔤 Case-sensitive / insensitive search
- 🧠 Whole-word matching support
- 📊 Search statistics (files, matches, size, time)
- 📄 Line previews with highlighting
- 🛑 Binary file detection
- 📏 File size limits for safe scanning
- 🔐 Root jail protection (filesystem restriction)
- 🧾 Single-file deployment (no dependencies)
This tool provides a clean web UI to:
- Input a base directory
- Define search conditions
- Execute scans
- View matched files with highlighted results
- Clone the repository:
git clone https://github.com/BaseMax/server-side-text-search.git- Upload
index.phpto your server:
/var/www/html/index.php- Open in browser:
http://your-domain.com/index.php
Inside index.php, modify the $CONFIG array:
$CONFIG = [
'base_path' => __DIR__,
'root_jail' => __DIR__,
'max_file_bytes' => 5 * 1024 * 1024,
'max_results' => 2000,
'max_preview' => 5,
'max_depth' => 0,
];| Option | Description |
|---|---|
base_path |
Default search directory |
root_jail |
Restricts search to a safe directory |
max_file_bytes |
Max file size to scan |
max_results |
Maximum returned results |
max_depth |
Directory recursion depth |
⚠️ This tool provides direct access to your filesystem.
You MUST:
- Protect with authentication (e.g., HTTP auth)
- Restrict access via IP or VPN
- Configure
root_jailproperly - Never expose publicly without protection
- Enter a base path
- Enter text to search
- Click Search
- Regex search
- Case sensitivity toggle
- Whole word matching
- Include/exclude filters
- File extension filtering
| Use Case | Input |
|---|---|
| Find PHP functions | function\s+\w+\( (Regex ON) |
| Find exact word | Enable "Whole word" |
| Only PHP files | php in extensions |
| Exclude vendor | vendor in ignore dirs |
Each result shows:
- File path
- Match count
- File size
- Last modified time
- Preview lines with highlights
- Pure PHP (no frameworks)
- Recursive directory traversal
- Line-by-line file scanning
- Memory-efficient processing
- Early stopping via caps
- Skips large files (configurable)
- Avoids binary files automatically
- Limits results for responsiveness
- Uses streaming (
fgets) instead of loading full files
.
├── index.php # Main application (single file)
├── README.md
└── LICENSE
- Debugging large codebases
- Searching logs on production servers
- Finding hardcoded values
- Security audits
- DevOps file inspection
This project is licensed under the GPL-3.0 License.
If you find this project useful:
- Star the repository ⭐
- Share it with others
- Contribute improvements
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
- CLI version
- API endpoint support
- Export results (JSON/CSV)
- Async scanning
- Multi-threading (via extensions)
This tool is provided "as-is" without any warranties. Use at your own risk, especially in production environments.
Copyright © 2026 Seyyed Ali Mohammadiyeh (Max Base) All rights reserved.