Category: PHP

How to Remove Errors in PHP

Step 1 ) Open PHP.ini file from Wampserver as I opened in my System which is showing in the image below.

Untitled

Step 2 ) Now we need to change error flag in php.ini. For this We have to add “error_reporting : E_ALL & ~E_NOTICE” on line number 104.After that Save the file.

error_reporting : E_ALL & ~E_NOTICE

Step 3 ) Now one more thing to do that we have to add  error_reporting(0); on the top of  Index.php file.After that Save the File & Restart the PHP&Apache Server.

error_reporting(0);

Sample Index.Php file

<?php 
error_reporting(0);
require_once 'Spout/Autoloader/autoload.php';
use Box\Spout\Reader\ReaderFactory;

use Box\Spout\Common\Type;
$file = 'file name';
$reader = ReaderFactory::create(Type::type);
$reader->open($file);
$response = array();
$i =1 ;
$hash = array();
?>

<h3>Raw events for <?php echo $file; ?><h3>
<table>
 <tr>
 <td>#</td>
 <td>Type</td>
 <td>Date Time</td>
 <td width="10%">&nbsp;</td>
 <td>Distance</td>
 <td>Location</td>
<?php
?>
</table>
<?php 
?>

Note – Don’t Forget to Restart  PHP&Apache after all the above step.