Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP function or file to run before and after every request

I am wondering if there is a way to specify a php function or file to be called every time a user visits and exits a page on my site. So if a user visits say example.com/ex.php can I have a function called before ex.php is run and after ex.php is finished?

I want to be able to record the time it takes to execute php files on my site and store that so I can run queries later to analyze the info. I would prefer not to have to add code to the beginning and end of every file I want to track.

Thanks in advance.

like image 638
jhchen Avatar asked Dec 21 '09 04:12

jhchen


1 Answers

Try auto Append/prepend file ini directive.

http://php.net/manual/en/ini.core.php

like image 87
Eric Coleman Avatar answered Oct 14 '22 23:10

Eric Coleman