Friday, 15 August 2014

debugging - Reference - What does this error mean in PHP? -



debugging - Reference - What does this error mean in PHP? -

what this?

this number of answers warnings, errors , notices might encounter while programming php , have no clue how fix. community wiki, invited participate in adding , maintaining list.

why this?

questions "headers sent" or "calling fellow member of non-object" pop on stack overflow. root cause of questions same. answers questions typically repeat them , show op line alter in his/her particular case. these answers not add together value site because apply op's particular code. other users having same error can not read solution out of because localized. sad, because 1 time understood root cause, fixing error trivial. hence, list tries explain solution in general way apply.

what should here?

if question has been marked duplicate of this, please find error message below , apply prepare code. answers contain farther links investigate in case shouldn't clear general reply alone.

if want contribute, please add together "favorite" error message, warning or notice, 1 per answer, short description means (even if highlighting terms manual page), possible solution or debugging approach , listing of existing q&a of value. also, sense free improve existing answers.

the list nothing seen. page empty , white. (also known white page/screen of death) code doesn't run/what looks parts of php code output warning: cannot modify header info - headers sent warning: mysql_fetch_array() expects parameter 1 resource, boolean given a.k.a. warning: mysql_fetch_array(): supplied argument not valid mysql result resource a.k.a. warning: mysqli_num_rows() expects parameter 1 mysqli_result, boolean given (or similar variations) warning: [function] expects parameter 1 resource, boolean given warning: [function]: failed open stream: [reason] warning: open_basedir restriction in effect warning: partition zero warning: illegal string offset 'xxx' parse error: syntax error, unexpected '[' parse error: syntax error, unexpected t_xxx parse error: syntax error, unexpected t_encapsed_and_whitespace parse error: syntax error, unexpected t_paamayim_nekudotayim parse error: syntax error, unexpected t_variable fatal error: allowed memory size of xxx bytes exhausted (tried allocate xxx bytes) fatal error: phone call fellow member function ... on non-object fatal error: phone call undefined function xxx fatal error: cannot redeclare xxx fatal error: can't utilize function homecoming value in write context fatal error: declaration of aaa::bbb() must compatible of ccc::bbb() ' fatal error: using $this when not in object context notice: array string conversion notice: trying property of non-object error notice: undefined variable notice: undefined index notice: undefined offset xxx [reference] notice: uninitialized string offset: xxx notice: utilize of undefined constant xxx - assumed 'xxx' mysql: have error in sql syntax; check manual corresponds mysql server version right syntax utilize near ... @ line ... strict standards: non-static method [<class>::<method>] should not called statically

also see

reference - symbol mean in php?

warning: cannot modify header info - headers sent

happens when script tries send http header client there output before, resulted in headers sent client.

this e_warning , not stop script.

a typical illustration template file this:

<html> <?php session_start(); ?> <head><title>my page</title> </html> ...

the session_start() function seek send headers session cookie client. php sent headers when wrote <html> element output stream. you'd have move session_start() top.

you can solve going through lines before code triggering warning , check outputs. move header sending code before code.

an overlooked output new lines after php's closing ?>. considered standard practice omit ?> when lastly thing in file. likewise, mutual cause warning when opening <?php has empty space, line, or invisible character before it, causing webserver send headers , whitespace/newline when php starts parsing won't able submit header.

if file has more 1 <?php ... ?> code block in it, should not have spaces in between them. (note: might have multiple blocks if had code automatically constructed)

also create sure don't have byte order marks in code, illustration when encoding of script utf-8 bom.

related questions:

headers sent php all php "headers sent" questions on stackoverflow byte order mark what php functions create output?

php debugging

No comments:

Post a Comment