Reputation: 7053
I have this mark up:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title></title>
</head>
<body>
<?php
ini_set('display_errors', 1);
ini_set('log_errors', 1);
include_once('../API/session_management.php');
//Checking session fixation:
$sess=new session_management();
$sess->set_session_configurations();
$sess->prevent_session_hijacking();
?>
sdfsd
<a href=""></form>
<form>
<input type="text" name="test"/>
</form>
</body>
The problem is that when I run the code, there is an error. A blank page is being printed. No error is displayed. Why is this, and how can I enable errors?
This is the output that I get after and before changing the Display errors to on in php ini and restarting apache:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title></title>
</head>
<body>
Upvotes: 2
Views: 115
Reputation: 164731
The two lines you need are
ini_set('display_errors', 'On');
error_reporting(E_ALL);
It's much better to set these in the php.ini
file for your development environment. This removes non-production code from your project and solves problems like syntax errors causing your ini_set()
and error_reporting()
calls not to be executed (thanks Corbin).
Another suggestion, place your PHP code before any HTML starts (right at the top of the script). It looks like you're dealing with sessions which should be done before anything is added to the output buffer.
Upvotes: 8