PHP help

Eric Thelin plug-discuss@lists.PLUG.phoenix.az.us
Mon, 19 Nov 2001 07:31:31 -0700 (MST)


On Sun, 18 Nov 2001, Trent Shipley wrote:

>
> The University of Arizona doesn't allow system calls or database access from
> PHP.
>
> If you have ideas about how to keep track of the number of times a page is
> served in those circumstances please let me know.

You could build your own file based hit tracker.  To do this safely you
have a few options.  You can use a lock file to keep multiple processes
from simultaneously writing to the hit file.  Or you can open the file
in "a" mode which will always allow you to cleanly append to the file
and just add a line per hit then read the file and count the number of
lines.  Or you could use an offsite hit counter hitbox or the like.

> Also I would like to add a "last updated" PHP field using file stats as
> standard to all the pages.

Take a look at the auto_postpend_file apache level command.  It will
allow you to include a common footer file on each page.

> This is hardly a problem, but the upgrade path is.  Not only do files need to
> be renamed from *.(htm|html) to *.phtml.  All the hyper-refrences of the form
> [*.(htm|html)] | [*.(htm|html)#*] need to be changed to the corresponding
> *.phtml[#*] form, except of course for those few references that don't need
> to be changed.

You also may consider setting up an .htaccess file to tell apache to
parse all .html/.htm files through php in the directory with all of your
scripts.  The php interpreter is very fast and you will see very little
speed degradation to parse everything through php even if it plain html.

Eric

-- 
Eric Thelin                                          erict@aztechbiz.com
           AZtechBiz.com: Where Arizona Does Tech Business