Fixed WordPress Can’t Update

The error message:

Could not create directory.: /var/www/mikrotikscript.com/public_html/wp-content/upgrade
Installation failed.

means WordPress cannot write to the wp-content/upgrade directory due to file permission or ownership issues.


✅ Fix It in 3 Simple Steps:


1. Ensure Correct Ownership

Make sure the web server user (typically www-data for Nginx/Apache on Ubuntu/Debian) owns all WordPress files:

sudo chown -R www-data:www-data /var/www/mikrotikscript.com/public_html

Use apache:apache on CentOS/RHEL if you’re using Apache.


2. Set Correct Permissions

Ensure folders and files have proper permissions:

# Directories: 755
sudo find /var/www/mikrotikscript.com/public_html -type d -exec chmod 755 {} \;

# Files: 644
sudo find /var/www/mikrotikscript.com/public_html -type f -exec chmod 644 {} \;

3. Ensure WordPress Uses Direct File Access

Add this to wp-config.php, above the /* That's all, stop editing! */ line:

define('FS_METHOD', 'direct');

🧪 Optional: Create the upgrade Directory Manually

Sometimes the upgrade folder doesn’t exist. Create it manually:

mkdir -p /var/www/mikrotikscript.com/public_html/wp-content/upgrade
chown www-data:www-data /var/www/mikrotikscript.com/public_html/wp-content/upgrade
chmod 755 /var/www/mikrotikscript.com/public_html/wp-content/upgrade

🔁 Then Try Again

Now go back to WordPress Dashboard → Updates and try updating again.


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *