fopen(), fread(), fclose() errors

Problems with the Windows version of XAMPP, questions, comments, and anything related.

fopen(), fread(), fclose() errors

Postby posword » 12. October 2005 06:38

I'm trying to setup a mirror site on my Windows XP machine of my PHP-Nuke site. I've tried using both EasyPHP and Xampp.

I suspect my problem is related to php.ini but I cannot figure what is wrong. The header and footer display correctly, but blocks and modules only display the title but no content. I'm using the same files that are online and they work perfectly on the site. Obviously Apache and MySQL are working ok.

Does the fact of no content displaying ring a bell with anyone as to what is missing? Perhaps it is to do with PHP error reporting, or a missing PHP extension.

Further research in log files shows the problem is related to fopen(), fread() and fclose() from (particularly) themesidebox() in theme.php. "[Errpr] PHP Warning : fclose() : supplied argument is not a valid streaming resource..." Yet this is working online.

Any help much appreciated.

I'm using PHP 4.3.11 as that is what is in use on my hosted site, although I get the same error with XAMPP and PHP 5.

Thanks,
Peter
posword
 
Posts: 5
Joined: 12. October 2005 06:33

Postby Wiedmann » 12. October 2005 12:44

Further research in log files shows the problem is related to fopen(), fread() and fclose() from (particularly) themesidebox() in theme.php. "[Errpr] PHP Warning : fclose() : supplied argument is not a valid streaming resource..." Yet this is working online.

Without a small code sample we can't help.
Wiedmann
AF Moderator
 
Posts: 17106
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

fopen(), fread(), fclose() errors

Postby posword » 13. October 2005 02:40

I am assuming that since the code works online as is, that it should work offline as is under the same version of PHP. Anyway, here's one of the blocks in question...

<?php

/************************************************************************/
/* PHP-NUKE: Web Portal System */
/* =========================== */
/* */
/* Copyright (c) 2001 by Francisco Burzi (fbc@mandrakesoft.com) */
/* http://phpnuke.org */
/* */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License. */
/************************************************************************/

if (eregi("block-ICNC.php",$_SERVER['PHP_SELF'])) {
Header("Location: index.php");
die();
}

$paypal = "https://www.paypal.com/xclick/business= etc.........";
$content = "<center><font class=h2>In Christ:<br>A New Creation</font><br><a href=\"$paypal\" target=\"_blank\">";
$content .= "<img src=\"images/ICNC.jpg\" border=\"0\" alt=\"\"></a><br>3rd Revised Edition. <a href=\"$paypal\" target=\"_blank\"><b>Get your own copy now!</b></a> Every word pondered and prayed over, totally reset, new title, new cover! Learn the vital and liberating teaching that so few are sharing today. $5.95 plus P&H.<br><img src=\"images/paypalcc.gif\" vspace=4 border=\"0\" alt=\"\"></center>";

?>
~~~~~~~~~~~~~~~~~~~

Thanks,
Peter
posword
 
Posts: 5
Joined: 12. October 2005 06:33

Postby Wiedmann » 13. October 2005 03:04

Further research in log files shows the problem is related to fopen(), fread() and fclose() ...

Anyway, here's one of the blocks in question...

I can't see any fopen(), fread(), fclose() or something like that?
Wiedmann
AF Moderator
 
Posts: 17106
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

fopen(), fread(), fclose() errors

Postby posword » 14. October 2005 01:41

Sorry, forgot to include the function that controls the blocks...

function themesidebox($title, $content) {
if (@file_exists($content)) {
$fp = fopen ($content, "r");
$content = fread($fp, filesize($content));
fclose ($fp);
$content = "?>$content<?";
$content = eval($content);
} else if (eregi("^http", $content)) {
$fp = fopen ($content, "r");
$content = fread($fp, 65535);
fclose ($fp);
}
$tmpl_file = "themes/Posipurple/blocks.html";
$thefile = implode("", file($tmpl_file));
$thefile = addslashes($thefile);
$thefile = "\$r_file=\"".$thefile."\";";
eval($thefile);
print $r_file;
}
posword
 
Posts: 5
Joined: 12. October 2005 06:33

fopen(), fread(), fclose() errors

Postby posword » 19. October 2005 04:21

I still can't get past error messages.

Any ideas welcome.

Peter
posword
 
Posts: 5
Joined: 12. October 2005 06:33


Return to XAMPP for Windows

Who is online

Users browsing this forum: hthnightwolf and 66 guests