Fix How? Fontpress Wordpress Plugin Error "Warning: file_get_contents(C:./..) failed to open stream: Permission denied" on Win7 64 XAMPP 1.8.1 WP 3.5
Warning: file_get_contents(C:\Git\HG\xampp\htdocs\wordpress/wp-content/plugins/fontpress/cufon/..):
failed to open stream: Permission denied in
C:\Git\HG\xampp\htdocs\wordpress\wp-content\plugins\fontpress\functions.php on line 9
I am guessing this is due to some PHP related limited Ability or Permission issue on Windows 7 with XAMPP Windows W AMP/ LAMP Stack.
- I've read about similar issues where permission needed to be changed 775 etc.
- But, this is Windows 7 x64 with XAMPP 1.8.1 running Wordpress 3.5 Multi-Site Network.
- What kind of permissions changes are needed?
- Tried all kinds of permission fixes suggested in the comments below.
- Would installing the plugin by uploading the ZIP file work/ apply right permissions?
- Tried this out as well
A comment by someone on another thread somewhere about XAMP linked to this ticket
XAMPP has an annoying issue working with WP Cron and fopen()
UPDATES:
Another thing I noticed is that there is a mix of both, forward "/" and backward "\" slashes in the path being accessed by
file_get_contents(C:\Git\HG\xampp\htdocs\wordpress/wp-content/plugins/fontpress/cufon/..)
I hope that's not the cause, for this thing to fire up.
Some interesting updates and insights:
- I added the suggested PHP code
if (!is_dir($font_file)) { /*lines 9-11*/ }to wrap those lines usingfile-get-contentsand it got fixed - Now I seem to have found another
file-get-contentssomewhere else causing another similar issue Some additional information on issues PHP
file-get-contentshas on Windows:- How to fix PHP Warning:
file_get_contents? - Comment below from PHP Reference for
file-get-contents: seems to fix 2nd issue:
- How to fix PHP Warning:
andre-s at home dot nl - 1 year ago
If you are getting a
failed to open streammessage on your Windows machine check your HOSTS file.
127.0.0.1 localhostmust be in it and the IP6 line must be commented
# ::1 localhost
Here's a snippet of the PHP Code:
// get all the cufons from a folder
function fp_cufon_list() {
$fonts = array();
$cufon_list = scandir(FP_DIR."/cufon");
foreach($cufon_list as $font_file){
$file_content = file_get_contents(FP_DIR."/cufon/".$font_file); // <- Line No: 9
if(preg_match('/font-family":"(.*?)"/i',$file_content,$match)){
$fonts[$match[1]] = basename($font_file);
}
}
return $fonts;
}
Sanitized Folder Tree for "Fontpress" Plugin (to give some idea of Structure):
+---classes
+---css
| \---ui-wp-theme
| \---images
+---cufon
| Candela_Bold_400.font.js
| ChunkFive_400.font.js
| Colaborate-Medium_400.font.js
| Daniel_400.font.js
| Imperator_400.font.js
| Luna_400.font.js
| PT_Sans_Narrow_400.font.js
| Quicksand_Light_300.font.js
| Segan_300.font.js
| tree.txt
| Vegur_400.font.js
|
+---fonts
| +---Bebas_Neue_Regular
| | bebasneue-webfont.eot
| | bebasneue-webfont.svg
| | bebasneue-webfont.ttf
| | bebasneue-webfont.woff
| |
| +---Blokletters_Balpen_Balpen
| +---Capture_it_Regular
| +---Chelsea_Regular
| +---Cicle_Gordita
| +---Colaborate_Thin_Regular
| +---Fearless_Regular
| +---GoodDog_Regular
| +---Journal_Regular
| +---Ubuntu_Title_Title
| \---Walkway_SemiBold_Regular
+---img
+---js
| +---colorpicker
| | +---images
| | \---js
| \---iphone_checkbox
| \---images
| +---ios-style-checkboxes
| \---iphone-style-checkboxes
\---temp
Thoughts/ Suggestions?
What can I do to fix this in terms of Permissions or PHP Code?