Skip to main content
nick49v
Participating Frequently
April 30, 2018
Question

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

  • April 30, 2018
  • 2 replies
  • 1462 views

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]

This topic has been closed for replies.

2 replies

BenPleysier
Community Expert
Community Expert
April 30, 2018

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 is the DMXzone-made Dreamweaver replacement and includes the best of their powerful extensions, as well as much more!
nick49v
nick49vAuthor
Participating Frequently
May 1, 2018

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.

Nancy OShea
Community Expert
Community Expert
April 30, 2018

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