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:
- you login to your web server via FTP client. you are using file zilla for this process.
- Ensure that you are in your correct directory. Otherwise your small problem going to be big problem.
- Click on .php file which you see that already exit.
- 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.
- In this directory you will see a phprc file. Right click on phprc file and choose view or edit.
- After clicking on this file you can see the following lines of code which is open in your default editor.
- 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.
- 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.
- 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
How to create phprc file using SSH:
- Login to your website server via SSH.
- First ensure that you are in correct directory or not. For this type
[server]$ pwd
/home/example_username
- Run the mkdir If you want to create phprc file in 7.2 version then choose 7.2.
[server]$ mkdir -p ~/ .php/7.2
- 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
- In the current folder create the phprc file without extension.
- Run this command for create the phprc file.
[server]$ nano phprc
By using this command your nano text editor will open.
- Now you are going to edit your file using your php customization.
;{{{ this following lines were automatic added by arzhost_extension=opcache.so; }}}
- Now close your file and return to your shell.
- After completing all these steps. you should kill your running php processes. And ensure that your setting is update or not.
- you can see that your error Warning: cannot modify header information – headers already sent by (output started at /public_html…….) will remove.