Basic Configuration

1. Copy all files to your web site.

2. Just execute setup.php from the browser!

3. Now insert the provided monitoring code into your web pages.

The installation script attempts to set permissions for files and directories, in case it could not (depends on your server) you will do it manually:

    666 to the file "config.php"

    777 to the directory "option"

    777 to the directory "browscap"

    666 to file "browscap/browscap.ini"


Finally, use your browser to configure Php-Stats from its Options menu:



PHP-Stats requires a server with PHP v5 and al least mySQL v4.



To upgrade to a newer version must follow the same steps above.

Always execute setup.php, not just copy new files! 


No data will be deleted from the database, you do not lose any existing statistics.

Advanced Configuration 


There are a series of variables not essential to the operation of the script, but useful for those who wish advanced settings.

These options are in the file config.php:


$option[‘prefix’]=’xxx’;                xxx is the prefix for the Php-Stats tables stored into mySQL.

                                        Of course, don’t change it AFTER the installation.

                                        (default = ‘php_stats’)


$option[‘callviaimg’]=X;                1: invokes the script through a transparent image size of 1x1

                                        pixels (default)

                                        0: call the script via JavaScript

                                        Call by image has some advantages in terms of speed (the JS could

                                        cause slowdowns to pages tracking).

                                        If you are going to include the monitoring string between tags

                                        <head> </head> you have to set this parameter to 0.


$option[‘persistent_conn’]=X;           1: uses a persistent connection to mySQL

                                        0: the connection is opened and closed as needed

                                        Recommended the value 0.


$option[‘autorefresh’]=X;               X represents delay in minutes for automatic Php-Stats admin

                                        pages refresh.


$option[‘show_server_details’]=X;       Display server information in the main page.

                                        1: show / 0: don’t show


$option[‘show_average_user’]=X;         Show information about average user in the main page.

                                        1: show / 0: don’t show


$option[‘short_url’]=X;                 Uses shortened URLs when possible on reports.

                                        1: enabled / 0: disabled


$option[‘ext_whois’]=””;                The empty string ("") involves the use of the internal whois script.

                                        If you want to use an external one, input its url (http://www...).

                                        The variable containing the IP must be written as %IP%.



$option[‘online_timeout’]=X;            Set 0 to use the automatic determination for the time a visitor

                                        remain on the site; or enter the number of minutes regarded

                                        as time-out (default: 5 minutes).


$option[‘page_title’]=X;                Storing title of page views.

                                        1: enabled / 0: disabled


$option[‘refresh_page_title’]=X;        0: uses the title already stored previously.

                                        1: stores the current title of the page (updated).


$option[‘log_host’]=X;                  Storing the hostname in the details, otherwise the only IP.

                                        1: enabled / 0: disabled


$option[‘clear_cache’]=X;               Continuous recognition of cached data.

                                        1: enabled / 0: disabled


$option[‘logerrors’]=X;                 Log in the file php-stats.log errors generated from queries

                                        or other major events.

                                        1: enabled / 0: disabled


$option[‘check_new_version’]=X;         Notify availability of a new version of Php-Stats

                                        (via email and message on the admin.php page)

                                        1: enabled / 0: disabled


$option[‘bcap_auto_update’]=X;          Automatic database updates for recognition of the browser,

                                        systems and search engines (Browscap).

                                        NB: it is necessary that your server allows connections


                                        1: enabled / 0: disabled


$option[‘www_trunc’]=X;                 Set 1 to consider ‘http://www.' and ‘http://‘ the same url.

                                        This avoiding double counting in the case of domains that allow

                                        both extensions. Set to 0 otherwise.


$option[‘ip-zone’]=X;                   0: disable recognition of the country by IP address

                                        1: recognition of the country by Database (default)


$option[‘down_mode’]=X;                 0: redirects

                                        1: force download file

                                        2: deprecated, will be removed soon


$option[‘check_links’]=X;               Validate links entered for Click and Download.

                                        1: enabled / 0: disabled


$option[‘link_logger’]=X;               Automatically intercepts all links on page and

                                        records the clicks.

                                        1: enabled / 0: disabled


$option[‘keep_view_mode’]=X;            Retains the last display mode used in the pages of Php-Stats

                                        (for example the choice of showing the URL instead of the title).

                                        1: enabled / 0: disabled


$default_pages=array(…)                 This array contains default pages recognized from your server.

                                        In this way pages as,

                                        or are considered the same page by Php-Stats.