There can be various reasons why Header location function is not executed when called from a php file. Here is a check-list to solve such a issue when encountered.
1. Check that there are no print,echo\'s outputs before the header is being called.
2. There should be no white spaces before <?php and after ?>.
3. Check for UTF-8 BOM(Byte-Order-Mark)
4. There should be no error messages before the header call.
5. If there are include functions calling other php files before header call,
check all above steps(about points 1 to 4) for these files.
⚠️ If still the error is not resolved, one of the solution is to enclose you php file with ob_start() and ob_end_flush().
Example:
<?php
ob_start();
// your code goes in here
ob_end_flush();
?>
More Posts related to PHP,
- Delete file using PHP code : unlink()
- PHP header location function not called
- 403 forbidden error for Image
- Call PHP function on Button click using jquery ajax
- How to Pretty Print JSON in PHP
- Step-by-Step Guide: How to Fix - Error Establishing a Database Connection in WordPress
- PHP Base64 encoding decoding a variable
- PHP Fatal error : Call to a member function bind_param() on a non-object
- PHP.ini: How to Remove URL Forward Slash Before Single or Double Quotes
- PHP drag and drop file upload tutorial using dropzone.js
- Upload Pdf file using PHP Script
- PHP Warning: Cannot modify header information - headers already sent
- macOS - cannot calculate MAC address: Using fd 9 hv_vm_create HV_ERROR [PHP XAMPP]
- PHP Code for sending Emails
- How to destroy PHP session()
- Installing vue.js in Laravel 8
- PHP 301 Redirect Permanently
- Upload docx file using PHP script
- Save current timestamp in MySQL using PHP mysqi binding
- Copy file from one directory to other in Php
- Failed to load resource: net::ERR_CACHE_MISS PHP
- PHP Script to Upload Images to Server
More Posts:
- What are the 8 Primitive Data Types in Java - Java
- How to Download and Install Android adb Tool on Linux, Mac or Windows - Android
- 32: Python Program to Find Square Root of a Number - Python-Programs
- How to know the current shell you are logged in? - Bash
- [Fix] Microsoft Remote Desktop Error Code: 0x204 - Microsoft
- How to Get the Day Name From Date In Java - Java
- How to disable warnings while Python file execution - Python
- Fix: Mac Preview App Tools Crop option disabled - MacOS