Ecommerce software home
Shopping Cart Software Forum for Ecommerce Templates
 
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?


Find us on Facebook Follow us on Twitter View our YouTube channel
Search our site

 All Forums
 General
 Off topic, News and Updates
 PHP 7
 New Topic  Reply to Topic
 Printer Friendly
Author  Topic   

Andy
ECT Moderator

95440 Posts

Posted - 05/27/2017 :  03:01:47  
Hi

We've seen a few people switching to PHP 7 recently and that's good as it is supported by ECT from version 6.6 and 7.1 from ECT v6.7. A couple of people have reported problems and generally this is down to the syntax in includes.php and db_conn_open.php

In vsadmin/includes.php if the first line shows as <SCRIPT language="php"> change the line from

<SCRIPT language="php">

to

<?php

and the last line from

</SCRIPT>

to

?>

.and then make sure you db_conn_open.php is in this format but with your database details

<?php

// You host should be able to provide you with these settings if you do not know them already

$db_username = ""; // Your database login username
$db_password = ""; // Your database login password
$db_name = ""; // The name of the database you wish to use
$db_host = "localhost"; // The address of the database. Often this is localhost, but may be for example db.yoursite.com

//////////////////////////////////////////////////
// Please do not edit anything below this line. //
//////////////////////////////////////////////////

$GLOBALS['ectdatabase'] = new mysqli($db_host, $db_username, $db_password, $db_name);
if(mysqli_connect_error()){
ob_clean();
print '<html><head><title>Database connect error</title></head><body><div style="margin:20px;clear:both">Database Connect Error (' . mysqli_connect_errno() . ') ' . mysqli_connect_error() . '</div>';
print('<div style="margin:20px;clear:both">You need to set your database connection in vsadmin/db_conn_open.php</div>');
print '<div style="margin:20px;clear:both">For help setting your database connection please see...<br />';
print '<a href="http://www.ecommercetemplates.com/phphelp/ecommplus/instructions.asp#dbconn" target="_blank">http://www.ecommercetemplates.com/phphelp/ecommplus/instructions.asp#dbconn</a></div>';
print '<div style="margin:20px;clear:both">We also have a support forum here...<br />';
print '<a href="http://www.ecommercetemplates.com/support/" target="_blank">http://www.ecommercetemplates.com/support/</a></div>';
die('</body></html>');
}
?>

Andy

Please feel free to review / rate our software

DTPwarrior
Advanced Member

USA
298 Posts

Pre-sales questions only
(More Details...)

Posted - 02/27/2018 :  07:52:56  

Andy,
Should the db_conn_open.php file begin and end the same as the includes.php file as you cited in a previous comment? e.g.:

<SCRIPT language="php">

to

<?php

and the last line from

</SCRIPT>

to

?>


Doug
[url]http://www.paintandpowderstore.com[/url]

Andy
ECT Moderator

95440 Posts

Posted - 02/27/2018 :  07:55:13  
Hi Doug

Yes, that right, both should be

<?php

...
...
...

?>

Andy

Please feel free to review / rate our software

DTPwarrior
Advanced Member

USA
298 Posts

Pre-sales questions only
(More Details...)

Posted - 02/27/2018 :  09:02:45  

Hi Andy,
I changed the first and last lines as suggested in both includes.php and db_conn_open.php files in both vsadmin and security vsadmin.
When I switched to PHP 7.1 at my hosting control panel, I got the following error when attempting to go to my cart page:

Fatal error: Uncaught Error: Call to undefined function mysql_connect() in /home/pro/www/www/vsadmin/db_conn_open.php:14 Stack trace: #0 /home/pro/www/www/cart.php(55): include() #1 {main} thrown in /home/pro/www/www/vsadmin/db_conn_open.php on line 14

The db_conn_open.php file is pasted below (with password changed to x's):

<?php

// You host should be able to provide you with these settings if you do not know them already

$db_username = "ecommerce"; // Your database login username
$db_password = "xxxxxxxxx"; // Your database login password
$db_name = "pro_cosmetics"; // The name of the database you wish to use
$db_host = "localhost:/tmp/mysql5.sock"; // The address of the database. Often this is localhost, but may be for example db.yoursite.com

//////////////////////////////////////////////////
// Please do not edit anything below this line. //
//////////////////////////////////////////////////

$dbh=mysql_connect($db_host, $db_username, $db_password) or die ('You need to set your database connection in vsadmin/db_conn_open.php.</td></tr></table></body></html>');
mysql_select_db($db_name) or die ('You need to set your database connection in vsadmin/db_conn_open.php.</td></tr></table></body></html>');

?>

End of paste. What is causing this error?

Doug


Doug
[url]http://www.paintandpowderstore.com[/url]

Andy
ECT Moderator

95440 Posts

Posted - 02/27/2018 :  09:07:52  
That should be

<?php

// You host should be able to provide you with these settings if you do not know them already

$db_username = ""; // Your database login username
$db_password = ""; // Your database login password
$db_name = ""; // The name of the database you wish to use
$db_host = "localhost"; // The address of the database. Often this is localhost, but may be for example db.yoursite.com

//////////////////////////////////////////////////
// Please do not edit anything below this line. //
//////////////////////////////////////////////////

$GLOBALS['ectdatabase'] = new mysqli($db_host, $db_username, $db_password, $db_name);
if(mysqli_connect_error()){
ob_clean();
print '<html><head><title>Database connect error</title></head><body><div style="margin:20px;clear:both">Database Connect Error (' . mysqli_connect_errno() . ') ' . mysqli_connect_error() . '</div>';
print('<div style="margin:20px;clear:both">You need to set your database connection in vsadmin/db_conn_open.php</div>');
print '<div style="margin:20px;clear:both">For help setting your database connection please see...<br />';
print '<a href="http://www.ecommercetemplates.com/phphelp/ecommplus/instructions.asp#dbconn" target="_blank">http://www.ecommercetemplates.com/phphelp/ecommplus/instructions.asp#dbconn</a></div>';
print '<div style="margin:20px;clear:both">We also have a support forum here...<br />';
print '<a href="http://www.ecommercetemplates.com/support/" target="_blank">http://www.ecommercetemplates.com/support/</a></div>';
die('</body></html>');
}
?>

Andy

Please feel free to review / rate our software

DTPwarrior
Advanced Member

USA
298 Posts

Pre-sales questions only
(More Details...)

Posted - 02/27/2018 :  09:24:26  
I got the following error message after changing the file as you stated.

Database Connect Error (2002) Connection refused
You need to set your database connection in vsadmin/db_conn_open.php
For help setting your database connection please see...
http://www.ecommercetemplates.com/phphelp/ecommplus/instructions.asp#dbconn
We also have a support forum here...
http://www.ecommercetemplates.com/support/

Does this need to be the same as the db_conn_open.php file in the security vsadmin to work properly?


Doug
[url]http://www.paintandpowderstore.com[/url]

Andy
ECT Moderator

95440 Posts

Posted - 02/27/2018 :  09:42:17  
They should be identical if you are using two vsadmin folders. Also check the values for the db name etc after making the changes.

Andy

Please feel free to review / rate our software

DTPwarrior
Advanced Member

USA
298 Posts

Pre-sales questions only
(More Details...)

Posted - 02/27/2018 :  09:45:47  

Hi Andy,

I also asked my hosting support folks if there is something needed on their end for 7.1 to work on my site. They came back with the following reply:

Quote:
The mysql_connect() extension was deprecated in PHP 5.5.0, and it was removed in PHP 7.0.0. Instead, the MySQLi extension should be used. We tested your website under PHP 7, and it turned out that a lot of functions in the source code have to be updated. That could be difficult to do manually, so we recommend that you obtain a newer version (compatible with PHP 7.x) from your website developer/vendor.

Best regards,
Support
End of Quote

What do I do with this? I have the latest updater installed. ECT version 6.7.4.

Doug


Doug
[url]http://www.paintandpowderstore.com[/url]

Andy
ECT Moderator

95440 Posts

Posted - 02/27/2018 :  09:50:58  
ECT v6.7.4 is compatible with PHP 7+ so as long as the updater was run fully all ECT code should be fine. Do you have any third party plugins or mods on the site?

Andy

Please feel free to review / rate our software

Vince
Administrator

39437 Posts

Posted - 02/27/2018 :  12:42:54  
Hi Doug
By the look of that error you were not using the new type of mySQL database connection. Is it possible your new database connection file wasn't uploaded to the correct location or something like that?

Vince

Click Here for Shopping Cart Software
Click Here to sign up for our newsletter
Click Here for the latest updater

DTPwarrior
Advanced Member

USA
298 Posts

Pre-sales questions only
(More Details...)

Posted - 02/27/2018 :  18:05:10  


Hi Vince,
I really don't understand your question or how to check whether a new database connection file wasn't uploaded to the correct location.

As far as I know, there were no new files uploaded. The only thing I changed was the first and last statements in the includes.php and db_conn_open.php files (to <?php .....?> from the Script open and close. Then I added the following to the db_conn_open.php in place of the coding I had before:

$GLOBALS['ectdatabase'] = new mysqli($db_host, $db_username, $db_password, $db_name);
if(mysqli_connect_error()){
ob_clean();
print '<html><head><title>Database connect error</title></head><body><div style="margin:20px;clear:both">Database Connect Error (' . mysqli_connect_errno() . ') ' . mysqli_connect_error() . '</div>';
print('<div style="margin:20px;clear:both">You need to set your database connection in vsadmin/db_conn_open.php</div>');
print '<div style="margin:20px;clear:both">For help setting your database connection please see...<br />';
print '<a href="http://www.ecommercetemplates.com/phphelp/ecommplus/instructions.asp#dbconn" target="_blank">http://www.ecommercetemplates.com/phphelp/ecommplus/instructions.asp#dbconn</a></div>';
print '<div style="margin:20px;clear:both">We also have a support forum here...<br />';
print '<a href="http://www.ecommercetemplates.com/support/" target="_blank">http://www.ecommercetemplates.com/support/</a></div>';
die('</body></html>');
}
?>

Then at my host control panel, I switched from PHP 5.6 to PHP 7.1. It did not work. I had no access to ECT Admin and received the following:

Fatal error: Uncaught Error: Call to undefined function mysql_query() in /home/pro/www/www/babyadmin/adminorders.php:15 Stack trace: #0 /home/pro/www/www/babyadmin/adminorders.php(26): lofect_query('SELECT adminlan...') #1 {main} thrown in /home/pro/www/www/babyadmin/adminorders.php on line 15


If you would like to take a peek at my setup, I can provide you my ftp login/password.

Let me know.

Thanks for any help you can provide as I am almost illiterate when it comes to the website backend.




Doug
[url]http://www.paintandpowderstore.com[/url]

insight
ECT Moderator

USA
4216 Posts

Posted - 02/27/2018 :  18:49:36  
Seems like you didn't make the change in both admin folders, if that's what you are seeing. Both the files /vsadmin/db_conn_open.php and /securityadmin/db_conn_open.php should be exactly the same

Peter

ServeLink
Professional ecommerce web hosting for ASP & PHP
https://servelink.com

Take a look at our image upload/resize tool for the ASP cart
https://servelink.com/clients/cart?gid=7

DTPwarrior
Advanced Member

USA
298 Posts

Pre-sales questions only
(More Details...)

Posted - 02/28/2018 :  11:25:57  

Hi Peter,

I did indeed make all those changes in both vsadmin and the security vsadmin folder files.




Doug
[url]http://www.paintandpowderstore.com[/url]

Andy
ECT Moderator

95440 Posts

Posted - 03/01/2018 :  00:25:23  
So, do you have this working now Doug or is there still a problem?

Andy

Please feel free to review / rate our software

DTPwarrior
Advanced Member

USA
298 Posts

Pre-sales questions only
(More Details...)

Posted - 03/01/2018 :  03:22:08  


Hi Andy,

No, I was still waiting for a reply from Vince. In my last post to Vince I stated "If you would like to take a peek at my setup, I can provide you my ftp login/password."


Doug
[url]http://www.paintandpowderstore.com[/url]

Andy
ECT Moderator

95440 Posts

Posted - 03/01/2018 :  03:24:04  
Please send me on your FTP details and I'll take a look for you.

Andy

Please feel free to review / rate our software

DTPwarrior
Advanced Member

USA
298 Posts

Pre-sales questions only
(More Details...)

Posted - 03/01/2018 :  04:01:06  

OK, will do.

Be advised that I had to go back to the following code in the db_conn_open.php files so that it will work properly with PHP 5.6:

<?php

// You host should be able to provide you with these settings if you do not know them already

$db_username = "ecommerce"; // Your database login username
$db_password = "xxxxxxxxx"; // Your database login password
$db_name = "pro_cosmetics"; // The name of the database you wish to use
$db_host = "localhost:/tmp/mysql5.sock"; // The address of the database. Often this is localhost, but may be for example db.yoursite.com

//////////////////////////////////////////////////
// Please do not edit anything below this line. //
//////////////////////////////////////////////////

$dbh=mysql_connect($db_host, $db_username, $db_password) or die ('You need to set your database connection in vsadmin/db_conn_open.php.</td></tr></table></body></html>');
mysql_select_db($db_name) or die ('You need to set your database connection in vsadmin/db_conn_open.php.</td></tr></table></body></html>');

?>



Doug
[url]http://www.paintandpowderstore.com[/url]

Andy
ECT Moderator

95440 Posts

Posted - 03/01/2018 :  04:05:44  
What ECT version is your store running right now?

Andy

Please feel free to review / rate our software

DTPwarrior
Advanced Member

USA
298 Posts

Pre-sales questions only
(More Details...)

Posted - 03/01/2018 :  06:24:48  

Andy,

Seems the $db_host address was wrong after all. It just needed to be "localhost";.

I changed the $db_host in the db_conn_open.php files (both vsadmin folders) and used your latest coding. Changed to PHP 7.1 in the server control panel and all seems to be working well at this time.

I will be testing it out more during the day.

Thanks for your help.



Doug
[url]http://www.paintandpowderstore.com[/url]

   Topic   
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
Shopping Cart Software Forum for Ecommerce Templates © 2002-2020 ecommercetemplates.com
This page was generated in 0.03 seconds. Snitz Forums 2000