The fact that there's a seg fault involved makes me think that's it's not so
much a problem w/ code, but a problem with either apache (or whatever web
server you use) a/o your PHP installation -

PHP may be seg faulting before it's done reading the data from the directory
and apache is reporting that no data was sent but the parser has stopped
responding and is what it thinks is "done".

Could also be that the user apache runs under doesn't have access to that
directory.

Or i could be completley wrong too... who knows ;)

//Nick

-----Original Message-----
From: Martin Towell [mailto:[EMAIL PROTECTED]]
Sent: Thursday, April 11, 2002 10:43 PM
To: 'Phieu Huynh'
Cc: [EMAIL PROTECTED]
Subject: RE: [PHP] "the document contained no data"


does that code work if you set the directory path to "./" ?

-----Original Message-----
From: Phieu Huynh [mailto:[EMAIL PROTECTED]]
Sent: Friday, April 12, 2002 3:33 PM
To: Martin Towell
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] "the document contained no data"



I also try the following code and still have the same problem.
I am runing php4.0.?, solaris(linux)

$dir_name = "/export/home/phuynh/php/main/student/upload/";
$dir = opendir($dir_name);
 while (false !== ($file_names = readdir($dir))) {
          echo "$file_names";
 }
 closedir($dir);


Martin Towell wrote:

> odd, I copied your code, changed the dir to "./" and it works for me
> (php4.0.?, winnt)
>
> if dir() doesn't work for you, you might need to use opendir(), readdir(),
> etc
>
> -----Original Message-----
> From: Phieu Huynh [mailto:[EMAIL PROTECTED]]
> Sent: Friday, April 12, 2002 2:14 PM
> To: Martin Towell; [EMAIL PROTECTED]
> Subject: Re: [PHP] "the document contained no data"
>
> Sorry, the file has ; I retype it wrong,
> I did set error_reporting but no change,
> but in the httpd error log file I found "exit signal segmentation fault
> (11)"
>
> Martin Towell wrote:
>
> > is that a direct copy of your code - if it is, you're missing a ; after
> > $entry=$d->read()
> > but that wound have stopped the first one...
> >
> > to set error level to E_ALL, use:
> > error_reporting(E_ALL);
> >
> > or set it in your php.ini file
> > error_reporting = E_ALL
> >
> > -----Original Message-----
> > From: Phieu Huynh [mailto:[EMAIL PROTECTED]]
> > Sent: Friday, April 12, 2002 12:31 PM
> > To: Martin Towell; [EMAIL PROTECTED]
> > Subject: Re: [PHP] "the document contained no data"
> >
> > I don't know how to set erro level to E_ALL, can you give me some
sample.
> > I did try different way
> >
> > <?
> >   $d = dir("/export/home/phuy/www/test/upload");
> >   echo "Handle: ".$d->handle."<br>";
> >   echo "Path: ".$d->path."<br>";
> >         $entry=$d->read()
> >         echo $entry ;
> >   $d->close();
> > ?>
> >
> > it is ok and the output is only a dot(.)
> > if I add another read() statement then I got " ... no data"
> >
> > <?
> >   $d = dir("/export/home/phuy/www/test/upload");
> >   echo "Handle: ".$d->handle."<br>";
> >   echo "Path: ".$d->path."<br>";
> >         $entry=$d->read()
> >         echo $entry ;
> >         $entry=$d->read()
> >         echo $entry ;
> >   $d->close();
> > ?>
> >
> > can anyone tell me what has read() has
> > and readdir() return.
> >
> > Martin Towell wrote:
> >
> > > turn the displaying of errors on, and set the error level to E_ALL
> > > I'm thinking that you've got a error somewhere that's stopping the
> script
> > > prematurely
> > >
> > > -----Original Message-----
> > > From: Phieu Huynh [mailto:[EMAIL PROTECTED]]
> > > Sent: Friday, April 12, 2002 10:49 AM
> > > To: [EMAIL PROTECTED]
> > > Subject: [PHP] "the document contained no data"
> > >
> > > Hi,
> > >     I am trying to read the files in the directory and display them .
> > > but I got the message " the document contained no data "
> > >
> > > this is my code
> > > <?
> > >   $d = dir("/export/home/phuy/www/test/upload");
> > >   echo "Handle: ".$d->handle."<br>";
> > >   echo "Path: ".$d->path."<br>";
> > >
> > >   while($entry=$d->read()) {
> > > echo $entry."<br>\n";
> > >   }
> > >   echo "<hr>";
> > >   $d->close();
> > > ?>
> > >
> > >   Can anyone tell me what should I do to correct it.
> > >   I would like some help, thank in advance.
> > >
> > > --
> > > PHP General Mailing List (http://www.php.net/)
> > > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> > --
> >
> >  Phieu (phil) Huynh
> >  Computer System Officer
> >  Monash University
> >  Electrical & Computer Systems Engineering
> >  Phone : +61 3 990 53469
>
> --
>
>  Phieu (phil) Huynh
>  Computer System Officer
>  Monash University
>  Electrical & Computer Systems Engineering
>  Phone : +61 3 990 53469

--

 Phieu (phil) Huynh
 Computer System Officer
 Monash University
 Electrical & Computer Systems Engineering
 Phone : +61 3 990 53469



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to