mySQL PDOException:...
Hi,
I just wanted to let everyone know of that if you are receiving this error:
SQLSTATE[HY000][2013] Lost connection to MySQL server at
This is how I fixed it.
This means your database at your host is somewhere other than localhost/127.0.0.1
In my case MediaTemple does not use that convention to connect to their GridServer databases, the database is at: internal-db.sXXXXX.gridserver.com
I'm not sure how many other hosting providers use this convention for their databases but MediaTemple does.
The fix:
So even though I entered the correct server address in Web Form Builder:
internal-db.sXXXXX.gridserver.com
I was still getting the connection error above. I then started to dig in to the code to see whats going on.
I'm using the latest version v2.3 Build 5196 and it was the first time I used the Payment Option with PayPal and noticed that it created a new folder I haven't seen in the exported files 'cartapp_v1'
In that folder I located the file: database_mysql.cls.php which is in the phphosted folder.
In the constructor I noticed this line of code:
parent::__construct( 'mysql:host=127.0.0.1;dbname=' . $cfg->database, $cfg->username, $cfg->password, $options );
You'll notice the mysql:host has localhost/127.0.0.1 is hardcoded, when I changed it to:
parent::__construct( 'mysql:host=internal-db.sXXXXX.gridserver.com;dbname=' . $cfg->database, $cfg->username, $cfg->password, $options );
Which is the location to my MediaTemple mySQL database it worked right away.
So my question is did I not configure something correctly on the 'Saving Data' tab in the settings (i'm sure I did because I filled in all of the fields) or is this a bug?
Thanks.
I just wanted to let everyone know of that if you are receiving this error:
SQLSTATE[HY000][2013] Lost connection to MySQL server at
This is how I fixed it.
This means your database at your host is somewhere other than localhost/127.0.0.1
In my case MediaTemple does not use that convention to connect to their GridServer databases, the database is at: internal-db.sXXXXX.gridserver.com
I'm not sure how many other hosting providers use this convention for their databases but MediaTemple does.
The fix:
So even though I entered the correct server address in Web Form Builder:
internal-db.sXXXXX.gridserver.com
I was still getting the connection error above. I then started to dig in to the code to see whats going on.
I'm using the latest version v2.3 Build 5196 and it was the first time I used the Payment Option with PayPal and noticed that it created a new folder I haven't seen in the exported files 'cartapp_v1'
In that folder I located the file: database_mysql.cls.php which is in the phphosted folder.
In the constructor I noticed this line of code:
parent::__construct( 'mysql:host=127.0.0.1;dbname=' . $cfg->database, $cfg->username, $cfg->password, $options );
You'll notice the mysql:host has localhost/127.0.0.1 is hardcoded, when I changed it to:
parent::__construct( 'mysql:host=internal-db.sXXXXX.gridserver.com;dbname=' . $cfg->database, $cfg->username, $cfg->password, $options );
Which is the location to my MediaTemple mySQL database it worked right away.
So my question is did I not configure something correctly on the 'Saving Data' tab in the settings (i'm sure I did because I filled in all of the fields) or is this a bug?
Thanks.
Are you sure you saved the form and exported and published? Seems strange that it would change what you actually entered in the settings. I would try another test form and if it still does this open a support topic.

I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.
This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com
It's easy to overlook something you're not looking for.
This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com
Hi Eric,
I'll try again but take note of the line of code in the actual .php class file:
In the constructor I noticed this line of code:
parent::__construct( 'mysql:host=127.0.0.1;dbname=' . $cfg->database, $cfg->username, $cfg->password, $options );
If you notice all other parts of the database connection have a variable representing the values you would enter in the 'Saving Data' Tab of the settings but the database host parameter has localhost/127.0.0.1 hardcoded, I have not found another piece of code anywhere that would alter that argument.
I'll try again but take note of the line of code in the actual .php class file:
In the constructor I noticed this line of code:
parent::__construct( 'mysql:host=127.0.0.1;dbname=' . $cfg->database, $cfg->username, $cfg->password, $options );
If you notice all other parts of the database connection have a variable representing the values you would enter in the 'Saving Data' Tab of the settings but the database host parameter has localhost/127.0.0.1 hardcoded, I have not found another piece of code anywhere that would alter that argument.
Confirmed Eric. I am running version 2.4 Build 5318 and I had to change that hardcoded value in the "database_mysql.cls.php" line # 49 to my sql host of "xxxxxxxx.mysql.guardedhost.com" and now the form is redirecting to Paypal for my client to make their payment.
-Tom McEachren
-Tom McEachren
Using 2.4 Build 5318, I can confirm the same issue. Can also state that using the manual export as is produces a multitude of errors due to incorrect paths, and other small idiosyncrasies that require manually altering quite a few files. I had to change the following files to point to the correct paths: header and body files of manual export (paths to css and js files were incorrect by a lot); database_mysql.cls.php; .htaccess (all in storage); form.cfg.php; user.cfg.php; and I'm still not receiving email notification and have to check into that (already made the godaddy fix). I thought this would be a timesaver, but it's turning out to be much longer than hand coding.
I have made more then a 100 forms. I have never had an error on any in the php or mysql that wasn't a server issue.
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.
This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com
It's easy to overlook something you're not looking for.
This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com
I manually export and upload all the time with no problem whatsoever. I use GoDaddy and have for many years. Where are you trying to 'manually export' to? Somewhere on your hard drive? Then, when you upload, make sure you do not upload the ' _exported' folder. You upload only the files and folders contained within that folder, and they have to be uploaded to the server in the same directory where the form is located. Usually the root. I've never had to modify files, never received any errors.
Can you explain exactly what you are doing, and provide a link to your form?
Can you explain exactly what you are doing, and provide a link to your form?
Graphics for the web, email, blogs and more!
-------------------------------------
https://sadduck.com
-------------------------------------
https://sadduck.com
Normally, in all the 3rd party web software I've used, the export process is to the folder on the website that will be uploaded to the server. In this case, if I understand correctly, I export the form to a neutral spot, then move the folders inside the *_exported folder to the folder that is to be uploaded. If this is correct, I'm not sure why the extra step, but I have to start over on this form so I'll try it that way unless I hear otherwise that I've misunderstood.
I'm curious as to why the extra step...
Thanks for your help.
I'm curious as to why the extra step...
Thanks for your help.
Just to be clear, when you create a form in WFB, and export for 'manual' upload, the form files are saved on your hard disk in a folder called 'yourformname_exported'. yourformname being the name of your form. Do not upload that folder! Upload the files and folders contained within that folder to your server to the directory where the page that contains your form is located. All will be well.
Graphics for the web, email, blogs and more!
-------------------------------------
https://sadduck.com
-------------------------------------
https://sadduck.com
You can also do this. You can change the name of the folder.
Eric Rohloff wrote:
I like to alter the iframe code by adding myformname/ and remove the _exported from the file name.
This keeps all of my form files in their separate folders.
I like to alter the iframe code by adding myformname/ and remove the _exported from the file name.

I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.
This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com
It's easy to overlook something you're not looking for.
This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com
Have something to add? We’d love to hear it!
You must have an account to participate. Please Sign In Here, then join the conversation.