Yeak
Yeak

Reputation: 2538

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.

Upvotes: 0

Views: 122

Answers (2)

xelber
xelber

Reputation: 4637

Why not use include_path directive in PHP?

Upvotes: 0

MyStream
MyStream

Reputation: 2553

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.

Upvotes: 2

Related Questions