Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

PHP Dreamweaver and mysql_pconnect, how can i change to mysql_connect

Community Beginner ,
May 07, 2009 May 07, 2009

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.

TOPICS
Server side applications
6.1K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , May 07, 2009 May 07, 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

...
Translate
LEGEND ,
May 07, 2009 May 07, 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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
May 07, 2009 May 07, 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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 07, 2009 May 07, 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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
May 08, 2009 May 08, 2009

thank you

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 12, 2010 Jun 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
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 14, 2010 Jun 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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 21, 2010 Jun 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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 21, 2010 Jun 21, 2010

The simple way is to open the file in your Connections folder, and change mysql_pconnect to mysql_connect. Save the file and upload it to your remote site.

If you want to change the way that Dreamweaver creates the connection file in the first place, follow the instructions I gave to the original poster.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 21, 2010 Jun 21, 2010
LATEST

David_Powers wrote:

The simple way is to open the file in your Connections folder, and change mysql_pconnect to mysql_connect. Save the file and upload it to your remote site.

That is not the issue I am asking about.

David_Powers wrote:

If you want to change the way that Dreamweaver creates the connection file in the first place, follow the instructions I gave to the original poster.

As I mentioned in my original post, I tried modifying the files exactly as you said, but it did not work. I still get the pconnect error.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines