{"id":418,"date":"2016-04-28T23:27:30","date_gmt":"2016-04-28T23:27:30","guid":{"rendered":"http:\/\/www.homehost.com.br\/blog\/?p=418"},"modified":"2023-06-07T11:34:06","modified_gmt":"2023-06-07T14:34:06","slug":"solucao-para-o-erro-warning-cannot-modify-header-information","status":"publish","type":"post","link":"https:\/\/www.homehost.com.br\/blog\/tutoriais\/php\/solucao-para-o-erro-warning-cannot-modify-header-information\/","title":{"rendered":"Solu\u00e7\u00e3o do erro Warning: Cannot modify header information"},"content":{"rendered":"<p>Mensagem de erro:<\/p>\n<pre class=\"lang:default decode:true \">Warning: Cannot modify header information - headers already sent by (output started at \/home\/usuario\/public_html\/arquivo.php:2) in .... on line 464<\/pre>\n<p>Este <a href=\"https:\/\/www.homehost.com.br\/blog\/tutoriais\/php\/notice-undefined-index-php\/\" >erro ocorre quando voc\u00ea tenta emitir um header de PHP<\/a> depois de ter enviado algum conte\u00fado para o navegador do cliente. Por padr\u00e3o, todos os headers precisam ser enviados <strong>antes\u00a0<\/strong>de qualquer outro conte\u00fado da p\u00e1gina (echo, print, etc..). O que \u00e9 um header? Cookies, vari\u00e1veis de sess\u00e3o, content-type e outros.<\/p>\n<p>Para solucionar o problema, edite seu php.ini e altere a linha:<\/p>\n<pre class=\"lang:default decode:true \">output_buffering = Off<\/pre>\n<p>Para:<\/p>\n<pre class=\"lang:default decode:true \">output_buffering = 4096<\/pre>\n<p>Fazendo esta configura\u00e7\u00e3o, voc\u00ea indica para o PHP que ele dever\u00e1 fazer um buffer de 4096 bytes (4k) antes de processar os headers. Em outras palavras, o PHP ir\u00e1 aguardar 4kbytes de dados antes de processar os headers.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Mensagem de erro: Warning: Cannot modify header information &#8211; headers already sent by (output started at \/home\/usuario\/public_html\/arquivo.php:2) in &#8230;. on line 464 Este erro ocorre quando voc\u00ea tenta emitir um header de PHP depois de ter enviado algum conte\u00fado para o navegador do cliente. Por padr\u00e3o, todos os headers precisam ser enviados antes\u00a0de qualquer outro [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_helpful_status":1,"_lmt_disableupdate":"","_lmt_disable":"","_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[20],"tags":[21],"class_list":["post-418","post","type-post","status-publish","format-standard","hentry","category-php","tag-php"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.6 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Solu\u00e7\u00e3o do erro Warning: Cannot modify header information | Homehost<\/title>\n<meta name=\"description\" content=\"Este erro ocorre quando voc\u00ea tenta emitir um header de PHP depois de ter enviado algum conte\u00fado para o navegador do cliente...\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.homehost.com.br\/blog\/tutoriais\/php\/solucao-para-o-erro-warning-cannot-modify-header-information\/\" \/>\n<meta property=\"og:locale\" content=\"pt_BR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Solu\u00e7\u00e3o do erro Warning: Cannot modify header information | Homehost\" \/>\n<meta property=\"og:description\" content=\"Este erro ocorre quando voc\u00ea tenta emitir um header de PHP depois de ter enviado algum conte\u00fado para o navegador do cliente...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.homehost.com.br\/blog\/tutoriais\/php\/solucao-para-o-erro-warning-cannot-modify-header-information\/\" \/>\n<meta property=\"og:site_name\" content=\"Homehost\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/Homehost\/\" \/>\n<meta property=\"article:published_time\" content=\"2016-04-28T23:27:30+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-06-07T14:34:06+00:00\" \/>\n<meta name=\"author\" content=\"Gustavo Gallas\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@Homehost\" \/>\n<meta name=\"twitter:site\" content=\"@Homehost\" \/>\n<meta name=\"twitter:label1\" content=\"Escrito por\" \/>\n\t<meta name=\"twitter:data1\" content=\"Gustavo Gallas\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. tempo de leitura\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minuto\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.homehost.com.br\/blog\/tutoriais\/php\/solucao-para-o-erro-warning-cannot-modify-header-information\/\",\"url\":\"https:\/\/www.homehost.com.br\/blog\/tutoriais\/php\/solucao-para-o-erro-warning-cannot-modify-header-information\/\",\"name\":\"Solu\u00e7\u00e3o do erro Warning: Cannot modify header information | Homehost\",\"isPartOf\":{\"@id\":\"https:\/\/www.homehost.com.br\/blog\/#website\"},\"datePublished\":\"2016-04-28T23:27:30+00:00\",\"dateModified\":\"2023-06-07T14:34:06+00:00\",\"author\":{\"@id\":\"https:\/\/www.homehost.com.br\/blog\/#\/schema\/person\/df8002f43fc55e7f4e132abb2a6ddbc4\"},\"description\":\"Este erro ocorre quando voc\u00ea tenta emitir um header de PHP depois de ter enviado algum conte\u00fado para o navegador do cliente...\",\"breadcrumb\":{\"@id\":\"https:\/\/www.homehost.com.br\/blog\/tutoriais\/php\/solucao-para-o-erro-warning-cannot-modify-header-information\/#breadcrumb\"},\"inLanguage\":\"pt-BR\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.homehost.com.br\/blog\/tutoriais\/php\/solucao-para-o-erro-warning-cannot-modify-header-information\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.homehost.com.br\/blog\/tutoriais\/php\/solucao-para-o-erro-warning-cannot-modify-header-information\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"In\u00edcio\",\"item\":\"https:\/\/www.homehost.com.br\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Solu\u00e7\u00e3o do erro Warning: Cannot modify header information\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.homehost.com.br\/blog\/#website\",\"url\":\"https:\/\/www.homehost.com.br\/blog\/\",\"name\":\"Homehost\",\"description\":\"Hospedagem De Sites\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.homehost.com.br\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"pt-BR\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.homehost.com.br\/blog\/#\/schema\/person\/df8002f43fc55e7f4e132abb2a6ddbc4\",\"name\":\"Gustavo Gallas\",\"description\":\"Analista de sistemas, formado pela PUC-Rio. Programador, gestor de redes e diretor da empresa Homehost. Pai do B\u00f3ris, seu pet de estima\u00e7\u00e3o. Gosta de rock'n'roll, cerveja artesanal e de escrever sobre assuntos t\u00e9cnicos. Contato: gustavo.blog@homehost.com.br\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Solu\u00e7\u00e3o do erro Warning: Cannot modify header information | Homehost","description":"Este erro ocorre quando voc\u00ea tenta emitir um header de PHP depois de ter enviado algum conte\u00fado para o navegador do cliente...","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.homehost.com.br\/blog\/tutoriais\/php\/solucao-para-o-erro-warning-cannot-modify-header-information\/","og_locale":"pt_BR","og_type":"article","og_title":"Solu\u00e7\u00e3o do erro Warning: Cannot modify header information | Homehost","og_description":"Este erro ocorre quando voc\u00ea tenta emitir um header de PHP depois de ter enviado algum conte\u00fado para o navegador do cliente...","og_url":"https:\/\/www.homehost.com.br\/blog\/tutoriais\/php\/solucao-para-o-erro-warning-cannot-modify-header-information\/","og_site_name":"Homehost","article_publisher":"https:\/\/www.facebook.com\/Homehost\/","article_published_time":"2016-04-28T23:27:30+00:00","article_modified_time":"2023-06-07T14:34:06+00:00","author":"Gustavo Gallas","twitter_card":"summary_large_image","twitter_creator":"@Homehost","twitter_site":"@Homehost","twitter_misc":{"Escrito por":"Gustavo Gallas","Est. tempo de leitura":"1 minuto"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.homehost.com.br\/blog\/tutoriais\/php\/solucao-para-o-erro-warning-cannot-modify-header-information\/","url":"https:\/\/www.homehost.com.br\/blog\/tutoriais\/php\/solucao-para-o-erro-warning-cannot-modify-header-information\/","name":"Solu\u00e7\u00e3o do erro Warning: Cannot modify header information | Homehost","isPartOf":{"@id":"https:\/\/www.homehost.com.br\/blog\/#website"},"datePublished":"2016-04-28T23:27:30+00:00","dateModified":"2023-06-07T14:34:06+00:00","author":{"@id":"https:\/\/www.homehost.com.br\/blog\/#\/schema\/person\/df8002f43fc55e7f4e132abb2a6ddbc4"},"description":"Este erro ocorre quando voc\u00ea tenta emitir um header de PHP depois de ter enviado algum conte\u00fado para o navegador do cliente...","breadcrumb":{"@id":"https:\/\/www.homehost.com.br\/blog\/tutoriais\/php\/solucao-para-o-erro-warning-cannot-modify-header-information\/#breadcrumb"},"inLanguage":"pt-BR","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.homehost.com.br\/blog\/tutoriais\/php\/solucao-para-o-erro-warning-cannot-modify-header-information\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.homehost.com.br\/blog\/tutoriais\/php\/solucao-para-o-erro-warning-cannot-modify-header-information\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"In\u00edcio","item":"https:\/\/www.homehost.com.br\/blog\/"},{"@type":"ListItem","position":2,"name":"Solu\u00e7\u00e3o do erro Warning: Cannot modify header information"}]},{"@type":"WebSite","@id":"https:\/\/www.homehost.com.br\/blog\/#website","url":"https:\/\/www.homehost.com.br\/blog\/","name":"Homehost","description":"Hospedagem De Sites","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.homehost.com.br\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"pt-BR"},{"@type":"Person","@id":"https:\/\/www.homehost.com.br\/blog\/#\/schema\/person\/df8002f43fc55e7f4e132abb2a6ddbc4","name":"Gustavo Gallas","description":"Analista de sistemas, formado pela PUC-Rio. Programador, gestor de redes e diretor da empresa Homehost. Pai do B\u00f3ris, seu pet de estima\u00e7\u00e3o. Gosta de rock'n'roll, cerveja artesanal e de escrever sobre assuntos t\u00e9cnicos. Contato: gustavo.blog@homehost.com.br"}]}},"modified_by":"Gustavo Gallas","jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.homehost.com.br\/blog\/wp-json\/wp\/v2\/posts\/418","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.homehost.com.br\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.homehost.com.br\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.homehost.com.br\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.homehost.com.br\/blog\/wp-json\/wp\/v2\/comments?post=418"}],"version-history":[{"count":6,"href":"https:\/\/www.homehost.com.br\/blog\/wp-json\/wp\/v2\/posts\/418\/revisions"}],"predecessor-version":[{"id":5410,"href":"https:\/\/www.homehost.com.br\/blog\/wp-json\/wp\/v2\/posts\/418\/revisions\/5410"}],"wp:attachment":[{"href":"https:\/\/www.homehost.com.br\/blog\/wp-json\/wp\/v2\/media?parent=418"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.homehost.com.br\/blog\/wp-json\/wp\/v2\/categories?post=418"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.homehost.com.br\/blog\/wp-json\/wp\/v2\/tags?post=418"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}