Could Not Create Directory Issue in WordPress (a PHP 5.2.5 bug)

Bookmark and Share
Sunday, January 24 2010

I noticed this while setting up a WordPress (build 2.9.1) blog on a SUSE 10.3 Linux Server running PHP 5.2.5.

I encountered the following error when uploading or installing a plugin from the Add new section:

Could not create directory. /[WordPress Root]/wp-content/plugins/[My Plugin]/

I reviewed my file permissions and they appeared to be correct. I then proceeded to take a look at WordPress' wp-filesystem manager.

Looking at the file: [WordPress Root]/wp-admin/includes/class-wp-filesystem-direct.php, It appears that the path value being sent to the mkdir method contains a trailing slash, which is causing @mkdir to barf.

This is a bug reported in php 5.2.5 (http://bugs.php.net/bug.php?id=42739)

 

Best advice is to upgrade to the latest version of PHP.

 

However, if you are not in a position to upgrade, you can add the following line to the start of the mkdir method in the file [WordPress Root]/wp-admin/includes/class-wp-filesystem-direct.php

$path = preg_replace('(/$)', '', $path);

This will allow WordPress to bypass the PHP Bug.

 

 

Tagged as: , , , , , ,

Bookmark and Share

45 comment(s) so far

    • steve graham
    •  avatar
       
      Jul 29, 2010

      I have just downloaded the latest daily build and they have fixed the trailing slash issue but this still happen on my server.

      If I create the upgrade directory myself and set the permission to full I then get.

      Could not create directory. /user/htdocs/blog/wp-content/upgrade/wordpress-importer.tmp

      Help please.

    • Chris
    •  avatar
       
      Jan 28, 2011

      This fix didn't work for me. I am running a ubuntu system with the newest everything including php installed today. no joy here.

    • Luxury Holidays Mauritius
    •  avatar
       
      Jun 06, 2011

      Every state keeps official records of all lawyers admitted to practice in that state. They are either kept by the State Supreme Court, the Board of Bar Overseers, or the state Bar Association. These records would not list whether they are real estate lawyers.

    • worker
    •  avatar
       
      Jun 15, 2011

      Sadly it didnt work for me neither. Besides i have PHP 5.2.9 and still with the same error

    • weekend in las vegas
    •  avatar
       
      Jul 29, 2011

      I have a question that I hope will have a simple answer. I have a wordpress blog and right now my side navigation menu is on the right side. I would like for the menu to be on the left side. Can someone please tell me how I would go about doing this, in simple terms, please.

    • day trading stock
    •  avatar
       
      Jul 30, 2011

      I am trying to create a unit testing method to test a piece of code that is referring to a DLL located on a shared Drive.. When I try to run my unit testing method it failed with the following error message:

    • hen do activities
    •  avatar
       
      Aug 03, 2011

      Meats and certain dairy products are cool. chicken breasts are great, cottage cheese, steak, turkey bacon, lowfat cheese, eggs, whey and or soy protien powder, thats about all i can think of right now but it should get you started.

    • Stafford escorts
    •  avatar
       
      Aug 22, 2011

      I wanted to say that its nice to know that someone else also mentioned this as I had trouble finding the info elsewhere.

    • ecommerce hosting
    •  avatar
       
      Aug 24, 2011

      Thank you for the very interesting article, I am new to the world of websites and SEO and alot of articles I have read before talk of backlinks and more backlinks and some of them pretty underhand ways to get them,I have always thought when I started out to create a website that content must be the most important element as if people dont like the content of a site they will move on instantly however optimized for search engines it is.

    • apartments Cannes
    •  avatar
       
      Aug 29, 2011

      I have a wordpress blog and right now my side navigation menu is on the right side. I would like for the menu to be on the left side.

    • registration software
    •  avatar
       
      Sep 09, 2011

      I wanted to learn WordPress and when I was searching for videos I found a good post on a forum that has some great tutorial videos that show you everything you need to learn how to blog with WordPress and use all the plugins. They were very helpful.

    • eden rug
    •  avatar
       
      Oct 13, 2011

      This very nice website veiw to directory issue in word press,Hi, Making a new website is a easy one,first you want design your site with XML or HTML or any,then buy a domain name with web hosting ,then only you published your site http://www.tucktail.com,domain name available in this site ,here you just try for your dream site name ,also visit this very best site.

    • kitchen appliance centre
    •  avatar
       
      Oct 24, 2011

      I found a good post on a forum that has some great tutorial videos that show you everything you need to learn how to blog with WordPress and use all the plugins.I would like for the menu to be on the left side. Can someone please tell me how I would go about doing this, in simple terms,

    • dangerous driving
    •  avatar
       
      Nov 03, 2011

      I am starting up a small online business and wish to get my website on wordpress since its easy to make the edits anytime without the help of the webmasters. But I will also need personalized email addresses carrying my own domain name, I don't know weather wordpress offers this? any suggestions help will be appreciated.. thanks

    • Bio-Ethanol
    •  avatar
       
      Nov 18, 2011

      I wanted to learn WordPress and when I was searching for videos I found a good post on a forum that has some great tutorial videos that show you everything you need to learn how to blog with WordPress

    • implant dentist
    •  avatar
       
      Nov 27, 2011

      im guessing thats the University of the Pacific. the dental school for there is the Dugoni School of Dentistry, and it takes 4 years to be a general dentist. But i believe this is one of the only schools that you can get your DDS degree in 3 years

    • stag weekends
    •  avatar
       
      Dec 02, 2011

      It just clutters up the forum and wastes the volunteer's time. If you've something to add to an existing thread, add it to that thread.

    • oral cancer
    •  avatar
       
      Dec 22, 2011

      Periolase is the latest laser treatment for gum disease. One of the most essential treatments for dentists to use for patients with periodontal disease is laser treatment. Designed for the LANAP protocol (Laser Assisted New Attachment Procedure), Periolase is an advanced procedure for soft-tissue therapy and is a one-of-a-kind. Using a pulsed laser, Periolase, deep cleans gums. The FDA has approved the use the this unique treatment, which is safe, non-invasive and a way dentists can now use to treat and dramatically restore gum tissue

    • full mouth rehabilitation
    •  avatar
       
      Jan 11, 2012

      You can get many recommendations offline as well as online. You can even ask your friends, relatives, family members or work colleague to provide references or you can simply ask your podiatrist to recommend someone in his knowledge

    • flowers in nodia
    •  avatar
       
      Jan 20, 2012

      You are posting to the wrong support forum. On this forum we do not provide support for local installs of Word Press. We support only those with blogs being free hosted by Word Press.com.

    • Worktops
    •  avatar
       
      Apr 09, 2012

      It's gonna work fine on both Windows and Linux platforms . The only difference between these two while including a file is that file names are case sensetive in Linux . Suppose your file name is "MYfIlE.phP" and you're running your code on a Linux machine ,then your code must be like this :

    • SEO Manchester
    •  avatar
       
      Apr 12, 2012

      i would stay away from a window server, too many compatibility issues, you need to be on a LINUX server and running php 5

    • driving offences
    •  avatar
       
      May 01, 2012

      Good luck getting an immediate response. I hate that system. Thirteen hours for Total War Shogun 2 to load before playing. Despite having an account and another Total War game installed.

    • abercrombie
    •  avatar
       
      May 09, 2012

      It was very useful for me. Keep sharing such ideas in the future as well. This was actually what I was looking for, and I am glad to came here! Thanks for sharing such a information with us.

    • ibiza weekends
    •  avatar
       
      May 10, 2012

      Create a folder tree. Wen you have to make a project tree, make the top folder for the project, then copy the top folder from your tree and paste it into the project folder.

Post your comment

Thanks for your comments


To use your gravatar, enter the email or username associated with that gravatar.

  • Comment

 

Office Cam

Search

My Tweets

  • johnny861: I signed the petition to bring Pliny The Elder to Texas! http://t.co/C2uHGHa1
  • johnny861: RT @Han_Cholo: The glow on top is the aura of it's awesomeness *tear* http://t.co/NwCDKlC7
  • johnny861: If the May 21st rapture really happens, my hope is someone gets recorded yelling "To the Cloud!" just before they vanish in a puff of smoke.
  • johnny861: LA Lakers just can't handle a total beat down can they? Pathetic sportsmanship. Go MAVS!
  • johnny861: RT @tohams: Spinal Tap reference at #Dreamcore #FTW
  • johnny861: RT @john_boone: how to use multiple versions of jQuery (not my blog, just a smart guy): http://ow.ly/4E8Nn #dreamcore
  • johnny861: RT @awareweb: Great reception at #Dreamcore. Thanks to #Sitecore for arranging an opportunity for us all to connect.
 

Powered By: