Chaya Cooper
Chaya Cooper

Reputation: 2530

Setting php error reporting in the document instead of php.ini

I'd like to turn on error reporting in the document as opposed to the php.ini file on my hosting company's server. According to the manual these functions set the error_reporting directive at runtime so inserting any of these should work, but I'm just getting a blank page. Any suggestions?

error_reporting(E_ALL);
error_reporting(-1);
ini_set('error_reporting', E_ALL);

Upvotes: 2

Views: 2221

Answers (1)

lupatus
lupatus

Reputation: 4248

First idea is that display_errors is also turned off

error_reporting(E_ALL);
ini_set('display_errors', 1);

Second idea is that you have error in your main script and it is not able to switch those options (for example parse error) - in this case you can try to include that script into another one like below:

<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
include('index.php');

Upvotes: 8

Related Questions