How to fix "Headers already sent" error in PHP: causes and solutions
Hello everyone! I'm a beginner in PHP and I've encountered a problem that's driving me crazy. I'm writing a simple script for redirect after login, but I get an error:
```
Warning: Cannot modify header information - headers already sent by (output started at /var/www/test.php:10)
```
Here's my code:
```php
```
I understand that the error is related to headers already being sent, but why does this happen? After all, I call header() after echo. How to properly do redirects and work with sessions without this error?
No answers yet.
Log in to leave an answer