Menu

#1 localhost is hardcoded

open
nobody
None
5
2004-06-11
2004-06-11
No

localhost is hardcoded instead of being parameterised.
Since my database is on a different server from my cgi
pages, I got an error (could not connect to database on
local server, or something like that).

What I did was to edit cgi-bin/shopcms/config.txt and
create a new line at the top:

db_server=mydbhost.mydomain.com

Edit DBI.pm in the cgi-bin/shopcms/Freedom folder.

After the line:-
my $db_username = $config_hash{'db_username'};
add a new line:
my $db_server = $config_hash{'db_server'};

Then change:-
"dbi:$db_driver:database=$db_name;host=localhost;"
to
"dbi:$db_driver:database=$db_name;host=$db_server;"

Then edit htdocs/shopcms/public.php and replace
'localhost' with:
config_one('db_server')
(line 17 I think)

Then search all the files for the work 'localhost' and
replace 'localhost' with
config_one('db_server')
wherever you find it (if you find any - I made so many
other changes I can't remember if there were any other
localhosts).

I hope that helps you.

Brian

Discussion


Log in to post a comment.

MongoDB Logo MongoDB