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,
- Upload Pdf file using PHP Script
- 403 forbidden error for Image
- Installing vue.js in Laravel 8
- Copy file from one directory to other in Php
- Remove URL Forward Slash Before Single or Double quotes in php.ini
- PHP Script to Upload Images to Server
- PHP Base64 encoding decoding a variable
- Upload docx file using PHP script
- Delete file using PHP code : unlink()
- PHP 301 Redirect Permanently
- PHP Fatal error : Call to a member function bind_param() on a non-object
- Call PHP function on Button click using jquery ajax
- PHP header location function not called
- Failed to load resource: net::ERR_CACHE_MISS PHP
- PHP Code for sending Emails
- How to destroy PHP session()
- PHP drag and drop file upload tutorial using dropzone.js
- PHP Warning: Cannot modify header information - headers already sent
More Posts:
- Create Custom Android AlertDialog - Android
- Copy Text to Android Clipboard Programmatically ClipboardManager - Android
- Facebook Down Will Be Back Soon - Facebook
- How to check installed Eclipse version 32-bit or 64-bit - Eclipse
- How to create an Autocomplete Android EditText Example - Android
- How to display Toast on Button Click : Android - Android
- Two Buttons next to each other in Android Layout - Android
- JSON Datatypes : Tutorial - Json-Tutorial
- Eclipse : Workspace was written with an older version of the product and will be updated - Eclipse
- JavaScript : redirect page to other url - Android
- Android Error Unexpected cast to Button: layout tag was FrameLayout - Android
- [Solved] SharePoint System.IO.FileNotFoundException was unhandled - SharePoint
- Fibonacci series from 1 to 500 table - Html
- The author stylesheet specified in tag script is too long - document contains 21759 bytes whereas the limit is 10000 bytes - Html
- Facebook Graph API Unavailable - Facebook