note 82959 added to function.mysql-connect

From: Date: Sat, 03 May 2008 16:17:03 +0000
Subject: note 82959 added to function.mysql-connect
Groups: php.notes 
Request: Send a blank email to php-notes+get-139027@lists.php.net to get a copy of this message
Hiding the MySQL password is a big deal on multi-user machines. With Lighttpd you can store the passwords in the server-config and make that file readable by root only. This is the way (make sure you enable mod_setenv): # Security through setenv $HTTP["url"] =~ "^/~user/base-dir/" { setenv.add-environment = ( "MYSQL_USERNAME" => "username", "MYSQL_PASSWORD" => "password" ) } Your PHP file should then read the username/password as follows: <?php $username = getenv('MYSQL_USERNAME'); $password = getenv('MYSQL_PASSWORD'); ?> Mind that additional 'false-checking' is good practice. ---- Server IP: 83.137.20.135 Probable Submitter: 81.171.12.201 ---- Manual Page -- http://www.php.net/manual/en/function.mysql-connect.php Edit -- https://master.php.net/note/edit/82959 Del: integrated -- https://master.php.net/note/delete/82959/integrated Del: useless -- https://master.php.net/note/delete/82959/useless Del: bad code -- https://master.php.net/note/delete/82959/bad+code Del: spam -- https://master.php.net/note/delete/82959/spam Del: non-english -- https://master.php.net/note/delete/82959/non-english Del: in docs -- https://master.php.net/note/delete/82959/in+docs Del: other reasons-- https://master.php.net/note/delete/82959 Reject -- https://master.php.net/note/reject/82959 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#139027) next »