Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

A faculty member is having difficulties with a instructional wordpress install. Fixing individual permission problems has been hit and miss, and have become a perennial pain, so I'll ask here. What can I do to make WP Just Work? The kinds of errors they get:

Installing Plugin: Lightbox 2 2.9.2 Downloading install package from http://downloads.wordpress.org/plugin/lightbox-2.2.9.2.zip… Unpacking the package… Could not create directory. /home/CIM140/public_html/wordpress/wp-content/upgrade/lightbox-2.tmp

When I su as www-data (the user apache runs as in Ubuntu), I can make that directory just fine. My test wp instance installs this plugin just fine, so I'm at a loss as to why it fails for them.

share|improve this question
add comment

2 Answers

up vote 3 down vote accepted

@pwnguin,

I had the same problems running mod_php with WordPress and I finally figured it out.

# chown www-data:www-data  /home/CIM140/public_html/wordpress/ -R

As long as YOU control the box this won't cause any security issues.


EDIT:

You might also need to change your umask to 022 so new directories created by WordPress will have 755 permissions and files will have 644 permissions.

Another option is to override default file permissions in wp-config.php:

define('FS_CHMOD_DIR', (0755 & ~ umask()));
define('FS_CHMOD_FILE', (0644 & ~ umask()));

You can also force the filesystem method for updates.

  • (Primary Preference) "Direct" forces it to use Direct File I/O requests from within PHP, this is fraught with opening up security issues on poorly configured hosts, This is chosen automatically when appropriate.
  • (Secondary Preference) "ssh" is to force the usage of the SSH PHP Extension.
  • (3rd Preference) "ftpext" is to force the usage of the FTP PHP Extension for FTP Access, and finally
  • (4th Preference) "ftpsockets" utilises the PHP Sockets Class for FTP Access.

These can be defined in wp-config.php with: define('FS_METHOD', 'ftpext');

You can get all the currently defined constants by executing the print_r(@get_defined_constants()); command in php.

share|improve this answer
    
Done that already =( –  jldugger Sep 24 '10 at 19:39
    
example: drwxrwsr-x 6 www-data www-data 4096 2010-09-22 23:15 wp-content –  jldugger Sep 24 '10 at 19:40
    
Try changing them to drwxr-xr-x 7 www-data www-data 4096 Sep 24 09:38 wp-content –  Chris_O Sep 24 '10 at 20:01
    
Also I have never used the SGID attribute on a directory ie: chmod g+s I don't think that is needed. Someone correct me if I am wrong. –  Chris_O Sep 24 '10 at 20:13
    
Ah, after getting in touch with the faculty, it looks like it's defaulting to SSH while my test instance hits up direct IO. So it's his user that doesn't have rights to create the directory. –  jldugger Sep 24 '10 at 22:17
show 1 more comment

For me (on Ubuntu) I had to add umask 002 to /etc/apache2/envvars in order to get Wordpress to upload plugins/images with 775 permissions instead of 755 (i.e. allow anyone besides Apache and root to change the uploaded files)

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.