This is not something you want to leave on, nor make generally available to those arriving at a web site. If you take a look at web logs, you'll see that there are many attempts at looking at this file. The file has very extensive information in it, information which could you used against you as a web site owner.
So use this to see stuff, then take it out. I'd say maybe use .htaccess on it, but that is a bad thing for high usage websites, as .htaccess reduces the performance of the server by requiring the service to perform additional latency inducing disk accesses.
The meat of the article -- into a file called phpinfo.php, put the following line:
<?php phpinfo(); ?>
This provides PHP version information, as well as a listing of modules and other useful information.