Skip to main content
Participant
May 7, 2009
Answered

PHP Dreamweaver and mysql_pconnect, how can i change to mysql_connect

  • May 7, 2009
  • 2 replies
  • 6155 views

Hello,

i have recently troubleshooted a bug i have had for years. Dreamweaver by default uses mysql_pconnect when connecting to databases and this is considered bad practice for websites, Most servers only have a certain amount of connections and mysql_pconnect uses them all up and freezes all database driven websites... 

You should use mysql_connect and it is very easy to change in the connection code and does not break anything...

The problem i was getting was that on 2 web servers where i have built many many websites using dreamweaver and databases I would occasionally get "too many connections error" when viewing a website, also, my  own personal computer would freeze when viewing these websites because my computer had too many connections open on the same server.

So, is their anything i can change in dreamweaver to make the default  mysql_connect instead on mysql_pconnect

Also, Adobe should pay me for figuring this out.

This topic has been closed for replies.
Correct answer David_Powers

so i open the js file and it was still mysql_connect, so i guess it has to be changed elsewhere

Right. In the same folder, you should find connection_includefile.edml. Open that, and change mysql_pconnect in line 12:

$@@cname@@ = mysql_pconnect($hostname_@@cname@@, $username_@@cname@@, $password_@@cname@@) or trigger_error(mysql_error(),E_USER_ERROR);

I'm thinking this should be an update that adobe should add with new versions of dreamweaver.

File a bug report/feature request: http://www.adobe.com/cfusion/mmform/index.cfm?name=wishform.

2 replies

Participant
June 12, 2010

Hi,

I also have this problem now.

My hosts have pconnect disabled as a security measure so I changed the configuration files as avised above to use mysql_connect instead but when I try and test the connection in dreamweaver I still get this error:

---------------------------

Dreamweaver

---------------------------

Your PHP server doesn't have the MySQL module loaded or you can't use the mysql_(p)connect functions.

---------------------------

OK 

---------------------------

Even though I changed both the references in the config files from pconnect to connect as advised.
I am using Dreamweaver CS5.
Can anyone help please?
Thanks,
Rob
David_Powers
Inspiring
June 14, 2010

The problem has nothing to do with Dreamweaver. As the error message says: "Your PHP server doesn't have the MySQL module loaded".

Run phpinfo(), and check whether mysql is listed. If you're getting that message, it almost certainly means MySQL is not enabled in your PHP configuration. MySQL is not enabled by default in PHP.

Participant
June 21, 2010

As I explained earlier the problem is that my hosts have mysql_(p)connect disabled for security reasons.

mysql is running just fine and I have databases running which I connect to remotely with no problems.

The problem is that dreamweaver uses pconnect to establish its connections and my hosts no not allow this type of connection.

You can see my phpinfo()  at http://teeandtoast.com/test.php and although this says that persistent connection are allowed, I have been assured my my hosts that they have been disabled and that is what is causing the problem.

What I need is an alternative way of connecting dreamweaver to my database - preferably using mysql_connect and not using a persistent connection.

David_Powers
Inspiring
May 7, 2009

So, is their anything i can change in dreamweaver to make the default  mysql_connect instead on mysql_pconnect

Locate the following file: C:\Program Files\Adobe\Adobe Dreamweaver CS4\configuration\Connections\PHP_MySQL\Connection_php_mysql.js. On a Mac, it should be in the same location in the Applications folder.

Line 107 looks like this:

connParams.variables["$" + connParams.cname] = "mysql_pconnect(\"" + connParams.hostname + "\",\"" + connParams.username + "\",\"" + connParams.password + "\")";

Change it to this:

connParams.variables["$" + connParams.cname] = "mysql_connect(\"" + connParams.hostname + "\",\"" + connParams.username + "\",\"" + connParams.password + "\")";

Also, Adobe should pay me for figuring this out.

But you didn't figure out how to do it, though.

Justin_BlAuthor
Participant
May 7, 2009

Hello David,

i changed that file, restart my dreamweaver and then created a new connection.. it defaulted to mysql_pconnect...

so i open the js file and it was still mysql_connect, so i guess it has to be changed elsewhere

It isn't a big deal for me now that i know,  in the short term, i can always open and change my connection file

I'm thinking this should be an update that adobe should add with new versions of dreamweaver. I cant tell you how many hours i wasted over the years because of this, and every time i search all the forums (adobe, apple, experts-exchange) and no one had a clue. There is just no logical reason why dreamweaver uses mysql_pconnect

David_Powers
David_PowersCorrect answer
Inspiring
May 7, 2009

so i open the js file and it was still mysql_connect, so i guess it has to be changed elsewhere

Right. In the same folder, you should find connection_includefile.edml. Open that, and change mysql_pconnect in line 12:

$@@cname@@ = mysql_pconnect($hostname_@@cname@@, $username_@@cname@@, $password_@@cname@@) or trigger_error(mysql_error(),E_USER_ERROR);

I'm thinking this should be an update that adobe should add with new versions of dreamweaver.

File a bug report/feature request: http://www.adobe.com/cfusion/mmform/index.cfm?name=wishform.