Fixing WordPress’ Auto-Update (WordPress 3.3.1 on CentOS Linux)
Having trouble with WordPress’ auto update feature? Confronting errors like “could not copy file…” or is WordPress asking for FTP information?
Your problem is most likely server permissions. If you have shell access to your own VPS/dedicated server, use the lines below. If you’re using a shared hosting setup, try option #4 below, or contact your administrator for help.
Option #1: chmod 777
Sure, you could CHMOD 777 your whole site. That would technically work, but it’s switching permissions whenever you need to update is inconvenient. And, leaving permissions this way leaves you open to a whole host of security issues.
chmod -R 777 <path-to-wordpress-dir>(Not Secure!)
Option #2: apache file permission
This gives apache full permissions. This works, but if you use FTP, users no longer have permissions to write files. No good! I want my FTP access intact.
chown -R apache:apache <path-to-wordpress-dir>(No FTP!)
Option #3: apache /w group permissions
I created a “wordpress” group and added my FTP users to it and gave the wp-content directory group write permissions. It’s a bit of a compromise, but it worked for me.
groupadd wordpress useradd -G wordpress <your-username> chmod -R 775 <path-to-wordpress-dir>/wp-content/ chown -R apache:wordpress <path-to-wordpress-dir>
Option #4: wp-config constants
Another option for those who are unable to change file permissions, and/or have a relatively new version of WordPress, is to bypass entering FTP information by defining your FTP info in your wp-config.php file. More information can be found in the WordPress codex.
define('FS_METHOD', 'ftpext'); define('FTP_BASE', '/path/to/wordpress/'); define('FTP_CONTENT_DIR', '/path/to/wordpress/wp-content/'); define('FTP_PLUGIN_DIR ', '/path/to/wordpress/wp-content/plugins/'); define('FTP_USER', 'username'); define('FTP_PASS', 'password'); define('FTP_HOST', 'ftp.example.org');