LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 12-07-2009, 02:28 AM   #1
tommytomato
Member
 
Registered: Nov 2003
Location: Narrogin Western Australia
Distribution: GUI Ubuntu 14.0.4 - Server Ubuntu 14.04.5 LTS
Posts: 963

Rep: Reputation: 32
readfile


Hi

Quote:
Is readfile disabled on your live box?
Where can I find readfile ???

this is very new to me, is it a php5 issue, do I need to install or edit some thing.

Use. needed to show gallery image

Code:
<?php @readfile('http://mydomain.com/gallery2/main.php?g2_view=imageblock.External&g2_blocks=randomImage&g2_show='); ?>
I cant tell if it's ON or OFF

TT
 
Old 12-07-2009, 05:48 AM   #2
timmeke
Senior Member
 
Registered: Nov 2005
Location: Belgium
Distribution: Red Hat, Fedora
Posts: 1,515

Rep: Reputation: 61
Could you try a simple call to readfile (not @readfile, as this omits error messaging) on a local file that you can read for sure (proper permissions)?
Just to see if readfile is there and it works.

Read also:
http://php.net/manual/en/function.readfile.php
 
Old 12-07-2009, 06:20 AM   #3
tommytomato
Member
 
Registered: Nov 2003
Location: Narrogin Western Australia
Distribution: GUI Ubuntu 14.0.4 - Server Ubuntu 14.04.5 LTS
Posts: 963

Original Poster
Rep: Reputation: 32
Quote:
Originally Posted by timmeke View Post
Could you try a simple call to readfile (not @readfile, as this omits error messaging) on a local file that you can read for sure (proper permissions)?
Just to see if readfile is there and it works.

Read also:
http://php.net/manual/en/function.readfile.php
Sorry I'm unsure to what you mean

TT
 
Old 12-07-2009, 07:56 AM   #4
timmeke
Senior Member
 
Registered: Nov 2005
Location: Belgium
Distribution: Red Hat, Fedora
Posts: 1,515

Rep: Reputation: 61
Try a code like
Code:
<?php readfile('file://path/to/local/file'); ?>
for a known, local file that you can open in your browser.
This should print error messages.
You could also print the return value (number of bytes read, which should be >0).

Looking at the URL you used in your code, are you sure that the &g2_show= doesn't need a value (ie it can handle empty value)?
 
Old 12-07-2009, 02:51 PM   #5
tommytomato
Member
 
Registered: Nov 2003
Location: Narrogin Western Australia
Distribution: GUI Ubuntu 14.0.4 - Server Ubuntu 14.04.5 LTS
Posts: 963

Original Poster
Rep: Reputation: 32
Quote:
Originally Posted by timmeke View Post
Try a code like
Code:
<?php readfile('file://path/to/local/file'); ?>
for a known, local file that you can open in your browser.
This should print error messages.
You could also print the return value (number of bytes read, which should be >0).

Looking at the URL you used in your code, are you sure that the &g2_show= doesn't need a value (ie it can handle empty value)?
Here is what i used

Code:
<?php readfile('/var/www/file.txt'); ?>
No error on browser, it read the file OK

value - show=title

So I tried this

Code:
<?php readfile('/folder/folder/folder/main.php?g2_view=imageblock.External&g2_blocks=randomImage&g2_show=title'); ?>
which gets me in browser
Warning: readfile(/folder/folder/folder/main.php?g2_view=imageblock.External&g2_blocks=randomImage&g2_show=title) [function.readfile]: failed to open stream: No such file or directory in /var/www/read.php on line 4

TT
 
Old 12-07-2009, 11:28 PM   #6
tommytomato
Member
 
Registered: Nov 2003
Location: Narrogin Western Australia
Distribution: GUI Ubuntu 14.0.4 - Server Ubuntu 14.04.5 LTS
Posts: 963

Original Poster
Rep: Reputation: 32
Quote:
Originally Posted by tommytomato View Post
Here is what i used

Code:
<?php readfile('/var/www/file.txt'); ?>
No error on browser, it read the file OK

value - show=title

So I tried this

Code:
<?php readfile('/folder/folder/folder/main.php?g2_view=imageblock.External&g2_blocks=randomImage&g2_show=title'); ?>
which gets me in browser
Warning: readfile(/folder/folder/folder/main.php?g2_view=imageblock.External&g2_blocks=randomImage&g2_show=title) [function.readfile]: failed to open stream: No such file or directory in /var/www/read.php on line 4

TT
would a2enmod be used to enable readfile ?

Or is that completely different

TT
 
Old 12-08-2009, 01:36 AM   #7
timmeke
Senior Member
 
Registered: Nov 2005
Location: Belgium
Distribution: Red Hat, Fedora
Posts: 1,515

Rep: Reputation: 61
The error sounds to me like readfile function is being called, it just can't open the I/O stream. Is the path to main.php correct? Could you try a relative path, for instance?
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
php readfile http VS https blizunt7 Programming 3 04-28-2009 11:18 PM
C++ Readfile/Parser and change tokens nkapachi Programming 4 02-16-2006 07:04 PM
UT2004 some maps give "ReadFile beyond EOF 0+4/0..." AC97Conquerer Linux - Games 1 03-25-2005 01:52 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:48 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration