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:
- How to Convert a Notepad++ file to an Excel File - NotepadPlusPlus
- Clearing the Cache in Firefox Web Browser - HowTos
- How to mute all sounds in Notepad++ - NotepadPlusPlus
- Java Thread.sleep() Method Deep Dive with Examples - Java
- Fix - zsh: command not found: conda [macOS] - zsh
- How to create an Optional from existing Object in Java? - Java
- [macOS] Change homepage Macbook Safari Browser - MacOS
- How to Open Private Browsing (Incognito Mode) in Safari on Mac - MacOS