Make WordPress Core

Opened 7 years ago

Last modified 7 years ago

#38595 new defect (bug)

Unable to access wp-admin/options-permalink.php when .htaccess file is on NFS

Reported by: kicwordpress's profile kicwordpress Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 4.4
Component: Permalinks Keywords:
Focuses: administration Cc:


After nearly a week of troubleshooting, we have identified an issue with wordpress which is preventing us from storing our .htaccess file on an NFS mount.

This issue exists as far back as 4.4

In order to reproduce:

install wordpress in a directory where .htaccess is located on a mounted nfs share. Once wordpress is installed, navigate to - the page should fail to load.

This issue appears to be caused by the function "flock();" in the function "insert_with_markers();" in wp-admin/includes/misc.php

Per PHPs documentation, flock(); is only acceptable for use on local filesystems.

I found an existing ticket regarding this function - #31767 - if I understand correctly, flock(); was added to the "insert_with_markers(); function to resolve a concurrent write issue on shared filesystems.

Disclaimer: I am not a PHP developer, and only understand the basic concepts. The testing for the above bug consisted of commenting out functions till I could find the source of the issue. Commenting out the "flock();" function in the "insert_with_markers();" function resolved the issue in our environment.

Change History (4)

#1 @dd32
7 years ago

Hi @kicwordpress and welcome to Trac,

Thanks for reporting this! Can you give a little more information about your setup?
What PHP version and OS is the server running? Any specific NFS details you're aware of?

Calling flock() on a filesystem that doesn't support locking is *supposed* to bail, and I recall testing that scenario for #31767.
It may be that we could use LOCK_NB here instead, depending on it's implementation (see

#2 @kicwordpress
7 years ago

@dd32, thanks for the response.

I can share some basic info about or setup, but I can't go into much detail for security concerns. Feel free to reach out to me directly for any specifics that you need.

OS: similar to RHEL 6
PHP: 5.6
MySQL 5.6
NFS is mounted as follows:
nfs-host:/remotedir on /local/directory/path type nfs (rw,rsize=8192,wsize=8192,timeo=14,intr,addr=

#3 @SergeyBiryukov
7 years ago

  • Component changed from General to Permalinks
  • Focuses administration added

#4 @dd32
7 years ago

#40563 was marked as a duplicate.

Note: See TracTickets for help on using tickets.