Forum Moderators: coopster

Message Too Old, No Replies

PHP mysql connect

Placement of Mysql_connect

         

Exodus00FF

9:05 pm on May 10, 2007 (gmt 0)

10+ Year Member



Hi all, I'm a first time poster on webmasterworld. I'm new to PHP and getting ready to start my own website. I am encounter an issue which i'm sure you can all help with.

I am hosting my website with bluehost.com and bluehost does not allow you to have access to the folder above the wwwroot. All of the documentation that I have read suggests to place the mysql_connect in that folder. Since I do not have access to it, what should I do to secure my mysql_connect file?

mcibor

9:12 pm on May 10, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi Exodus!

You can place it in the folder e.g. config and restrict access to it via .htaccess
This should do fine for you,
On the other hand I don't know whether users of bluehost.com won't be able to open your file. But I think that should be resolved by provider.

Hope this helps
And welcome to Webmasterworld!
Michal

Exodus00FF

10:29 pm on May 10, 2007 (gmt 0)

10+ Year Member



Thanks for the info, I'm sure I will be posting here quite often. I'm looking forward to php development and this seems like an excellent resource.

eelixduppy

3:47 am on May 11, 2007 (gmt 0)



If you find that .htaccess is not allowed with your provider, then at least make sure that the connect function has a .php extension, otherwise it will be output the the browser as plain text.

If you're completely worried about having other users on a shared host able to access you information, then if your budget allows, go with a dedicated server. You'd be able to put it below the web root then ;)

And yes, Welcome to WebmasterWorld, Exodus00FF! :)

coopster

1:01 pm on May 11, 2007 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Here is an old Apache thread that shows how you might accomplish this with .htaccess:

[webmasterworld.com...]

Although it is not ideal as your host doesn't allow you to store files outside your document root, it does indeed work.