PHP TutorialCompile PHP ExtensionsContributing to the PHP CoreContributing to the PHP ManualCreate PDF files in PHPInstalling a PHP environment on WindowsPHP Alternative Syntax for Control StructuresPHP APCuPHP Array iterationPHP ArraysPHP Asynchronous programmingPHP Autoloading PrimerPHP BC Math (Binary Calculator)PHP Built in serverPHP CachePHP Classes and ObjectsPHP ClosurePHP Coding ConventionsPHP Command Line Interface (CLI)PHP CommentsPHP Common ErrorsPHP Compilation of Errors and WarningsPHP Composer Dependency ManagerPHP ConstantsPHP Control StructuresPHP CookiesPHP CryptographyPHP DateTime ClassPHP DebuggingPHP Dependency InjectionPHP Design PatternsPHP Docker deploymentPHP Exception Handling and Error ReportingPHP Executing Upon an ArrayPHP File handlingPHP Filters & Filter FunctionsPHP Functional ProgrammingPHP FunctionsPHP GeneratorsPHP Headers ManipulationPHP How to break down an URLPHP How to Detect Client IP AddressPHP HTTP AuthenticationPHP Image Processing with GDPHP ImagickPHP IMAPPHP Installing on Linux/Unix EnvironmentsPHP JSONPHP LocalizationPHP LoopsPHP Machine learningPHP Magic ConstantsPHP Magic MethodsPHP Manipulating an ArrayPHP mongo-phpPHP Multi Threading ExtensionPHP MultiprocessingPHP MySQLiPHP MySQLi affected rows returns 0 when it should return a positive integerPHP NamespacesPHP Object SerializationPHP OperatorsPHP Output BufferingPHP Outputting the Value of a VariablePHP Parsing HTMLPHP Password Hashing FunctionsPHP PDOPHP PerformancePHP PHPDocPHP Processing Multiple Arrays TogetherPHP PSRPHP Reading Request DataPHP RecipesPHP ReferencesPHP ReflectionPHP Regular Expressions (regexp/PCRE)PHP Secure Remeber MePHP SecurityPHP Sending EmailPHP SerializationPHP SessionsPHP SimpleXMLPHP SOAP ClientPHP SOAP ServerPHP SocketsPHP SPL data structuresPHP SQLite3PHP StreamsPHP String formattingPHP String Parsing

PHP Compilation of Errors and Warnings

From WikiOD

Notice: Undefined index[edit | edit source]

Appearance :

Trying to access an array by a key that does not exist in the array

Possible Solution :

Check the availability before accessing it. Use:

  1. isset()
  2. array_key_exists()

Warning: Cannot modify header information - headers already sent[edit | edit source]

Appearance :

Happens when your script tries to send a HTTP header to the client but there already was output before, which resulted in headers to be already sent to the client.

Possible Causes :

Print, echo: Output from print and echo statements will terminate the opportunity to send HTTP headers. The application flow must be restructured to avoid that.

Raw HTML areas: Unparsed HTML sections in a .php file are direct output as well. Script conditions that will trigger a header() call must be noted before any raw blocks.

<!DOCTYPE html>
     // Too late for headers already.

Whitespace before <?php for "script.php line 1" warnings: If the warning refers to output in line 1, then it's mostly leading whitespace, text or HTML before the opening <?php token.

# There's a SINGLE space/newline before <? - Which already seals it.

Reference from SO answer by Mario

Parse error: syntax error, unexpected T_PAAMAYIM_NEKUDOTAYIM[edit | edit source]


"Paamayim Nekudotayim" means "double colon" in Hebrew; thus this error refers to the inappropriate use of the double colon operator (::). The error is typically caused by an attempt to call a static method that is, in fact, not static.

Possible Solution:


If the above code causes this error, you most likely need to simply change the way you call the method:


The latter example assumes that $classname is an instance of a class, and the doMethod() is not a static method of that class.