Re: output of fread() is blank - FIXED - updated
| From: | Philip Olson | Date: | Tue, 28 Jan 2003 00:21:01 +0000 |
| Subject: | Re: output of fread() is blank - FIXED - updated | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-133325@lists.php.net to get a copy of this message | ||
On Mon, 27 Jan 2003, Guru Geek wrote:
> Sorry, here is the code now ( I need a nap )
>
> $filename
> ="/usr/local/plesk/apache/vhosts/myserver.com/httpdocs/include/text.txt";
> $handle = fopen ($filename, "r");
> $contents = fread ($handle, filesize ($filename));
> fclose ($handle);
> echo $contents;
> exit;
For something like this, just use readfile() and not fread
as it'd be much more efficient if you don't actually manipulate
the string $contents. So:
readfile($filename); // note: do not use echo
Also, what is your include_path setting? It's important
you know it and what it means as that'll answer the
question in your last post:
print ini_get('include_path');
http://www.php.net/manual/configuration.directives.php#ini.include-path
Also, no need for "exit" here as that happens automatically.
Regards,
Philip