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

DW can't connect to DB, site https/php7.0

New Here ,
Apr 30, 2018 Apr 30, 2018

Copy link to clipboard

Copied

Hi,

until some months ago my 2 sites run on PHP 5.6 and in HTTP environment. I had no issue this time.

Then I migrated to HTTPS (still staying on PHP 5.6) and had the first trouble to connect to the database. I was able to solve that issue by leaving the "_mmServerScripts" folder in HTTP instead of forcing it to HTTPS in my redirect script and setting the site URL back to  http://www.mysite.com instead of https://etc.  in the DW "Manage site" panel.  In that way, both of the 2 sites were able to connect correctly to the MySQL database.

Recently, I got the New Mysqli Server Behavior by Webassist and then made all the necessary changing from MySQL to MySQLi. (in the connections and in all the queries). When I finished I switched on my server from the original PHP 5.6 to PHP 7.0.

It seemed everything was OK, but when I tried to connect to the database I've realized, that DW Mysqli Server Behavior in the new PHP 7.0 environment did not connect anymore.  The connection settings were correct:  if I create a page with a query manually using OOP and the same connection, the page will open fine on a browser, - just the Mysqli Server Behavior panel or DW, does not recognize the connection probably because of some conflicts.

Meantime I got a new domain that is still an HTTP site (not https) but running on PHP 7.0 version. Here, I have no problem to connect to the database.

I have the same results in both of DW CS6 and DW 2018 (here obviously I have selected PHP 7.1)

So, I just can't figure out why DW or Mysqli Server Behavior cannot connect to the database if the site is an HTTPS site and the PHP version is 7.0 (or higher)

Please, can someone help me how to fix that?

Thanks in advance

[Here is the list of all Adobe forums... https://forums.adobe.com/welcome]

[Moved... you do not ask Dreamweaver questions in the Encore forum... Mod]

Views

1.2K

Translate

Translate

Report

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 Expert ,
Apr 30, 2018 Apr 30, 2018

Copy link to clipboard

Copied

Ask your web hosting provider if your database is on HTTP or HTTPS.  If your SSL certificate was installed properly, it should include your database.

Deprecated DW Behaviors will not work with PHP 7 or higher.  If you have the WebAssist extension, you should re-write all your code using that extension.

Nancy O'Shea— Product User, Community Expert & Moderator
Alt-Web Design & Publishing ~ Web : Print : Graphics : Media

Votes

Translate

Translate

Report

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 Expert ,
Apr 30, 2018 Apr 30, 2018

Copy link to clipboard

Copied

There should be no difference to the connection of the database between an HTTP and HTTPS site as long as you use a neutral domain name in line 12.

When I connect to a database using the WebAssist's MySQLi extension, I get similar to the following generated code

<?php

# FileName="WADYN_MYSQLI_CONN.htm"

# Type="MYSQL"

# HTTP="true"

$hostname_mysql = "[localhost]";

$database_mysql = "[my_local_db]";

$username_mysql = "[my_local_un]";

$password_mysql = "[my_local_pw]";

@session_start();

$foundConnection = false;

if ($foundConnection == false) {

  $domains = explode(",","[my_domain_name (e.g. domain.com)]");

  for ($domindex = 0; $domindex<sizeof($domains) && !$foundConnection; $domindex++) {

    $domainCheck = trim($domains[$domindex]);

    if (strpos(strtolower($_SERVER["SERVER_NAME"]),strtolower($domainCheck)) !== false && ($domainCheck == "" || strpos(strtolower($_SERVER["SERVER_NAME"]),strtolower($domainCheck)) == strlen($_SERVER["SERVER_NAME"])-strlen($domainCheck))) {

      $hostname_mysql = "[remotehost]";

      $database_mysql = "[my_remote_db]";

      $username_mysql = "[my_remote_un]";

      $password_mysql = "[my_remote_pw]";

      $foundConnection = true;

    }

  }

}

$mysql = new mysqli($hostname_mysql, $username_mysql, $password_mysql, $database_mysql);

?>

Wappler, the only real Dreamweaver alternative.

Votes

Translate

Translate

Report

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 ,
Apr 30, 2018 Apr 30, 2018

Copy link to clipboard

Copied

Thanks for replying.

As I said above, I migrated to https 3 months ago, and the SSL certificates for both of my sites were installed properly by my hosting service, the 2 sites have been figured since then as "secure" sites and all pages as "secure" pages in every browser.

After that, I have underlined before, that I've bought the New Mysqli Server Behavior created by Webassist, and that I have updated all my pages in both of my 2 sites in mysqli. So, nothing deprecated is there anymore.

In addition, in my new, third site php 7.0 works fine and Mysqli Server Behavior connects properly to my database, with the only difference that this site is still an http site.

And, as I told before, if I make the mysqli connection and any query manually using the object-oriented mysqli, (i'm writing almost every cod about "select" , but not insert or update, here I need that extension) and in this case my pages are going to be displayed correctly even in the 2 https sites running on php 7.0.

Sure, I have also written to my Hosting Company to check this issue but have no answer yet.

Can I ask you if you too use the New Mysqli Server Behavior by Webassist on sites running PHP 7,0 (or higher) with HTTPS  sites and have any issues?

My OS is windows 10.

Votes

Translate

Translate

Report

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 ,
Apr 30, 2018 Apr 30, 2018

Copy link to clipboard

Copied

Yes, that is: in my connection file (same for every site, only the values change) I have this:

# FileName="WADYN_MYSQLI_CONN.htm"

# Type="MYSQL"

# HTTP="true"

$hostname_myConn = "xxx";

$database_myConn = "yyy";

$username_myConn = "aaa";

$password_myConn = "bbb";

@session_start();

$myConn = new mysqli($hostname_myConn, $username_myConn, $password_myConn, $database_myConn);

$myConn->set_charset('utf8');

(my database is on my hosting service)

In addition, in the "_mmServerScripts" folder there is an additional WA file: WA_DBScript.php above the "traditional" DW  files MMHTTPDB.php & mysql.php

And this connection does not work in case of HTTPS sites on PHP 7.0. when I try to make any query with Mysqli Server Behavior, and I get this error message:  "Your PHP server doesn't have the MySql module loaded or can't use the mysql_(p)connect functions."

But, see above, using the same connection and making a query manually, the page is OK in any browser.

Votes

Translate

Translate

Report

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 Expert ,
Apr 30, 2018 Apr 30, 2018

Copy link to clipboard

Copied

my database is on my hosting service

Is that where the problem lies? When you try to connect to the database from a foreign IP address, does the secure layer not say, hang on stranger, what permission have you got to raid my database?

In my view the, the system is working as it should.

Have you had a look at using an SSH Tunnel? For more info, Google the subject.

Wappler, the only real Dreamweaver alternative.

Votes

Translate

Translate

Report

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 Expert ,
Apr 30, 2018 Apr 30, 2018

Copy link to clipboard

Copied

Sorry, I did not see reply #3 until now.

To answer your question, yes I have used the extension on a secure site and yes, it works perfectly. The difference in my case is that I have a local database for testing and my system does not communicate with the remote except for FTP.

Wappler, the only real Dreamweaver alternative.

Votes

Translate

Translate

Report

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 ,
Apr 30, 2018 Apr 30, 2018

Copy link to clipboard

Copied

Thank you. I will check the  SSH Tunnel issue, perhaps because of that.

Votes

Translate

Translate

Report

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 ,
May 01, 2018 May 01, 2018

Copy link to clipboard

Copied

LATEST

Just to let you know, now everything works properly on my sites!  It was not because of SSH Tunnel. 


I do not know exactly what was the real cause of the connection error: before I've always used a full path as Web Directory on the DW Manage site panel. Now I tried to change it to only my site (without www) and now all work fine!

So, I do not know if the error was because of this full path, or because meanwhile, my Hosting Company has fixed this issue.

Anyway, I would like to thank you all for trying to help me.

Votes

Translate

Translate

Report

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 ,
Apr 30, 2018 Apr 30, 2018

Copy link to clipboard

Copied

Thank you very much for your answer!  Yes, it could be, I will go through that stuff tomorrow and will check it.

But, just let me have now a quick thought: if so, why can I connect fine my HTTPS sites if I switch back to PHP 5.6 ?  This SSH Tunnel issue is rising only in PHP 7,0 ?

Votes

Translate

Translate

Report

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