You are here: Re: Massive problem with output buffering « PHP Programming Language « IT news, forums, messages
Re: Massive problem with output buffering

Posted by jools on 11/21/07 23:50

No guys thanks but its nothing to do with not closing files or stuff like
that.

OK - good and bad news...

First my debug code was responding with a wrong error line - it isnt the
text file thats missing its the graphic (<img>) line after it.

Thats the good news...

So I've done as Rik suggested and removed all my code then replaced it
with the minimal code that causes the problem and removed the faulty
debug code. So I'm now working in a plain text editor.

/// Simplest instance of the problem ...

First - these three lines are cut/paste from my actual file -

$mypath = '../foot.gif';
echo("<img src=$mypath alt='File missing'>");
unlink($mypath);

What happens is the output says 'File missing' and never displays the
foot.gif and foot.gif has been deleted.

/// end

After looking into this I've discovered that if I do :

$mypath = 'foot.gif';
echo("<img src=$mypath alt='File missing'>");
unlink($mypath);

And put the image in that directory - it displays the image fine before
correctly deleting it.

I looked at what was happening and the CWD is the only one it works in.
If the image is in any other directory a relative link used by echo() or
print() causes it to not be found but the unlink() DOES find and delete
it! Confusing or what!

SO .. it looks like my problem is a discrepancy between PHP's CWD and a
relative path when using images but not with text files ... as I tried
a simple text file readback and it worked fine with the ../ version.

I think ... so have I missunderstood how PHP uses echo() or something
else fundamental ... or is there a problem here?

And what on earth do I do without changing the CWD?


thanks
-jools-

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация