php - How to safeguard my mysql_connect password (My database server's password)? -


*this question non-local host's. *i using web-host service. not personal server.

to use mysql_connect, connect database's server, 1 needs create php file , save in web host's server. file must have (within code) server's address user name , password:

**$conn = mysql_connect("server", "username", password);** 

anyone view's page's code , downloads php file can see password, security risk.

how can safeguard database' server' password?

you don't have options protecting database password. should make sure user/password combination have access parts of database necessary make web application run. in other words, don't make root password. if have other databases not used web application, should have different login credentials.

unless web server misconfigured, not possible download php file view code. should also, if possible, place file containing login credentials outside web server's document root , include() it, lessening chance accidentally exposed misconfigured web server.

this question of trusting system administrators of hosting company.

if search around, may find examples of attempts store encrypted credentials on server , retrieve them @ runtime via encrypted connection, still keys decrypt information need held on web server , therefore accessible system administrators.

if web host makes files available other clients/customers rather partitioning them they're available you, should find new host immediately.


Comments

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -