The php comparison plugin for e107 allows administrators to compare PHP configuration (php.ini) files across different PHP versions installed on a cPanel/WHM or Windows server. It helps ensure compatibility during PHP version migrations by identifying differences in settings and extensions, such as memory_limit, curl, exif, and more.
- Dynamic PHP Version Detection: Scans for
php.inifiles in cPanel/WHM EasyApache 4 paths (e.g.,/opt/cpanel/ea-php8*/root/etc/php.ini) and Windows paths (e.g.,W:\bin\php\php-8.1.6-*\php.ini). - User-Friendly Dropdown: Lists available PHP versions (e.g., “PHP 8.1”, “PHP 8.4”) excluding the current PHP version, with clean labels for easy selection.
- Comprehensive Comparison:
- Compares standard settings (e.g.,
memory_limit,max_execution_time,open_basedir). - Lists all PHP extensions (e.g.,
curl,exif,zip) and Zend extensions (e.g.,opcache) as “Enabled” or “Disabled”. - Highlights additional setting differences.
- Compares standard settings (e.g.,
- Migration Support: Focuses on settings critical for PHP upgrades, helping prevent issues like missing extensions or incompatible configurations.
- Secure and Lightweight: Validates file paths, requires admin permissions, and uses e107’s form handlers for a streamlined UI.
- e107 CMS v2.x
- PHP 7.4 or higher
- Read access to
php.inifiles andphp.d/*.inifiles (e.g.,/opt/cpanel/ea-php81/root/etc/php.ini,W:\bin\php\php-8.1.6-*\php.ini) - cPanel/WHM with EasyApache 4 (for Linux) or a Windows server with multiple PHP versions
-
Download the Plugin:
- Clone this repository or download the ZIP file.
- Extract to your e107 plugins directory:
/path/to/e107/e107_plugins/phpcompare/.
-
Set Permissions (Linux):
chown -R www-data:www-data /path/to/e107/e107_plugins/phpcompare chmod -R 644 /path/to/e107/e107_plugins/phpcompare/* chmod 755 /path/to/e107/e107_plugins/phpcompareReplace
www-datawith your web server user (e.g.,apache). -
Install via e107 Admin:
- Log in to your e107 admin panel.
- Navigate to System > Plugin Manager.
- Scan for new plugins;
phpcompareshould appear. - Click Install.
-
Verify File Permissions:
- Ensure
php.iniandphp.d/*.inifiles are readable:On Windows, ensure the web server user has read access tols -l /opt/cpanel/ea-php81/root/etc/php.ini chmod 644 /opt/cpanel/ea-php81/root/etc/php.ini chmod 644 /opt/cpanel/ea-php81/root/etc/php.d/*.iniW:\bin\php\*\php.ini.
- Ensure
-
Access the Plugin:
- Go to Admin > PHP INI Compare (labeled “Compare” in the e107 admin menu).
-
Select a PHP Version:
- The form displays the current PHP version (e.g., PHP 8.1).
- Choose another PHP version from the dropdown (e.g., “PHP 8.2”, “PHP 8.4”).
- Click Compare Files.
-
View Results:
- Standard Settings: Table comparing settings like
memory_limit,open_basedir, etc. - Extensions: Table listing extensions (e.g.,
curl,exif,zip) as “Enabled” or “Disabled”. - Zend Extensions: Table for extensions like
opcache(if present). - Other Settings: Table for additional differences.
- Matches are marked green (“Match”), mismatches yellow (“Mismatch”).
- Standard Settings: Table comparing settings like
No additional configuration is required after installation. The plugin automatically detects php.ini files in:
- Linux:
/opt/cpanel/ea-php8*/root/etc/,/bin/php/*/ - Windows: Paths like
W:\bin\php\php-X.Y.Z-*
To add custom paths:
- Edit
admin_config.php. - Modify the
$search_dirsarray:$search_dirs = array( '/opt/cpanel/ea-php8*/root/etc/', '/bin/php/*/', '/your/custom/path/*/' );
-
Dropdown Shows “PHP Version (etc)” or “PHP Version (bin)”:
- Ensure
php.inifiles are in expected paths. - Check file readability:
ls -l /opt/cpanel/ea-php81/root/etc/php.ini
- Verify the regex in
admin_config.phpmatches your folder names.
- Ensure
-
No Extensions Listed:
- Confirm
php.d/*.inifiles exist and are readable:ls -l /opt/cpanel/ea-php81/root/etc/php.d/*.ini
- Confirm
-
Error: Could Not Detect Current PHP INI:
- Ensure
php_ini_loaded_file()returns a valid path:php -i | grep php.ini
- Ensure
Contributions are welcome! To contribute:
- Fork the repository.
- Create a feature branch (
git checkout -b feature-name). - Commit changes (
git commit -m 'Add feature'). - Push to the branch (
git push origin feature-name). - Open a Pull Request.
Please include tests and update this README if needed.
This plugin is licensed under the MIT License. See LICENSE for details.
Developed for e107 CMS, with thanks to the e107 community for feedback and testing.
⭐ If you find this plugin useful, please star the repository on GitHub!