Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

namespace not working php

Do you have ANY whitespace before the namespace? The namespace must occur before any output. This includes HTML to the browser. This also includes a UTF-8 Byte Order Mark (BOM) which can creep in from certain editors.

Try opening the file in an editor such as vi on Linux and it should show you if there's a BOM at the beginning.

Check How to fix "Headers already sent" error in PHP for information about other ways that output can start in a file.

URL : https://stackoverflow.com/questions/8028957/how-to-fix-headers-already-sent-error-in-php

1
This happens when you have a file with a UTF-8 BOM as first character and you should remove all whitespaces before the start tag.

A re-install of the DSM (Synology OS) actually resolved the issue. Once done, some of the classes obtained from other frameworks had the "BOM" bytes at the beginning of the file, but not all. Simple solution to the BOM issues is to add a "BOM" remover into the auto-loader.
 
PREVIOUS NEXT
Tagged: #namespace #working #php
ADD COMMENT
Topic
Name
1+8 =