Hi, I'm a newbie to PHP and I guess somebody else installed the Magpie RSS and I have to figure our the error that it is showing on our webpage Warning: require_once(magpierss/rss_fetch.inc) [function.require-once]: failed to open stream: No such file or directory in http://www.animalrightsportal.net/Home/inc/home/column1.inc on line 5 Fatal error: require_once() [function.require]: Failed opening required 'magpierss/rss_fetch.inc' (include_path='.:/usr/local/php5/lib/php') in http://www.animalrightsportal.net/Home/inc/home/column1.inc on line 5 I have all the 4 important files and extlib in a folder named magpierss and my php.ini is outside of it. This is the code inside my column1.inc file <?php define('MAGPIE_CACHE_DIR', '/tmp/magpie_cache'); define('MAGPIE_DIR', 'magpierss/'); $rss_url= "http://www.envirolink.org/animalnews.rss"; require_once(MAGPIE_DIR.'rss_fetch.inc'); $rss = fetch_rss('http://www.envirolink.org/animalnews/atom.xml'); $rss_i=0; echo "<br/>"; foreach ($rss->items as $rss_item ) { $item_desc = $rss_item['description']; $item_title = $rss_item['title']; $item_url = $rss_item['link']; $item_date = substr($rss_item['pubdate'], 0, 16); echo "<p class=\"rss\"><span class=\"rss_date\">$item_date </span><a href=\"$item_url\" target=\"_blank\"><span class=\"rss_link\">$item_title</span></a><span class=\"rss_desc\"> $item_desc</span></p>"; $rss_i++; if($rss_i>8) break; } echo "<p class=\"rss_source\">RSS feed source: <a href=\"".$rss->channel['link']."\" target=\"_blank\"><span class=\"rss_chlink\">".$rss->channel['title']."</span></a></p><br/>"; ?> Could somebody please shed some light on this issue?
ok I got around this by including the relevant files through another file above the magpie directory. Maybe the same will work for you. And I did not set any of the magpie related defines like MAGPIE_DIR or the cache dir. EDIT: Checked my local install/setup of that and it's close to yours. Except I have the 4 files in a /system folder in the /magpie folder and extlib is inside of /system with /magpie/cache as the other. I think you need to put them into a /system folder along with extlib. But I will go download a fresh copy and see if that's the out of the box layout first. Nope, you're setup looks right. I'll post the code I used in another post if you want.
Could you please post the code ,it would greatly help me. Also I have four column files such as column 1.inc ...Column 4.inc (column.inc is the one I pasted in my previous thread) are under home\inc\home\inc. Were exactly do these files reside inside the magpie folder or do they appear somewhere else? If you could also let me know of where exactly the php.ini file should go,it will be very helpful. I sincerely do appreciate your help in this issue. Thanks again
so where exactly is the /magpie directory in relation to the /inc/home/inc directory? odds are that's the problem.
yes, I too was thinking about that... For this portal animal rights ,there is a folder named animal rights. The magpie directory is under the animalrights/magpierss and these column files (1,2,3,4)reside under animalrights/home/inc/home ... Hope I explained it properly...
ya so you need to either move magpie to /home/inc/home or change the magpie rss directory to something like ../../../magpierss , think that's right.
I moved the folder to under the home directory but had no luck and got stuck with the same errors. The second error : Fatal error: require_once() [function.require]: Failed opening required 'magpierss/rss_fetch.inc' (include_path='.:/usr/local/php5/lib/php') in http://www.animalrightsportal.net/Home/inc/home/column1.inc on line 4 I was wondering if the fatal error message is trying to convey that it is unable to find the correct path on the server and is asking to include that path usr/local/php5/lib/php on the server. Do you think my assumption is right? Coz I don't think my magpie files are causing a problem since I am able to browse to the rss fetch file through the browser without any problems. Any advice would be appreciated. Thanks
Nope. Seen this before plenty of times. The error is that it can not locate the magpie files. And since its obviously a problem, you can rectify it by declaring the full path to the magpie files. Do you know the full path to your home directory? ok let's just skip that. Here's what you can use to get the correct path , save your current file as a backup and create a new one with this : <?php $path = $_SERVER["DOCUMENT_ROOT"]; echo $path; $magpie_path = $path . "Home/inc/home/magpierss/"; define('MAGPIE_DIR', $magpie_path); require_once(MAGPIE_DIR.'rss_fetch.inc'); $rss = fetch_rss('http://www.envirolink.org/animalnews/atom.xml'); $rss_i=0; echo "<br/>"; foreach ($rss->items as $rss_item ) { $item_desc = $rss_item['description']; $item_title = $rss_item['title']; $item_url = $rss_item['link']; $item_date = substr($rss_item['pubdate'], 0, 16); echo "<p class=\"rss\"><span class=\"rss_date\">$item_date </span><a href=\"$item_url\" target=\"_blank\"><span class=\"rss_link\">$item_title</span></a><span class=\"rss_desc\"> $item_desc</span></p>"; $rss_i++; if($rss_i>8) break; } echo "<p class=\"rss_source\">RSS feed source: <a href=\"".$rss->channel['link']."\" target=\"_blank\"><span class=\"rss_chlink\">".$rss->channel['title']."</span></a></p><br/>"; ?> Code (markup):
Now get these errors /var/chroot/home/content/e/n/v/envdomains/html Warning: require_once(/var/chroot/home/content/e/n/v/envdomains/htmlHome/inc/home/magpierss/rss_fetch.inc) [function.require-once]: failed to open stream: No such file or directory in http://www.animalrightsportal.net/Home/inc/home/column1.inc on line 7 Fatal error: require_once() [function.require]: Failed opening required '/var/chroot/home/content/e/n/v/envdomains/htmlHome/inc/home/magpierss/rss_fetch.inc' (include_path='.:/usr/local/php5/lib/php') in http://www.animalrightsportal.net/Home/inc/home/column1.inc on line 7 Any ideas?
do you have a directory named htmlHome? try changing the 3rd line to: $magpie_path = $path . "/Home/inc/home/magpierss/";
Added the slash but still I get the error ... /var/chroot/home/content/e/n/v/envdomains/html Warning: require_once(/var/chroot/home/content/e/n/v/envdomains/html/Home/inc/home/magpierss/rss_fetch.inc) [function.require-once]: failed to open stream: No such file or directory in http://www.animalrightsportal.net/Home/inc/home/column1.inc on line 7 Fatal error: require_once() [function.require]: Failed opening required '/var/chroot/home/content/e/n/v/envdomains/html/Home/inc/home/magpierss/rss_fetch.inc' (include_path='.:/usr/local/php5/lib/php') in http://www.animalrightsportal.net/Home/inc/home/column1.inc on line 7
your real path is this : /home/content/e/n/v/envdomains/html/Home/inc/home/magpierss/ according to godaddy. So let's try this... just change this line : $magpie_path = $path . "/Home/inc/home/magpierss/"; to: $magpie_path = "/home/content/e/n/v/envdomains/html/Home/inc/home/magpierss/";
I still get the same error. I've copied the column.inc file with all changes made so that you can see if there is anything wrong... One more thing.. This issue came up when they changed to a new server.. <?php $path = $_SERVER["DOCUMENT_ROOT"]; echo $path; $magpie_path = $path."/home/content/e/n/v/envdomains/html/Home/inc/home/magpierss/"; define('MAGPIE_DIR', $magpie_path); require_once(MAGPIE_DIR.'rss_fetch.inc'); $rss = fetch_rss('http://www.envirolink.org/animalnews/atom.xml'); $rss_i=0; echo "<br/>"; foreach ($rss->items as $rss_item ) { $item_desc = $rss_item['description']; $item_title = $rss_item['title']; $item_url = $rss_item['link']; $item_date = substr($rss_item['pubdate'], 0, 16); echo "<p class=\"rss\"><span class=\"rss_date\">$item_date </span><a href=\"$item_url\" target=\"_blank\"><span class=\"rss_link\">$item_title</span></a><span class=\"rss_desc\"> $item_desc</span></p>"; $rss_i++; if($rss_i>8) break; } echo "<p class=\"rss_source\">RSS feed source: <a href=\"".$rss->channel['link']."\" target=\"_blank\"><span class=\"rss_chlink\">".$rss->channel['title']."</span></a></p><br/>"; ?> Thanks again for helping me out with this issue
get rid of the $path variable : $magpie_path = "/home/content/e/n/v/envdomains/html/Home/inc/home/magpierss/";
Thanks for the reply. I think I fixed the problem. I had removed the path variable(realized this after I posted the reply to you) and also replaced the first half of the path with the qualified url to show something like this $magpie_path = "http://www.animalrightsportal.net/Home/inc/home/magpierss/"; and changed this to show $rss = fetch_rss('http://www.envirolink.org/animalnews.rss'); Thanks for your dedicated help. Really appreciate it