Update fails because directories are locked by php-cgi.exe

I have some problem when using the Update manager. Some directories get locked by php-cgi.exe, and thus the replacement of the original directories with the newly downloaded ones (which are fresher) is not successful.
It’s not a permission issue, since modules can be installed via Install from a URL on /admin/modules/install, and that works without problems.

Let’s take an example:

  1. Available updates page (/admin/reports/updates/update):

    Available updates

    Now I check Select (or other) module to be updated (it doesn’t matter which module I choose, the results are the same!! so it’s just an example).

  2. I hit "Download these updates" button.

  3. OK, the module’s updated instance gets downloaded without a problem:
    "Updates downloaded successfully":
    Updates downloaded successfully

  4. Now I click on Continue.

  5. Here comes the error. The result:
    "Update failed! See the log below for more information.
    select_or_other

    • Error installing / updating
    • File Transfer failed, reason: Cannot copy D:/Projects/web/drupal-7/tmp/update-extraction-6d8993ac/select_or_other/LICENSE.txt to /Projects/web/drupal-7/htdocs/sites/all/modules/select_or_other/LICENSE.txt."
      Update failed!
  6. OK, I’m starting to try to inspect the possible reasons.

    • Here’s what my Drupal directory structure looks like: TC directory structure. I set ../tmp to be the temporary directory (in /admin/config/media/file-system), the Drupal files are in htdocs. This is correct, as I can install modules via the GUI, as I mentioned above.
    • When I try to enter the htdocs/sites/all/modules/select_or_other directory, I can’t, because I get an "Access denied on file ......sites/all/modules/select_or_other!" when opening in Total Commander, and "...sites/all/modules/select_or_other is not accessible. Access is denied" when opening in Windows Explorer:
      trying to open directory in Total Commander, trying to open directory in Windows Explorer
    • OK, I right click the folder, and open Unlocker via its assistant in the context menu. It says this directory is locked by php-cgi.exe:
      Unlocker - directory locked by php-cgi.exe
      I click on "Unlock All", and the folder can now get deleted of itself (as it’s not locked anymore by php-cgi.exe), so it simply
    • I can find the updated select_or_other module’s directory in tmp:
      updated module's directory in tmp
    • so I have to manually move it to sites/all/modules directory.

What can be the possible reasons of the lockup of the directory by php-cgi.exe? (Maybe Windows Cache Extension 1.1 for PHP 5.3 installed via Web Platform Installer? But if yes, why is that for example the deletion of images or similar via the GUI works correctly?)
What can I do to avoid this problem, and let "Update manager" work?

This article was republished from its original source.
Call Us: 1(800)730-2416

Pixeldust is a 20-year-old web development agency specializing in Drupal and WordPress and working with clients all over the country. With our best in class capabilities, we work with small businesses and fortune 500 companies alike. Give us a call at 1(800)730-2416 and let’s talk about your project.

FREE Drupal SEO Audit

Test your site below to see which issues need to be fixed. We will fix them and optimize your Drupal site 100% for Google and Bing. (Allow 30-60 seconds to gather data.)

Powered by

Update fails because directories are locked by php-cgi.exe

On-Site Drupal SEO Master Setup

We make sure your site is 100% optimized (and stays that way) for the best SEO results.

With Pixeldust On-site (or On-page) SEO we make changes to your site’s structure and performance to make it easier for search engines to see and understand your site’s content. Search engines use algorithms to rank sites by degrees of relevance. Our on-site optimization ensures your site is configured to provide information in a way that meets Google and Bing standards for optimal indexing.

This service includes:

  • Pathauto install and configuration for SEO-friendly URLs.
  • Meta Tags install and configuration with dynamic tokens for meta titles and descriptions for all content types.
  • Install and fix all issues on the SEO checklist module.
  • Install and configure XML sitemap module and submit sitemaps.
  • Install and configure Google Analytics Module.
  • Install and configure Yoast.
  • Install and configure the Advanced Aggregation module to improve performance by minifying and merging CSS and JS.
  • Install and configure Schema.org Metatag.
  • Configure robots.txt.
  • Google Search Console setup snd configuration.
  • Find & Fix H1 tags.
  • Find and fix duplicate/missing meta descriptions.
  • Find and fix duplicate title tags.
  • Improve title, meta tags, and site descriptions.
  • Optimize images for better search engine optimization. Automate where possible.
  • Find and fix the missing alt and title tag for all images. Automate where possible.
  • The project takes 1 week to complete.