Unable to install plugin "Invalid plugin slug"
ptahchiev opened this issue · 10 comments
I'm following this documentation:
https://developer.wordpress.org/cli/commands/plugin/install/
and I'm trying to install a plugin from a zip file:
root@advance:~# sudo -u www-data wp plugin install ./wordpress/oxygen.4.5.zip --activate --path=/var/www/html/mysite/
Warning: ./wordpress/oxygen.4.5.zip: Invalid plugin slug.
Warning: The './wordpress/oxygen.4.5.zip' plugin could not be found.
Error: No plugins installed.
root@advance:~#
I'm using version:
root@advance:~# sudo -u www-data wp --version
WP-CLI 2.8.1
on ubuntu linux.
Hi @ptahchiev,
What happens when you pass the full path to the ZIP file?
Same thing,
I actually started passing /root/wordpress/oxygen.4.5.zip
but then I saw the documentation says ../
and I tried using relative path too. Neither one works
@ptahchiev A few other questions to help you debug further:
- Just to confirm, the file actually exists on the path?
- Are you able to install other plugins from ZIP?
- Are you able to install plugins from ZIP on other systems?
Yes, the actual file exists. I have 3 plugins to install and none of them work. I can install the same zip plugins if I go to my wordpress website but I want to install them from CLI
@ptahchiev Can you run sudo -u www-data wp shell --path=/var/www/html/mysite/
, is_file ('./wordpress/oxygen.4.5.zip' );
with the shell session, and then share the result?
Here it is:
root@advance:~# ls -la wordpress/oxygen.4.5.zip
-rw-r--r-- 1 www-data www-data 5975972 Aug 26 11:45 wordpress/oxygen.4.5.zip
root@advance:~# sudo -u www-data wp shell --path=/var/www/html/1693129925968/
PHP Notice: Undefined index: HTTP_X_FORWARDED_PROTO in phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1309) : eval()'d code on line 95
PHP Notice: Constant AUTH_KEY already defined in phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1309) : eval()'d code on line 98
PHP Notice: Constant SECURE_AUTH_KEY already defined in phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1309) : eval()'d code on line 99
PHP Notice: Constant LOGGED_IN_KEY already defined in phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1309) : eval()'d code on line 100
PHP Notice: Constant NONCE_KEY already defined in phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1309) : eval()'d code on line 101
PHP Notice: Constant AUTH_SALT already defined in phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1309) : eval()'d code on line 102
PHP Notice: Constant SECURE_AUTH_SALT already defined in phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1309) : eval()'d code on line 103
PHP Notice: Constant LOGGED_IN_SALT already defined in phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1309) : eval()'d code on line 104
PHP Notice: Constant NONCE_SALT already defined in phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1309) : eval()'d code on line 105
wp> is_file ('./wordpress/oxygen.4.5.zip' )
=> bool(false)
wp> is_file ('/root/wordpress/oxygen.4.5.zip' )
=> bool(false)
wp>
@ptahchiev Ah, I think it's a permissions issue. From PHP.net:
Note that
is_file()
returns false if the parent directory doesn't have +x set for you;
I added +x to the directory:
root@advance:~# chmod +x wordpress/
root@advance:~# ls -al
drwx------ 9 root root 4096 Aug 27 16:58 .
drwxr-xr-x 24 root root 4096 Aug 13 06:34 ..
drwxr-xr-x 2 www-data www-data 4096 Aug 26 11:50 wordpress
root@advance:~# sudo -u www-data wp shell --path=/var/www/html/1693129925968/
PHP Notice: Undefined index: HTTP_X_FORWARDED_PROTO in phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1309) : eval()'d code on line 95
PHP Notice: Constant AUTH_KEY already defined in phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1309) : eval()'d code on line 98
PHP Notice: Constant SECURE_AUTH_KEY already defined in phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1309) : eval()'d code on line 99
PHP Notice: Constant LOGGED_IN_KEY already defined in phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1309) : eval()'d code on line 100
PHP Notice: Constant NONCE_KEY already defined in phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1309) : eval()'d code on line 101
PHP Notice: Constant AUTH_SALT already defined in phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1309) : eval()'d code on line 102
PHP Notice: Constant SECURE_AUTH_SALT already defined in phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1309) : eval()'d code on line 103
PHP Notice: Constant LOGGED_IN_SALT already defined in phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1309) : eval()'d code on line 104
PHP Notice: Constant NONCE_SALT already defined in phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1309) : eval()'d code on line 105
wp> is_file ('/root/wordpress/oxygen.4.5.zip' )
=> bool(false)
wp>
still the same
@ptahchiev I can't help you further, unfortunately. This problem seems to be specific to your environment, and not WP-CLI.
Moved the wordpress
folder outside of /root
and into /var/www
and it started working.