Title: Problems calling WP_Filesystem
Last modified: December 19, 2017

---

# Problems calling WP_Filesystem

 *  [alexgrip](https://wordpress.org/support/users/alexgrip/)
 * (@alexgrip)
 * [8 years, 3 months ago](https://wordpress.org/support/topic/problems-calling-wp_filesystem/)
 * I’m trying to get direct access to the filesystem in wordpress so i can stream
   a file to another location.
    WP_Filesystem() always returns false. The file i
   try to read is in the wp-content/uploads folder which the www-data user has full
   access to, www-data user is owner of the entire wp-content folder. I have even
   tried setting all the folders in the entire app to 777.
 * My code runs in a filter attached to the media upload.
 * I’m hosting the app using the php:7.1-apache docker image.
    I don’t understand
   how to troubleshoot this.
    -  This topic was modified 8 years, 3 months ago by [alexgrip](https://wordpress.org/support/users/alexgrip/).

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [8 years, 3 months ago](https://wordpress.org/support/topic/problems-calling-wp_filesystem/#post-9797649)
 * Examine the function’s [source code](https://developer.wordpress.org/reference/functions/wp_filesystem/#source)
   and determine under what conditions it returns false. If needed, temporarily 
   add debug code to the source file (uploading to the server after each edit) to
   help you determine where the false is coming from. Be sure to maintain a clean
   backup or otherwise keep track of edits so the default state can be restored.
 * You may have to drill down into other functions in order to zero in on the true
   cause. Once you find out exactly why false is being returned, hopefully that 
   will indicate what needs to be done to resolve the problem.
 *  Thread Starter [alexgrip](https://wordpress.org/support/users/alexgrip/)
 * (@alexgrip)
 * [8 years, 3 months ago](https://wordpress.org/support/topic/problems-calling-wp_filesystem/#post-9798905)
 * ok, so the problem was that when checking what type of FS access to get wp compares
   
   owner on __FILE__ constant /var/www/html/wp-admin/includes/file.php with a temp
   file /var/www/html/wp-content/temp-write-test-1513759002
 * I hade only set owner to www-data on wp-content, so the compare was a miss causing
   it to fallback to ftp access. Setting owner in wp-admin as well solved it.
 * [@bcworkz](https://wordpress.org/support/users/bcworkz/) thanks for pointing 
   me in the right direction.
 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [8 years, 3 months ago](https://wordpress.org/support/topic/problems-calling-wp_filesystem/#post-9800598)
 * Heh, quite the process to discover a owner issue. Whatever gets us there 🙂

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Problems calling WP_Filesystem’ is closed to new replies.

## Tags

 * [filesystem](https://wordpress.org/support/topic-tag/filesystem/)

 * In: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
 * 3 replies
 * 2 participants
 * Last reply from: [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * Last activity: [8 years, 3 months ago](https://wordpress.org/support/topic/problems-calling-wp_filesystem/#post-9800598)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
