Page 1 of 1

Chopping off .phps files?

Posted: Wed Aug 21, 2002 5:20 pm
by enygma
Alright, I have to admit - I'm stumped.

Check out these links:
http://www.phpdeveloper.org/feedback_class.phps
http://www.phpdeveloper.org/xml_class.phps
http://www.phpdeveloper.org/amazon_class.phps

Now, the common thread - they all get chopped off before the bottm. (And yes, I made sure they were all there...) The files on the server are intact, but I can't get Apache to show them all for some reason....

Has anyone else ever seen this? And how did you fix it?
thanks.....

Posted: Wed Aug 21, 2002 5:27 pm
by nielsene
I have seen a somewhat similar problem on some older build of php when writing very long strings to files. If the formatter is written in php you might want to see if you can make it echo/output the formatted code in chunks instead of all at once (if that's what its doing) It shouldn't be a problem in newer versions of php(at least according to the developers) but I've left my "chunked" code in my pages.

Posted: Wed Aug 21, 2002 5:29 pm
by nielsene
One other tought, viewing the source html it appears there there are no newlines in the entire document. Perhaps apache is having trouble dealing with a single line that long?

Posted: Wed Aug 21, 2002 5:47 pm
by enygma
well, normally, you can just make the file a .phps copy of the origional and apache/PHP handle the output.

but that might be it....too bad i cant control it.

Posted: Wed Aug 21, 2002 5:48 pm
by hob_goblin
my version of php adds in new lines...it seems to run it through nl2br() or something. at every break in the code i see:

Code: Select all

code..
<br />
code..
so im going to go with the idea that apache can't handle a line that long being generated..php or apache

Posted: Wed Aug 21, 2002 9:59 pm
by nielsene
But doesn't apache still know to hand off the execution of .phps script to another specified script to generate the pretty-printing? (Ie the input phps script is identical to the main .php (often a symlink, right) and apache knows nothing about pretty-printing so some script on your server is creating the returned page.

It might be as simple as inserting a \n after every <br /> or something like

Code: Select all

$len= strlen($wholePage);
$numBlocks = $len/512;
for ($i=0;$i<$numBlocks;$i++)
&#123;
    echo substr($wholePage,$i*512,512);
&#125;
If you could provide a pointer to the script youre using to generate the markup, I'ld happily take a look.

Posted: Wed Aug 21, 2002 10:15 pm
by nielsene
So I've dug around on the php.net site to look at how they appear to be doing it and how they suggest doing it (often different), their pages appeae to have the same all source=one line of text affect, but most of their pages are quite short.

What version of php are you running? I can force a similar problem on one of my machines that has an ancient version, 4.0.4.

Posted: Thu Aug 22, 2002 8:15 am
by enygma
that's just it - i'm not passing it off to a script.
The .phps file is a native thing for PHP - it handles it on it's own as long as the AddType is in the Apache conf. On all my other machines, it works just fine....I make the .phps symlink and it shows the entire file just fine in the browser.

But, for some reason this one doesn't want to cooperate. I hacked around it for my purposes, but I've heard from other people that this is a bug that other people have seen since PHP 4.1.2