You can ask your web host to that for you. In fact, this is one basic service that most web hosting providers do for its clients – count the number of hits to your PHP site. Otherwise you can do it on your own using a PHP that your site can all. Create a counter.php and a hits.php files in the same folder using this script.
<?php
$fd = fopen( ‘hits.php’, ‘r’ ); // Open the file to read
while( ! feof( $fd ) )
{$tmp = fgets( $fd ); //Get the. number of hits into tmp variable.}
$tmp = $tmp + 1; //Increase count by 1.
fclose( $fd ); //Close file opened for reading.
$fd = fopen( ‘hits.php’, ‘w’ ); //Open the file for writing.
fputs( $fd, $tmp ); //Write the data.
fclose( $fd ); //Close file.
echo “$tmp”;
?>
Then embed this code into your PHP web page.
<?php
include(”counter.php”);
?>