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:
- Android : Error in http connection java.net.SocketException: Permission denied - Android
- How to create Toast messages in Android - Android
- How to Search Something (string) in Android Studio Project like Eclipse - Android-Studio
- How to detect Browser and Operating System Name and Version using JavaScript - JavaScript
- Free Unlimited Calls from MTNL & BSNL Landlines from 1st May 2015 - HowTos
- Adding internet permission to Android Project - Android
- How to turn off Facebook autoplay videos on timeline - Facebook
- Android : How to make TextView Scrollable - Android
- Sharepoint Server 2016 installation Prerequisites with download links - SharePoint
- How to get current URL Location using Javascript HTML - JavaScript
- Android Toast position top - Android
- How to submit website to dmoz directory - HowTos
- SharePoint Server 2016 setup error - A system restart from a previous installation or update is pending. Restart your computer and run setup to continue. - SharePoint
- Java XML-RPC 3.1.x based web service example - Java
- Plug-in com.android.ide.eclipse.adt was unable to lead class Error - Android