[WordPress] 外掛分享: Eli’s PHP Compatibility Scanner

首頁外掛目錄 › Eli's PHP Compatibility Scanner
300+
安裝啟用
★★★★★
5/5 分(2 則評價)
47 天前
最後更新
100%
問題解決
WordPress 4.5+ PHP 7.4+ v1.1.2 上架:2025-10-10

內容簡介

總結:
這個外掛是專為開發環境(如 LocalWP、XAMPP 或自託伺服器)開發的,無法在大多數托管服務提供商(如 WP Engine、Kinsta、SiteGround 等)上運作,因為安全限制禁用了 exec() 函數並限制對 PHP 二進制文件的訪問。

問題與答案:

1. 這個外掛是為哪些環境設計的?
- 答:這個外掛是為開發環境(如 LocalWP、XAMPP 或自託伺服器)設計的。

2. 這個外掛使用什麼工具來分析 PHP 代碼?
- 答:這個外掛使用 PHP_CodeSniffer 與 PHPCompatibility 標準來執行深層靜態分析。

3. 使用者如何開始使用這個外掛?
- 答:使用者可以前往「工具 → PHP Compatibility Scanner」,確認系統兼容性,選擇要掃描的插件和/或主題,配置掃描選項,然後點擊「Start Scan」開始進行兼容性檢查。

4. 那些為什麼會造成此外掛無法在某些環境中運行?
- 答:由於 managed hosting 提供商禁用了 exec() 函數並限制對 PHP 二進制文件的訪問,這個外掛無法在這些環境中運行。

5. 有哪些被支持的環境?
- 答:被支持的環境包括 LocalWP、XAMPP/MAMP、Docker WordPress 設置、自託 VPS/專用伺服器以及開發環境具有 shell 訪問權限。

6. 如何來貢獻這個外掛?
- 答:貢獻者可以貢獻額外的 PHP 版本兼容性規則、性能優化、UI/UX 改進以及托管環境兼容性解決方案。

外掛標籤

開發者團隊

⬇ 下載最新版 (v1.1.2) 或搜尋安裝

① 下載 ZIP → 後台「外掛 › 安裝外掛 › 上傳外掛」
② 後台搜尋「Eli's PHP Compatibility Scanner」→ 直接安裝(推薦)
📦 歷史版本下載

原文外掛簡介

⚠️ Important: Development Environment Only
This plugin is designed for development environments like LocalWP, XAMPP, or self-hosted servers. It will not work on most managed hosting providers (WP Engine, Kinsta, SiteGround, etc.) due to security restrictions that disable the exec() function and limit access to PHP binaries.
How It Works
This plugin leverages PHP_CodeSniffer with the PHPCompatibility standard to perform deep static analysis of your PHP code.
Core Components:

Bundled Dependencies: Includes PHP_CodeSniffer and PHPCompatibility ruleset
Batch Processing: Scans files in configurable batches (10-100 files) to manage memory usage
Command Execution: Executes PHPCS via PHP’s exec() function with specific parameters
Server-Side State: Stores file lists in WordPress options to optimize AJAX requests
Progressive UI: Real-time batch results with stop/start controls

How to Use:

Navigate to Tools → PHP Compatibility Scanner
Review the System Check section to ensure your environment is compatible
Select the plugins and/or themes you want to scan by checking their boxes
Configure your scan options:

Target PHP Version: Choose the PHP version you want to test against (7.4 – 8.4)
Batch Size: Select how many files to process at once (default: 50 files)
Skip Vendor Directory: Keep checked to skip third-party dependencies

Click Start Scan to begin the compatibility check
View results in real-time as each plugin/theme is scanned
Review any errors (❌) or warnings (⚠️) found in your code
Click on any target to expand and see detailed compatibility issues

Why It Requires Development Environments

exec() Function: Required to run PHPCS binary – disabled on managed hosts
PHP Binary Access: Needs access to PHP executable – restricted on shared hosting
Composer Dependencies: Requires vendor directory with PHPCS installation
File System Access: Creates temporary files for batch processing
Memory/Time Limits: Long-running scans need relaxed execution limits

Supported Environments

LocalWP (recommended)
XAMPP/MAMP
Docker WordPress setups
Self-hosted VPS/dedicated servers
Development environments with shell access

Unsupported Environments

WP Engine (exec() disabled)
Kinsta (security restrictions)
SiteGround (managed hosting limitations)
GoDaddy Managed WordPress (function restrictions)
WordPress.com (no plugin uploads)
Most shared hosting providers

Contributing
This plugin is actively developed for WordPress development environments. Contributions are welcome, especially:

Additional PHP version compatibility rules
Performance optimizations
UI/UX improvements
Hosted environment compatibility solutions

Technical Details
Dependencies

PHP_CodeSniffer: ^3.13 (static analysis engine)
PHPCompatibility: dev-develop (compatibility ruleset)

License
GPLv2 or later – same as WordPress core.

延伸相關外掛

文章
Filter
Apply Filters
Mastodon