i've recently installed apache2 and php5 locally on my computer, and installed a open source gallery.
in the source code there's a grater than comparisson between a variable and a number, but the > is recognized as an end tag (as if in the older version PHP/FI 2.0, see http://www2.stack.ru/~julia/PHP4/migration.php3.html).
the rest of the script after the grater than character if printed out in the document as html.
what can i do to prevent this from happening?
is there something to configure in the installation of apache or php?
thanks!
Last edited by martinco on Fri Jun 29, 2007 1:00 am, edited 1 time in total.
the gallery i installed is plogger (open source). i've installed it in a server via ftp before and worked perfectly. the think here has to do with my apache or php configuration, not with the script.
the script that causes the error is contained in the source file \lib\exifer1_4\exif.php of plogger. That file if called by the function require_one(...) in a file (admin\plog-admin-functions.php) that was called by include(...) in the file shown by the browser (admin\plog-upload.php and many others).
the 'grater than' character appears in the line 336 of exif.php :
all the script after that '>' is printed on the document "2147483647) $top = $top - 4294967296; //this makes the number signed instead of unsigned if($bottom!=0) $data=$top/$bottom; else if($top==0) $data = 0;" etc etc etc etc.... and after the end of the script comes the rest of the page.
I guess the browser got the whole code and interpreted > as the end of one html tag.
Take a closer look at your opening tags. Do you use <? or <?php ?
Or is there by any chance a space between < and ? ?
Argh, I've read about this issue before but can't remember where it was posted. I think it happens when your apache/php config has set it's start and end tags to <? and > but I'm not sure. I bet someone else here can shed a light onto this though.
then the whole script's code will be sent to the browser.
And the browser will interpret <? if (3 > as an broken tag/processing instruction and the rest is just text.
in my php configuration the short_open_tag attribute was Off.
i'd read about it and decided to give it the default value (off). but now i see that the script that was bottering me uses short tags <? ... >
i decided to change my php configuration turning short_open_tagOn instead of editing the original script.
I'd highly suggest you don't. I believe short tags will be completely removed as of PHP6, so get used to not using them ASAP. I gave you the regex you need to remove them all. I had to do it once on someone else's files.