warning: cannot modify header information

warning: cannot modify header information

When you visit your website sometime you see an error: Warning: cannot modify header information  – headers already sent by (output started at /public_html…….)

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 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.

Another method is to resolve this error by creating a phprc file. If you don’t know how to coding then don’t 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.

How to create a phprc file in FTP:

  1. you login to your web server via FTP client. you are using file zilla for this process.

step 1 login file zilla

  1. Ensure that you are in your correct directory. Otherwise your small problem going to be big problem.
  2. Click on .php file which you see that already exit.

step 4 php file

  1. 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.

step 4 php versions

  1. In this directory you will see a phprc file. Right click on phprc file and choose view or edit.

step 5 edit file

  1. After clicking on this file you can see the following lines of code which is open in your default editor.

step 6 code

  1. 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 ‘finish edit and delete local files’. Now click on yes button.

step 7 save file

 

  1. 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.
  2. 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.

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.

you can create phprc file using SSH.

You might be interested in following articles:

How To Update Php In WordPress

Php Max_execution_time

How to create phprc file using SSH:

  1. Login to your website server via SSH.
  2. First ensure that you are in correct directory or not. For this type

[server]$ pwd

/home/example_username

  1. Run the mkdir If you want to create phprc file in 7.2 version then choose 7.2.

[server]$ mkdir  -p ~/ .php/7.2

  1. Change your directory into these folders which you create. By using the cd command.

     [server]$ cd .php/7.2

When you run pwd command. you can see the path of file which you create.

[server]$ pwd

/home/example_username/.php/7.2

  1. In the current folder create the phprc file without extension.
  2. Run this command for create the phprc file.

  [server]$ nano phprc

By using this command your nano text editor will open.

  1. Now you are going to edit your file using your php customization.

;{{{ this following lines were automatic added by arzhost_extension=opcache.so; }}}

  1. Now close your file and return to your shell.
  2. After completing all these steps. you should kill your running php processes. And ensure that your setting is update or not.
  3. you can see that your error Warning: cannot modify header information  – headers already sent by (output started at /public_html…….)  will remove.
90%OFF

Smart Sale

Hurry Up! Offer ends in
days 00 01 hrs 06 07 mins 30 31 secs 18 19
Buy Now
We are offering a Discount Promotion on All VPS. you can get upto 75% DiscountBuy Now
+ +