Useful Information about PHP

Hi friends, Below things are very useful when we develop websites using php code. We most know about these things.

We must know few things about PHP | Anil Labs

We must know few things about PHP | Anil Labs

1) To check pear package is installed in your server or not.

<?php
require_once 'System.php';
var_dump(class_exists('System'));
?>

Note : It will give information about pear package in our server.
 

When i was working in website, in that website php code is written in a static htm file. For that we just put a one line code in a .htaccess file, it will work.

AddHandler application/x-httpd-php .html .htm

 

3) To display warnings in php file

After hosting files into a new server, it does not give output, it shows empty page, because that files contains warnings. In a server default warnings are disable, to enable those warnings add below code in a starting of php file.

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

 

4) Warning : header already sent or cannot modify header information

This warning mainly occurs when there is white space before the header location or some echo statements before the header location. So better prevent echo and white spaces before the header statement this warning will prevented.

Anil Kumar Panigrahi

With more than 10 years experience in PHP and Founder of Anil Labs, a blog for PHP and related posts. contributed posts regarding CodeIgniter, CakePHP and Learn PHP online ... Contact : [email protected]

You may also like...

3 Responses

  1. John says:

    Nice one

  2. Sangram keshari patra says:

    good one

  3. Nerudo says:

    4) Warning : header already sent or cannot modify header information
    Not only that though. If you echo something before you change header location the issues also arises

Leave a Reply

Your email address will not be published. Required fields are marked *