There are 2 basic ways of doing this.
1: Create a file that you read at the beginning of every page and then re-write. The file will hold only a number that you will increment in your code.
2: Use a database table that holds 1 row with 1 column that is the number, and select and update this at the beginning of each of your pages.
Problems:
1: You are accessing a file on your disk, so you are going to have locking issues if multiple people hit your page at the same time.
2: You need a database, and depending on the database that you are using you can also have locking issues, but they won't be as difficult to deal with.
I'm sure there are more ways to do this, but these two are very easy.