mysql - How to properly store global variables for php server code -


i writing php scripts server code. these include sign up, log in, , similiar functions. these functions reference same database , urls. have been reading on stackoverflow , google user of global php file , using simple include bad idea. seen below:

global.php

<?php   $databasehost = "someurl.com";   $databaseuser = "adminuser";   $databasepassword = "adminuserspassword";   $databasename = "dbname"; ?> 

serverfile.php

<?php   include 'global.php';    //mysql functions use variables below    $databasehost;   $databaseuser;   $databasepassword;   $databasename; ?> 

can explain me safest way such includes or better write information directly every server php file? seems hard keep updated if change / update our database or change our server host.

if explain why recommend recommend appreciated. have understanding of other programming languages , hardware (i'm computer engineer), in depth explanations welcome.

sorry not having exact problem, lost on how best approach this. in advance stackoverflow knowledge.

this fine. thing should put file outside of web root (public_html). way can't accessed directly, instead can accessed code.


Comments

Popular posts from this blog

javascript - AngularJS custom datepicker directive -

javascript - jQuery date picker - Disable dates after the selection from the first date picker -