{"id":2566,"date":"2021-04-05T08:52:55","date_gmt":"2021-04-05T08:52:55","guid":{"rendered":"https:\/\/www.arzhost.com\/?p=1720"},"modified":"2025-09-04T11:10:20","modified_gmt":"2025-09-04T06:10:20","slug":"warning-cannot-modify-header-information","status":"publish","type":"post","link":"https:\/\/arzhost.com\/blogs\/warning-cannot-modify-header-information\/","title":{"rendered":"warning: cannot modify header information"},"content":{"rendered":"<p>When you visit your website sometime you see an error:<strong>\u00a0<\/strong><strong><em><a href=\"https:\/\/www.arzhost.com\/warning-cannot-modify-header-information\/\">Warning: cannot modify header information<\/a>\u00a0 &#8211; headers already sent by (output started at \/public_html\u2026\u2026.)<\/em><\/strong><\/p>\n<p>This error may occur from developer side. Sometimes send the output before calling header or most occur due to whitespaces.<\/p>\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_74 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/arzhost.com\/blogs\/warning-cannot-modify-header-information\/#warning_cannot_modify_header_information\" >warning: cannot modify header information<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/arzhost.com\/blogs\/warning-cannot-modify-header-information\/#How_to_resolve_this_error\" >How to resolve this error:<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/arzhost.com\/blogs\/warning-cannot-modify-header-information\/#How_to_create_a_phprc_file_in_FTP\" >How to create a phprc file in FTP:<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/arzhost.com\/blogs\/warning-cannot-modify-header-information\/#How_to_create_phprc_file_using_SSH\" >How to create phprc file using SSH:<\/a><\/li><\/ul><\/nav><\/div>\n<h2><span class=\"ez-toc-section\" id=\"warning_cannot_modify_header_information\"><\/span>warning: cannot modify header information<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<h2><span class=\"ez-toc-section\" id=\"How_to_resolve_this_error\"><\/span><strong>How to resolve this error:<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>you can resolve this problem by coding. Because this error may occur when you send your code output before the header () function. To avoid this problem you should set your header function before send the code output. To resolve this problem you will hire a developer.<\/p>\n<p>Another method is to resolve this error by creating a phprc file. If you don\u2019t know how to coding then don\u2019t worry about that. you can solve this error within few lines. First of all you should know that how to create phprs file. you can create phprc file by using FTP or SSH.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"How_to_create_a_phprc_file_in_FTP\"><\/span><strong>How to create a phprc file in FTP: <\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<ol>\n<li>you login to your web server via FTP client. you are using file zilla for this process.<\/li>\n<\/ol>\n<p><strong> <img decoding=\"async\" title=\"Email Does Not Allow Relaying\" class=\"size-full wp-image-1721 aligncenter\" src=\"https:\/\/arzhost.com\/inc\/uploads\/2020\/11\/login-file-zilla.png\" alt=\"step 1 login file zilla\" width=\"290\" height=\"121\" \/><\/strong><\/p>\n<ol start=\"2\">\n<li>Ensure that you are in your correct directory. Otherwise your small problem going to be big problem.<\/li>\n<li>Click on .php file which you see that already exit.<\/li>\n<\/ol>\n<p><img decoding=\"async\" title=\"Email Does Not Allow Relaying\" class=\"wp-image-1724 size-full aligncenter\" src=\"https:\/\/arzhost.com\/inc\/uploads\/2020\/11\/php-file.png\" alt=\"step 4 php file\" width=\"377\" height=\"119\" \/><\/p>\n<ol start=\"4\">\n<li>In .php folder you can see that there are several other folders. Which are representing the version of php. For choosing the version from this folder. you should ensure that which version is your site is using. For example your site using 7.4 and you should click on 7.4.<\/li>\n<\/ol>\n<p><img fetchpriority=\"high\" decoding=\"async\" title=\"Email Does Not Allow Relaying\" class=\"size-full wp-image-1723 aligncenter\" src=\"https:\/\/arzhost.com\/inc\/uploads\/2020\/11\/php-versions.png\" alt=\"step 4 php versions\" width=\"429\" height=\"267\" \/><\/p>\n<ol start=\"5\">\n<li>In this directory you will see a phprc file. Right click on phprc file and choose <strong>view or edit.<\/strong><\/li>\n<\/ol>\n<p><img loading=\"lazy\" decoding=\"async\" title=\"edit file 1\" class=\"size-full wp-image-1722 aligncenter\" src=\"https:\/\/arzhost.com\/inc\/uploads\/2020\/11\/edit-file-1.png\" alt=\"step 5 edit file\" width=\"386\" height=\"403\" \/><\/p>\n<ol start=\"6\">\n<li>After clicking on this file you can see the following lines of code which is open in your default editor.<\/li>\n<\/ol>\n<p><img loading=\"lazy\" decoding=\"async\" title=\"How to Install Puppet On Centos 7?\" class=\"size-full wp-image-1725 aligncenter\" src=\"https:\/\/arzhost.com\/inc\/uploads\/2020\/11\/code.png\" alt=\"step 6 code\" width=\"550\" height=\"236\" \/><\/p>\n<ol start=\"7\">\n<li>When you complete your task then you want to save your file then you see a pop up message. Which show that file is change and check box \u2018finish edit and delete local files\u2019. Now click on <strong>yes button<\/strong>.<\/li>\n<\/ol>\n<p><strong> <img loading=\"lazy\" decoding=\"async\" title=\"How to Install Puppet On Centos 7\" class=\"size-full wp-image-1726 aligncenter\" src=\"https:\/\/arzhost.com\/inc\/uploads\/2020\/11\/save-file-1.png\" alt=\"step 7 save file\" width=\"440\" height=\"235\" \/><\/strong><\/p>\n<p>&nbsp;<\/p>\n<ol start=\"8\">\n<li>When you complete these steps then check that any php process is in running form or not. if process is running then kill off all these process. Which are running in php.<\/li>\n<li>When you have to complete all steps and kill the php process. Now confirm that your files our update or not. you can check by using phpinfo.php file.<\/li>\n<\/ol>\n<p>Note: when different php versions are running in your site. E.g. you have four domains first two domains are using 7.3 version of php. Domain using 7.2 and fur using 7.4. And the problem is with 7.2 then you create a phprc file for 7.2.<\/p>\n<p>you can create phprc file using <strong>SSH<\/strong>.<\/p>\n<p>You might be interested in following articles:<\/p>\n<p><a href=\"https:\/\/www.arzhost.com\/how-to-update-php-in-wordpress\/\" rel=\"bookmark\">How To Update Php In WordPress<\/a><\/p>\n<p><a href=\"https:\/\/www.arzhost.com\/php-max-execution-time\/\" rel=\"bookmark\">Php Max_execution_time<\/a><\/p>\n<h2><span class=\"ez-toc-section\" id=\"How_to_create_phprc_file_using_SSH\"><\/span><strong>How to create phprc file using<\/strong> <strong>SSH:<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<ol>\n<li>Login to your website server via SSH.<\/li>\n<li>First ensure that you are in correct directory or not. For this type<\/li>\n<\/ol>\n<p><strong><em>[server]$ pwd<\/em><\/strong><\/p>\n<p><strong><em>\/home\/example_username<\/em><\/strong><\/p>\n<ol start=\"3\">\n<li>Run the<strong> mkdir<\/strong> If you want to create phprc file in 7.2 version then choose 7.2.<\/li>\n<\/ol>\n<p><strong><em>[server]$ mkdir\u00a0 -p ~\/ .php\/7.2<\/em><\/strong><\/p>\n<ol start=\"4\">\n<li>Change your directory into these folders which you create. By using the <strong>cd\u00a0<\/strong>command.<\/li>\n<\/ol>\n<p><strong><em>\u00a0\u00a0\u00a0\u00a0 [server]$ cd .php\/7.2<\/em><\/strong><\/p>\n<p>When you run pwd command. you can see the path of file which you create.<\/p>\n<p><strong><em>[server]$ pwd<\/em><\/strong><\/p>\n<p><strong><em>\/home\/example_username\/.php\/7.2<\/em><\/strong><\/p>\n<ol start=\"5\">\n<li>In the current folder create the phprc file without extension.<\/li>\n<li>Run this command for create the phprc file.<\/li>\n<\/ol>\n<p><strong><em>\u00a0 [server]$ nano phprc<\/em><\/strong><\/p>\n<p>By using this command your nano text editor will open.<\/p>\n<ol start=\"7\">\n<li>Now you are going to edit your file using your php customization.<\/li>\n<\/ol>\n<p><strong><em>;{{{ this following lines were automatic added by arzhost_extension=opcache.so; }}}<\/em><\/strong><\/p>\n<ol start=\"8\">\n<li>Now close your file and return to your shell.<\/li>\n<li>After completing all these steps. you should kill your running php processes. And ensure that your setting is update or not.<\/li>\n<li>you can see that your error <strong><em>Warning: cannot modify header information\u00a0 &#8211; headers already sent by (output started at \/public_html\u2026\u2026.)\u00a0 <\/em><\/strong>will remove.<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>When you visit your website sometime you see an error:\u00a0Warning: cannot modify header information\u00a0 &#8211; headers already sent by (output started at \/public_html\u2026\u2026.) This error may occur from developer side. Sometimes send the output before calling header or most occur due to whitespaces. warning: cannot modify header information How to resolve this error: you can [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":12677,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"table_tags":[],"class_list":["post-2566","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tutorial"],"_links":{"self":[{"href":"https:\/\/arzhost.com\/blogs\/wp-json\/wp\/v2\/posts\/2566","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/arzhost.com\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/arzhost.com\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/arzhost.com\/blogs\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/arzhost.com\/blogs\/wp-json\/wp\/v2\/comments?post=2566"}],"version-history":[{"count":2,"href":"https:\/\/arzhost.com\/blogs\/wp-json\/wp\/v2\/posts\/2566\/revisions"}],"predecessor-version":[{"id":12678,"href":"https:\/\/arzhost.com\/blogs\/wp-json\/wp\/v2\/posts\/2566\/revisions\/12678"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/arzhost.com\/blogs\/wp-json\/wp\/v2\/media\/12677"}],"wp:attachment":[{"href":"https:\/\/arzhost.com\/blogs\/wp-json\/wp\/v2\/media?parent=2566"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/arzhost.com\/blogs\/wp-json\/wp\/v2\/categories?post=2566"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/arzhost.com\/blogs\/wp-json\/wp\/v2\/tags?post=2566"},{"taxonomy":"table_tags","embeddable":true,"href":"https:\/\/arzhost.com\/blogs\/wp-json\/wp\/v2\/table_tags?post=2566"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}