pues estoy haciendo solo un ejemplo de autentificacion por http con php, y para ello tomo el ejemplo de el manual de php.
Código PHP:
<?php
if (!isset($_SERVER['PHP_AUTH_USER'])) {
header('WWW-Authenticate: Basic realm="My Realm"');
header('HTTP/1.0 401 Unauthorized');
echo 'Text to send if user hits Cancel button';
exit;
} else {
echo "<p>Hello {$_SERVER['PHP_AUTH_USER']}.</p>";
echo "<p>You entered {$_SERVER['PHP_AUTH_PW']} as your password.</p>";
}
?>
y me genera un error :
Warning: Cannot modify header information - headers already sent by (output started at C:\AppServ\www\Practicas\Ejemplos_Ejecucion.php:2) in C:\AppServ\www\Practicas\Ejemplos_Ejecucion.php on line 19
Warning: Cannot modify header information - headers already sent by (output started at C:\AppServ\www\Practicas\Ejemplos_Ejecucion.php:2) in C:\AppServ\www\Practicas\Ejemplos_Ejecucion.php on line 20
Alguien me puede decir donde esta el error ?
Código:
Uso las versiones PHP Version 5.2.1 y apache 2.2