PHP Function Is_Writeable
The php function is_writeable allows you to check if a file is writable. It takes a single parameter, the path of the file. The function will return True if the file exists and is writable. The is_writable function also checks whether a directory is writable. If the file is not writable, an E_WARNING will be emitted. The is_writable function is cached so you need to clear the statcache() function before running it again.
If the is_writable function returns false for a file, it may be because you don’t have the permissions to write to that file. For example, if your web contructed files are grouped under NOBODY then you won’t have the right to write to those files (unless you grant it to yourself).
Alternatively, you could use the glob function or scandir to check for writable directories. The glob function finds all filenames matching the pattern and the scandir function lists all files and directories in the path. Both functions can be used with the GLOB_ONLYDIR flag which will only find directory entries that match the pattern.
Another option is to use the getflg() and getwsi() functions to display the file permissions. These functions will return a string displaying all the permissions on the file and you can then read the file to see which ones are set. If you’re using a CMS such as WordPress or Drupal, you will need to use these functions to check for the correct file permissions on your files and folders.