Opened 4 weeks ago
Last modified 2 weeks ago
#46040 new defect (bug)
Broken symlinks prevent updates
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | normal | Version: | 5.0.3 |
Component: | General | Keywords: | has-patch needs-testing |
Focuses: | Cc: |
Description
Soon after cPanel updated EasyApache 4 (EA4) (ea-php-cli-1.0.0-3.3.1.cpanel.x86_64) to use caching (a faster way to select the PHP executable, such as php-cli), I noticed some failed plugin updates. If appears that updated cPanel servers now create ".ea-php-cli.cache" broken symbolic links in the directory where a PHP script was executed by CLI (such as a CRON job or manual call). The links are to a fake target (such as "ea-php71"), which is used by the perl script to select the executable.
I already submitted https://github.com/CpanelInc/php-cli/issues/2 to cPanel, and already received a response. The author of the pull request https://github.com/CpanelInc/php-cli/commit/883e8f1f3f37998d4501de4d4276c8a9d290fae3 may be changing how it caches; possibly creating the cache files in the "~/.cpanel" directory and cleaning up the littered files in the users' web directories.
I have a working fix for WordPress, that I will attach in a moment. The cause and effect is not limited to cPanel and WordPress, and the issue should be fixed on both sides.
To replicate:
- Have WordPress 5.0.3 installed on a cPanel server that has ea-php-cli-1.0.0-3.3.1.cpanel.x86_64 installed. -- You can check using
rpm -q ea-php-cli-1.0.0-3.3.1.cpanel
. Also '/usr/local/bin/php' is a text (perl) file, and not a binary/executable. - Login into SSH/CLI and call any PHP file in a plugin, such as
php wp-content/plugins/akismet/class.akismet-cli.php
.- You should then see a broken symlink in the "wp-content/plugins/akismet/" directory.
- Change the version number in the main plugin file "wp-content/plugins/akismet/akismet.php" to something lower, such as "4.0".
- Go to the WordPress >> Updates page and try to update the plugin.
- You will see an error "An error occurred while updating Akismet: The update cannot be installed because we will be unable to copy some files. This is usually due to inconsistent file permissions. .ea-php-cli.cache"
- You can delete the symlink or apply the patch, and the update will be successful.
cPanel has fixed the issue in https://github.com/CpanelInc/php-cli/issues/2 , but the symlink issue should still be handled by the WordPress filesystem classes.