/    Sign up×
Community /Pin to ProfileBookmark

Config and DB classes

This is probably a pretty basic question. but I have a config file and database class that I would like to load on the first page that the user goes to.

ie: they open browser and go to somesite.com/subdirectory/somepage.php
or they could go to somesite.com/second_subdirectory/anotherpage.php
or they could go to somesite.com for that matter.

is there anyway to require these two files without putting require_once on every page of my website?

Thanks

to post a comment
PHP

1 Comments(s)

Copy linkTweet thisAlerts:
@NogDogJul 26.2008 — If you are running under Apache and can use .htaccess files, you can set an [url=http://www.php.net/manual/en/ini.core.php#ini.auto-prepend-file]auto_prepend_file[/url] to automatically run a script, then have that script do the includes for you.
<i>
</i>php_value auto_prepend_file "/home/youraccount/includes/config.php"
×

Success!

Help @bpdp spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...