Skip to main content
Inspiring
October 13, 2008
Question

PHP connections file comments ignored

  • October 13, 2008
  • 4 replies
  • 334 views
I am trying to use the same connection file for local and remote application access to MySQL db. I try to comment out the settings I don't want to use; the server and user names are different between the remote and local sites. But CS3 seems to ignore the fact that some code is commented - if I look at the settings for a db in the panel, it shows whichever group of settings are set first. Here's an example:

<?php
# FileName="Connection_php_mysql.htm"
# Type="MYSQL"
# HTTP="true"

# set for localhost
#$hostname_example_conn = "localhost";
#$username_example_conn = "local user name";
#$password_example_conn = "local password";

# set for remote
$hostname_example_conn = "remoteserver.secureserver.net";
$username_example_conn = "remote user name";
$password_example_conn = "remote password";

$database_example_conn = "exampleDB";

$example_conn_dc = mysql_pconnect($hostname_example_conn_dc, $username_example_conn_dc, $password_example_conn_dc) or trigger_error(mysql_error(),E_USER_ERROR);
?>

The commented code shows up as such (i.e., orange) in code view, but if I double click the db in the CS3 panel, it will show the settings for the localhost entry, not the remote ones as I'd expect. If I upload this to the remote server, it seems to work.

Am I missing something here?
This topic has been closed for replies.

4 replies

antares5Author
Inspiring
October 14, 2008
Of course, you are correct. And I tried it just to verify - once DW kicks off a browser, it fails. So just a plain old bug with no redeeming value...
Inspiring
October 13, 2008
antares5 wrote:
> actually, the way it seems to be working allows for a creative solution;
> running a local testing server ignores the commented code, whereas commercial
> PHP servers don't, so if one puts the commented code for the localserver first,
> CS3 uses that info and ignores uncommented settings for the remote server that
> follow.

That might work inside Dreamweaver, but it shouldn't work when you load
the site into a browser in your local test environment. Lines that are
commented out will be ignored by any server.

--
David Powers, Adobe Community Expert
Author, "The Essential Guide to Dreamweaver CS3" (friends of ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/
antares5Author
Inspiring
October 13, 2008
actually, the way it seems to be working allows for a creative solution; running a local testing server ignores the commented code, whereas commercial PHP servers don't, so if one puts the commented code for the localserver first, CS3 uses that info and ignores uncommented settings for the remote server that follow. Conversely, the remote server ignores the commented settings for the local server and uses the remote settings. So the same file works unchanged. Haven't tested this yet, and it's not pretty, but interesting...
Inspiring
October 13, 2008
antares5 wrote:
> The commented code shows up as such (i.e., orange) in code view, but if I
> double click the db in the CS3 panel, it will show the settings for the
> localhost entry, not the remote ones as I'd expect. If I upload this to the
> remote server, it seems to work.

I haven't tested that myself, but if that's happening, it's a bug. You
should report it here:

http://www.adobe.com/cfusion/mmform/index.cfm?name=wishform

The normal way to handle this situation is to create different versions
of the connection file. Upload the remote one to your remote server.
Then create the local one.

The ability for Dreamweaver to support different settings for local and
remote connection files is something that has been frequently requested.
Unfortunately, it hasn't been implemented yet.

--
David Powers, Adobe Community Expert
Author, "The Essential Guide to Dreamweaver CS3" (friends of ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/