post-page

WordPress, IIS and Plesk “Unable to find wp-content” Woes and Solution

2
responses
by
 
on
November 23rd, 2011
in
HOW-TO, WordPress FAQs, WordPress Hack

I tried to help a co-worker with a professional blog for a TV channel yesterday and ran into some weird issues. We host the blog on a Windows 2008 server with IIS and Plesk. The WordPress install from within the Plesk worked fine but ours did not. The “white screen of death” on the install screen was perplexing (more on that at the bottom of this article), but every time he tried to either upgrade WordPress or install or upgrade a plugin or theme, he would receive warnings or failures stating that WordPress was unable to find the wp-content directory. This warning can take various forms but circle around the fact that WordPress did not find the right directory in the expected place.

The obvious and painless solution is to upload the files directly to the server using FTP and then control the blog from within wp-admin. In this case, though I knew the simple solution, I wanted to get to the root of the problem. It turns out that weird permission issues with IIS and WordPress and in some extreme cases such as mine, can be solved with simple but somewhat hidden features to get the desired results.

A Google search revealed that adding a few lines of code to the end of your wp-config.php can solve most issues. As from Firdouss.com guide, try this solution first. Open up your production wp-config.php, find the end of the file and add the following lines at the end. Then save the file, upload to your server and try the process again.

if(is_admin()) {
	add_filter('filesystem_method', create_function('$a', 'return "direct";' ));
	define( 'FS_CHMOD_DIR', 0751 );
}

If that does not solve your problem, you can use WordPress constants to solve your problem. It turns out (thanks to a comment on the Firdouss.com guide) that there are a host of constants that can be added to wp-config that can fix broken upload and install/upgrade problems among other things. That link to the Codex contains a detailed explanation of the constants and what they should be set to. Please refer to that link since it will continue to be updated. In my case, I had to add the following to the end of my wp-config.php file. I could also have modified the above code to return ftpext instead.

define('FS_METHOD', 'ftpext');

Now in my case, there were other permission issues that had to be resolved. Our Plesk install had a borked permission system and in order for uploads to be deleted after they are unzipped and copied (WP need to switch to a move), I had to also CHMOD the files. So I ended up with the following code at the end of wp-config.

if(is_admin()) {
	add_filter('filesystem_method', create_function('$a', 'return "ftpext";' ));
	define( 'FS_CHMOD_DIR', 0755 );
}

Now the uploads/upgrades/installs work fine. YMMV.

As for the weird installation issue, it turns out that when I uploaded the WordPress install files on the server and visited the URI, I got redirected to the following along with a white screen of death with no errors.

http://example.com/index.php/wp-admin/install.php

I needed to change that URI manually to the following for the install to continue. That was all.

http://example.com/wp-admin/install.php

Do you have any other suggestions? Are there any tricks that have helped you get similar issues resolved?

heading
2
Responses

 

Comments

  1. Firdouss (1 comments.) says:

    Hey thanks for the mention on the entry!

    By the way, regarding IIS and plesk and WordPress installation, I did face the exact same issue (where the URL is pointed wrongly). I did not look for solutions though, as retyping the URL seems to solve it!

  2. Dion Hulse (1 comments.) says:

    FYI, the add_filter code is basically what you had to use before FS_METHOD support was added a version later.

    Adding the FS_CHMOD_DIR shouldn’t be needed in 99% of cases, and if you’re on a shared host with other users, be careful with the FS_CHMOD_* defines. (this is mainly aimaed at others who come along and find this post)



Obviously Powered by WordPress. © 2003-2013

page counter
css.php