WordPress permissions on NearlyFreeSpeech.net
Wednesday, 14 September 2011
“To perform the requested action, connection information is required.”
My earlier post on WordPress with NearlyFreeSpeech.net was too hastily written. There are more issues than WP not wanting to use the direct upgrader, and editing WordPress code is not the right way to solve it either.
Problem 1: WordPress doesn’t want to use the direct upgrader. You can force it to use the direct upgrader by adding define('FS_METHOD', 'direct');
to /wp-config.php
.
Problem 2: WordPress may not have write access to certain directories. The wp-content directory, for example, would need to be chgrp to web and chmod to 775 in order for WordPress to update the things within. Of course, there is the option of just doing that on all of your WordPress files.
Problem 3: WordPress will create files that you cannot edit. Files created by PHP will be owned by user ‘web’ and the permissions will be 644. That means you (“me”) cannot edit these files over SSH since you are not the owner. You can’t even delete, chown, or chmod the files. You’ll either have to get PHP to delete them or ask NFSN support to chown them for you. A workaround is to umask(002);
to your wp-config.php, which makes files created by PHP group-writable. They will still be owned by web by default, but at least you can do something about it.
Problem 4: The default temp directory may not be accessible by PHP. NFSN’s FAQ for installing WordPress has instructions about this and a variant is given here. First, make a directory called ‘tmp’ in your WordPress root and give PHP permissions to write to it (chgrp to web and chmod to 775). Then, add define('WP_TEMP_DIR', dirname(__FILE__).'/tmp');
to your wp-config.php file.
No. 1 — March 5th, 2012 at 7:58 pm
This is very comprehensive and useful! Thanks:)
No. 2 — March 5th, 2012 at 7:59 pm
[…] http://notes.ericjiang.com/posts/322#comment-1286 Posted by jimtang at 6:42 pm Tagged with: How-to, Install, NearlyFreeSpeech, WordPress […]
No. 3 — October 14th, 2012 at 12:52 am
[…] WordPress permissions on NearlyFreeSpeech.net […]
No. 4 — August 31st, 2013 at 8:09 pm
Hello — I came to your website to figure out why I don’t have permission to modify content in wp-content. I see that you said you can use unmask(002); to fix this but I’m confused on how and where to add it to wp-config.php. I basically know nothing about php, so any help would be great. I just need to be able to edit a stylesheet located in wp-content. Had no idea it would be this complicated.