Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Changing MYSQLI to MYSQL
08-27-2013, 11:13 PM, (This post was last modified: 08-28-2013, 03:29 PM by allanp.)
#1
Changing MYSQLI to MYSQL
Hi,

I have webERP running well on a local development machine but when I try and get it setup on my service providers server I run into problems.

After running phpinfo() they do not support mysqli. I have tried changing all references to mysqli in the save.php file and then in the config.php file but the issue of mysqli just keeps coming up on every page. Is there a simple way at setup to tell webERP install to use mysql rather than mysqli?

Thanks

Peter
Reply
08-28-2013, 12:12 PM,
#2
RE: Changing MYSQLI to MYSQL
I believe that only changing the $DBType in the config.php file should be enough.

Once changed, you may have to logout/login again, so that the reference is properly applied.
Reply
08-28-2013, 03:33 PM,
#3
RE: Changing MYSQLI to MYSQL
Thank you for the response TurboPPT

Once the config.php file is created I can change this ref which brings the logon screen.

Before this stage the file save.php in the install has multiple msqli_connect statments which cause issues. I have tried changing all these references to mysql.

When I run setup again and make the changes to config.php it goes to logon but then I get an error telling me that no tables are present in the DB which indicates the initial setup did not build the tables.

Thanks

Peter
Reply
08-28-2013, 03:55 PM,
#4
RE: Changing MYSQLI to MYSQL
Hi, Peter,

If the ISP only provide mysql extension, the installer will not work correctly now. The 4.11 version has rewritten the installer and can support both mysqli and mysql extension. It can solve your problem.

You can wait the new release.

Best regards!

Exson
Reply
08-28-2013, 07:33 PM,
#5
RE: Changing MYSQLI to MYSQL
HI Exson,

Thank you for the feedback. I will keep my eye open on the new release and install a backup of a DB onto the serice provider for the time being to carry on with my test.

Thanks

Peter
Reply
08-29-2013, 02:05 AM,
#6
RE: Changing MYSQLI to MYSQL
Your problem is probably that mysql_connect and mysqli_connect take different parameters, so just changing all references to mysql won't work unless you handle some subtle differences.

mysqli way:
mysqli_connect($host, $username, $passwd, $dbname);

To accomplish the same thing the mysql way, you have to do:
mysql_connect($host, $username, $passwd);
mysql_select_db($dbname);

Another thing I can think of off hand that will definitely break on you is mysqli_real_escape_string (I'm assuming this is used in webERP but haven't looked at the database abstraction code in a while.) mysqli_real_escape_string takes the connection as the first parameter:
mysqli_real_escape_string($conn, $query);

Whereas with mysql_real_escape_string you can just pass $query as the lone parameter.

I'm sure there are other differences between the two, but these come to mind immediately.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)