Page 1 of 1

PHP doesn't seem to be generating HTML properly

Posted: Tue Nov 21, 2006 12:08 pm
by impulse()
Hello.

For some odd reason PHP has started to generate HTML incorrectly depending on where I access the file from.
Firstly, if I run the script from a shell using 'php <file>.php' the HTML is there and correct. But if I try and access it from a web browser it stops generating at a certain point, I can tell this by viewing the source of the web page.

Has anyone come across this before?

Stephen,

Posted: Tue Nov 21, 2006 12:32 pm
by Luke
PHP only outputs what you tell it to, so somewhere you must be telling it to output bad HTML.

Posted: Tue Nov 21, 2006 12:33 pm
by impulse()
This looks more like a server problem than code problem.

If I access the PHP files through a web page then everything after connecting to the MySQL isn't generated, whether it be database information or hard coded HTML. The server is there and runs correctly as I can run the php file from a shell and the HTML is generated fine.

Posted: Tue Nov 21, 2006 12:36 pm
by volka
impulse() wrote:If I access the PHP files through a web page then everything after connecting to the MySQL isn't generated,
Put in more error handling and debug output.

Posted: Tue Nov 21, 2006 12:40 pm
by Luke
You should do all your database connecting as well as any other non-templating logic LONG before you output any HTML, but that is irrelevant I guess...

Do what volka said.