I am new to PHP so don't know if there is any alternative to require_once(). My issue is: currently I am including database configuration file on almost each and every file which needs to connect with database using require_once(). I don't want to include my configuration file on each and every file because it may cause some security risk. Any kind of help would be apriciated. Thanks in advance.
1 Answer
You may use the php.ini setting auto_prepend_file to automatically include files when the php process is started.
1 Comment
Sk MiRaj
Thanks, I was just looking for something like this.
require_once()doesn't just display the source code in the browser, as though it were HTML. There is no security risk here, unless youechothe secure data (which only a fool would do).