Permission issue with WP-CLI on Fedora 31

  • Setting up a new WordPress instance and I noticed this error when I downloaded core.

    [[email protected] html]$ sudo -u apache wp core download
    [sudo] password for jbusch: 
    Downloading WordPress 5.3.2 (en_US)...
    Warning: Failed to create directory '/usr/share/httpd/.wp-cli/cache/': mkdir(): Permission denied.
    md5 hash verified: ec7fcc299de72d4914a688ea34c96f37
    Success: WordPress downloaded.

    So prior to setting up a site, you need to create the directory and give permission to apache

    # create a cache folder for wp-cli and give ownership to apache
    sudo mkdir -p /usr/share/httpd/.wp-cli/cache/
    sudo chown -R apache:apache /usr/share/httpd/.wp-cli/

  • @JaredBusch yeah, it's annoying that WP-CLI struggles with that.