vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Fopen Alternative (https://vborg.vbsupport.ru/showthread.php?t=272661)

MissKalunji 10-24-2011 01:37 PM

Fopen Alternative
 
My fopen is currently disabled.

Would there be an alternative to it?

here's the script snippet

Quote:

function saveFeed($filename="", $displayContents=true) {
if ($filename=="") {
$filename = $this->_generateFilename();
}
$feedFile = fopen($filename, "w+");
if ($feedFile) {
fputs($feedFile,$this->createFeed());
fclose($feedFile);
if ($displayContents) {
$this->_redirect($filename);
}
} else {
echo "<br /><b>Error creating feed file, please check write permissions.</b><br />";
}
}

}
Thank you :D

kh99 10-24-2011 01:45 PM

Hmm...how is it disabled, do you get that "check write permissions" message or some other message?

I don't know of an alternative (although that doesn't mean there isn't one). There's file_put_contents(), but the docs say that's equivalent to using fopen().

MissKalunji 10-24-2011 01:51 PM

Yes I do

Quote:

Warning: fopen(/feed.xml) [function.fopen]: failed to open stream: Permission denied in /home/xxxxxxx/gallery/feedcreator.class.php on line 684

Error creating feed file, please check write permissions.
( I did chmod the file) which prompted me to look further and realizes it was the fopen.

and when I look in my php info

It's turned off locally and master. (the host had asked me and I had agreed) i did read there is an alternative (such as curl) but I can't seem to understand how to change it?

i've tries : file_put_contents() and it doesn't work either...

kh99 10-24-2011 01:56 PM

Well I know you can disable certain protocols to be used with fopen(), like the ability to access file via http. But I don't know that there's any way to completely disable file access, and that error message kind of looks like a directory permission problem.

The error message says fopen(/feed.xml), if it's really trying to create a file at the server root then you probably *don't* have write permission.

MissKalunji 10-24-2011 02:02 PM

Well I ran out of idea....

It is trying to open /feed.xml which is in /gallery

I did chmod it it 777 666 to see neither works, gives me the same error.

I tried hard coding the link...http.... and such nothing's working and the original author

kh99 10-24-2011 02:06 PM

If the file name is "/feed.xml" that won't be in the gallery subdirectory. Is there a config file or settings or something? Maybe it's missing the path to the gallery directory.

MissKalunji 10-24-2011 02:11 PM

No configs however it shows this

Quote:

echo $rss->saveFeed($type, $gallerypath ."/feed.xml");
and my gallery path is www.dancehallareaz.com/gallery

and what i'm trying to run is http://www.dancehallareaz.com/gallery/rss.php

some place in the scripts i see news/ I've tried that

Tried root ./

any other suggestion?

kh99 10-24-2011 02:17 PM

That does look like the problem is with the gallery path. I don't know where that's supposed to be set, you may have to go back and look at the mod instructions and/or code to figure it out.

BTW, there are two kinds of "path" - the one that you use to access files via your web server, and the one that the OS uses. Usually the web server "root" (/) is a subdirectory of the OS file system. So if a php program wants to open a file on the server you probably need the OS path and not the one that starts with www.dancehallareaz.com (if your gallery directory is under the vb forum directory you might be able to use "./gallery" as the gallery path).

MissKalunji 10-24-2011 02:28 PM

Bingo!

He didn't mention there was an edit to do in rss.php

I search in each file and found there was an empty one :

Quote:

// Set Gallery PATH. ( no end slash "/" )
// $gallerypath = "/public_html/gallery";
$gallerypath =
Thank you! :)!!


All times are GMT. The time now is 05:23 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01255 seconds
  • Memory Usage 1,730KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (4)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (9)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete