Title: File access error
Last modified: August 21, 2016

---

# File access error

 *  Resolved [TStone](https://wordpress.org/support/users/tstone/)
 * (@tstone)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/file-access-error/)
 * This plugin doesn’t work, and it seems it has to do with the usage of **getimagesize**
   in the code which (I think) is dependent on “allow_url_fopen” beeing enabled,
   and on many shared hostings it is disabled for security reasons.
 * In the admin settings, it show two errors in red:
    “File wp-content/plugins/motivation-
   generator/fonts/FreeSerif.ttf not found.” and “/wp-content/uploads/posters/ Can
   not be created. Please check your file permissions.”
 * [http://wordpress.org/plugins/motivation-generator/](http://wordpress.org/plugins/motivation-generator/)

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

 *  anonymized-13144793
 * (@anonymized-13144793)
 * [12 years, 6 months ago](https://wordpress.org/support/topic/file-access-error/#post-4304322)
 * Hey, TStone. Sorry for the late answer 🙂
 * If you see two errors in red in the admin settings, that’s most likely has to
   do with your file permissions. The first error (about the font) comes up if “
   file_exists” returns false and the second error comes up if “mkdir” returns false.
   It takes paths, not urls as arguments in both of these functions, so “allow_url_fopen”
   isn’t the case here.
 * What’s interesting is the first error (about the font being not found). I use“
   plugin_dir_path” to determine the location of the plugin, so any custom names
   of “wp-content” shouldn’t be the problem either.
 * Could you please make sure you are allowed to create files and folders on your
   hosting? In case you are, please try reinstalling the plugin by removing it completely
   and downloading it again from wordpress.org.
 * Thanks
    Stepan
 *  Thread Starter [TStone](https://wordpress.org/support/users/tstone/)
 * (@tstone)
 * [12 years, 6 months ago](https://wordpress.org/support/topic/file-access-error/#post-4304323)
 * The file permissions are fine.
 * Whether the file paths are correct or not does not change the fact that you have**
   getimagesize** in the code. Which often is disabled because it is a security 
   risk since it can be used for code injections. Even if everything else were perfect,
   there is no way that this plugin can function when “allow_url_fopen” is disabled.
 * For it to function, **getimagesize** need to be replaced with a cURL solution.
   There’s tons of examples on the net on how this is done. Two randomly chosen 
   examples:
    [http://roldanarts.com/2009/11/18/diego-roldan/blog/curl-vs-getimagesize-vs-filegetcontents](http://roldanarts.com/2009/11/18/diego-roldan/blog/curl-vs-getimagesize-vs-filegetcontents)
   [http://goffgrafix.com/blog/index.php/2010/04/if-your-server-sets-the-allow_url_fopen-and-allow_url_include-php-directives-off/](http://goffgrafix.com/blog/index.php/2010/04/if-your-server-sets-the-allow_url_fopen-and-allow_url_include-php-directives-off/)
 *  anonymized-13144793
 * (@anonymized-13144793)
 * [12 years, 6 months ago](https://wordpress.org/support/topic/file-access-error/#post-4304324)
 * > Even if everything else were perfect, there is no way that this plugin can 
   > function when “allow_url_fopen” is disabled.
 * That is true if **(and only if)** you pass a **url** as a parameter to `getimagesize`.
   All the examples you mentioned are talking about **remote** files, not the ones
   that are already on your server.
 * Here is an example. The code below will work no matter what `allow_url_fopen`
   is set to:
 *     ```
       $arr = getimagesize("/var/www/testing/face.png");
       var_dump($arr);
       ```
   
 * However, the following code will return false in case `allow_url_fopen` is disabled:
 *     ```
       $arr = getimagesize("http://upload.wikimedia.org/wikipedia/commons/thumb/9/91/Strobel-bautista_crop_left.jpg/546px-Strobel-bautista_crop_left.jpg");
   
       var_dump($arr);
       ```
   
 *  Thread Starter [TStone](https://wordpress.org/support/users/tstone/)
 * (@tstone)
 * [12 years, 6 months ago](https://wordpress.org/support/topic/file-access-error/#post-4304325)
 * Well, you are probably right.
    Still, there is something that prevent your plugin
   from working, and it’s not file permissions. [http://file.tomstone.se/motivationgen.jpg](http://file.tomstone.se/motivationgen.jpg)
 *  anonymized-13144793
 * (@anonymized-13144793)
 * [12 years, 6 months ago](https://wordpress.org/support/topic/file-access-error/#post-4304326)
 * Thanks for the screenshot! Turns out there was an error when default directories
   were set so the plugin was looking for files and folders in wrong places. I’ve
   just committed the changes which fix it.
 * Please remove the plugin completely through “Settings” -> “Plugins” and install
   it again. Make sure that you are installing version 1.3.6.
 *  Thread Starter [TStone](https://wordpress.org/support/users/tstone/)
 * (@tstone)
 * [12 years, 6 months ago](https://wordpress.org/support/topic/file-access-error/#post-4304327)
 * Now it works! 🙂
 * Thank you!
 *  anonymized-13144793
 * (@anonymized-13144793)
 * [12 years, 6 months ago](https://wordpress.org/support/topic/file-access-error/#post-4304328)
 * Thank you for the feedback 🙂

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

The topic ‘File access error’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/motivation-generator.svg)
 * [Motivation Generator](https://wordpress.org/plugins/motivation-generator/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/motivation-generator/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/motivation-generator/)
 * [Active Topics](https://wordpress.org/support/plugin/motivation-generator/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/motivation-generator/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/motivation-generator/reviews/)

## Tags

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

 * 7 replies
 * 2 participants
 * Last reply from: anonymized-13144793
 * Last activity: [12 years, 6 months ago](https://wordpress.org/support/topic/file-access-error/#post-4304328)
 * Status: resolved