What we did to fix the is_writable is false on an NFS share problem

Published in NFS on Sep 16, 2021

Yesterday, we were moving an old Laravel application to another server when we encountered a weird behavior when testing file uploads. Tracked it down to a check within the UploadedFile class using is_writable().

The problem was that is_writable() was returning false even though the user that PHP was running as could write to the mounted path. Google turned up a couple of results that weren't very helpful.

PHP 'is_writable' returning false, although viewing it from the terminal shows 775

using NFS-mounted folder as data fails with 'not writable'

Php v7 filesystem check bug with nfs v3 mount from synology #7124

is_writable returns false for NFS-share, even though it is writable for the user www-data

Long story short, what ended up fixing it was setting the directory permissions to 755. When we initially ran an rsync from the old server to the file server, the permissions to the directories became 777. For some reason, is_writable() returns false for paths like that.

So I'm posting this in case it helps someone.