Where To Store The Connection File

 
Post new topic   Reply to topic    34SP.com Forum Index // Database Support
View previous topic :: View next topic  
Author Message
HorseyGilly
34SP Newbie
34SP Newbie


Joined: 05 Nov 2010
Posts: 1

PostPosted: Fri Nov 05, 2010 8:44 pm    Post subject: Where To Store The Connection File Reply with quote
HI I wonder if some one could advice me where it is best to store the connection file?
Back to top
View user's profile Send private message
philr
Super Member
Super Member


Joined: 05 Nov 2003
Posts: 990
Location: Exeter

PostPosted: Sun Nov 07, 2010 2:03 pm    Post subject: Reply with quote
If you're using PHP, then I don't think you have much choice but to place your MySQL connection script inside your httpdocs folder somewhere. However, if you're using PHP-FCGI then you can set the permissions on this file to 0400 to prevent anyone else from accessing it. This is the most secure approach.

Alternatively, if you're using mod_php then your PHP files have to be readable by Apache. You can create a file owned by Apache with permissions set to 0400 by using a combination of PHP's fwrite() and chmod() functions. If you like, you can also move the login details to your .htaccess file by declaring them as environment variables, e.g.:
Code:
SetEnv MYSQL_USER username
SetEnv MYSQL_PASS abracadabra

This information will then appear in the $_SERVER globals array (i.e., $_SERVER['MYSQL_USER'] and $_SERVER['MYSQL_PASS']).
_________________
Phil Ronan
フィリップ・ローナン
Back to top
View user's profile Send private message Visit poster's website
Post new topic   Reply to topic    34SP.com Forum Index // Database Support All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Powered by phpBB © 2001, 2002 phpBB Group