Search code examples
phpapacheincludeserver-side-includes

load a php file at all times on server without manually calling it


Anyone know how i can have a PHP file automatically loaded on the server. I dont know if this is something i can do in .htaccess or how to do it.

Basically i have a php file that i would like to have loaded everytime without actually having it called from any specific file or including it in a specific file.

I have a autoload.php file which contains some functionality and information that every single page needs to have

so instead of doing require or include on every page i would just like to have this file automatically loaded everytime someone visits a site on my page.


Solution

  • You can use htaccess and auto_prepend to include a php file on every access if you haven't got any other kind of framework logic in place to route traffic through the same file on each request.