Need help testing mysqli in PHP

Discussions about development of VICIDIAL and astGUIclient

Moderators: gerski, enjay, williamconley, Op3r, Staydog, gardo, mflorell, MJCoate, mcargile, Kumba, Michael_N

Need help testing mysqli in PHP

Postby mcargile » Fri Jan 25, 2013 6:32 pm

So Vicidial is currently written to use the mysql functions in PHP. PHP a while ago started developing a replacement for them called mysqli. Well now PHP is in the process of deprecating the mysql functions in favor of the mysqli functions. They have also stopped maintaining the mysql functions. This might be the reason Vicidial will not work with more than a few agents on MySQL 5.5. As such we need to convert all of Vicidial to the mysqli functions. Unfortunately they are not a drop in replacement for mysql. I believe I have done the necessary leg work to switch it over the agent interface. However I do not have enough people to properly test all of the functionality. I have logged in and taken some calls with it. Could a few people please test my mysqli changes on production systems? I have made it super easy to go back if there are problems.

To install the code:

1. upgrade the server to SVN revision 1928
2. download this file http://download.vicidial.com/beta-apps/agci-1928.tgz
3. Untar this in the web servers root directory. It will create an addition directory called agci.
4. Instead of having the agents log into http://SERVERIP/agc/vicidial.php have them log into http://SERVERIP/agci/vicidial.php (note the 'i' in agci).
5. If there are any problems you will still be able to have the agents log into http://SERVERIP/agc/vicidial.php which is the stock vicidial code.
6. Try and test as much functionality as possible.

This also effects the agent API so if someone could do some production level testing on that it would great as well. Just change from agc to agci in the api url path.
Michael Cargile | Director of Engineering | ViciDialGroup | http://www.vicidial.com

The official source for VICIDIAL services and support. 1-888-894-VICI (8424)
mcargile
Site Admin
 
Posts: 614
Joined: Tue Jan 16, 2007 9:38 am

Re: Need help testing mysqli in PHP

Postby mcargile » Wed Feb 06, 2013 5:12 pm

Anyone get chance to test this out?
Michael Cargile | Director of Engineering | ViciDialGroup | http://www.vicidial.com

The official source for VICIDIAL services and support. 1-888-894-VICI (8424)
mcargile
Site Admin
 
Posts: 614
Joined: Tue Jan 16, 2007 9:38 am

Re: Need help testing mysqli in PHP

Postby DomeDan » Fri Feb 08, 2013 3:44 pm

I checked it out and got this error:
PHP Warning: Missing argument 2 for my_mysqli_real_escape_string(), called in /srv/www/htdocs/agci/vdc_db_query.php on line 9630 and defined in /srv/www/htdocs/agci/dbconnect.php on line 15
PHP Warning: mysqli_real_escape_string() expects parameter 1 to be mysqli, null given in /srv/www/htdocs/agci/dbconnect.php on line 16

just added $link to the function calls, posted a patch to it here http://www.vicidial.org/VICIDIALmantis/view.php?id=649

and there's a swap file still left in the tar file ".dbconnect.php.swp" was a bit surprised when the warning about that file popped up in vim.

those are the things I've seen so far. gonna make it default for the agents so I get sit back and wait for the problems to come to me 8)


How is this in contrast to the upcoming conversion to MariaDB talked about in this thread http://vicidial.org/VICIDIALforum/viewt ... =2&t=26462 ?
Vicidial Partner. Region: Sweden/Norway.
Does Vicidial installation, configuration, customization, add-ons, CRM implementation, support, upgrading, network-related, pentesting etc. Remote and onsite assistance.
Email: domedan (at) gmail.com
DomeDan
 
Posts: 1226
Joined: Tue Jan 04, 2011 9:17 am
Location: Sweden

Re: Need help testing mysqli in PHP

Postby mcargile » Mon Feb 11, 2013 4:53 pm

Here is an update for SVN 1932 with your fix in it:

http://download.vicidial.com/beta-apps/agci-1932.tgz

Let me know how that one works.
Michael Cargile | Director of Engineering | ViciDialGroup | http://www.vicidial.com

The official source for VICIDIAL services and support. 1-888-894-VICI (8424)
mcargile
Site Admin
 
Posts: 614
Joined: Tue Jan 16, 2007 9:38 am

Re: Need help testing mysqli in PHP

Postby KeithHBW » Thu Feb 14, 2013 4:15 pm

What does the following statement mean in regards to "work":
This might be the reason Vicidial will not work with more than a few agents on MySQL 5.5

I use MySQL 5.5 and have ~20 agents per dialer logged in. ~100agents in a single webserver. Should I help test this out? I do not know what issues I am running into if I am running into said issues.
Vicibox 7.0.1 from .iso | Vicidial 2.12b0.5 Build 160122-1401 | Asterisk 11.21.0-vici | Cluster | No Digium/Sangoma Hardware | No Extra Software After Installation | [Six Core CPU] Intel Xeon E5-2640 @ 2.50GHz
KeithHBW
 
Posts: 104
Joined: Fri Jan 13, 2012 12:58 pm

Re: Need help testing mysqli in PHP

Postby Noah » Tue Feb 19, 2013 9:26 am

Check your table types Mysql 5.5 creates INNODB database table types by default. This could lead to your slowness with just a few reps. So if you created your db for vici using the "create table script" on a fresh mysql install you might get yourself into innodb trouble.

We actually ran into this trouble building a new system, in just that manner. Innodb was the default engine variable type or it wasn't established in my.cnf before running the create table script and simply defaulted the tables to innodb type.

Do NOT use innodb types of tables with vicidial, unless you really know how to tweak out mysql. I believe it's always been the recommendation to use myisam.

Confirm your type:

mysql>show variables like '%default_storage_engine';

If you don't have MyISAM below - you're probably going to see some slowness.
+------------------------+--------+
| Variable_name | Value |
+------------------------+--------+
| default_storage_engine | MyISAM |
+------------------------+--------+

Check your tables - swap db name with asterisk or whatever you named your db for vici.
mysql> SELECT TABLE_NAME, ENGINE FROM information_schema.TABLES where TABLE_SCHEMA = 'dbname';

Noah
mycallcloud.com
MyCallCloud.com - Cool Vici Customizations - Hosted - Configured - Supported
Web: https://mycallcloud.com
P: 888-663-0760
E: sales@mycallcloud.com
Noah
 
Posts: 90
Joined: Tue Feb 08, 2011 7:14 pm

Re: Need help testing mysqli in PHP

Postby mcargile » Thu Feb 21, 2013 1:12 pm

With MySQL 5.5 for some reason we have not completely narrowed down, agents will just randomly go into pause. This will happen with just a few agents on the system (5 or less). This has nothing to do with storage engine as all of the tables are MyISAM.

We are guessing the problem is probably related to PHP's implementation of the mysql connection. Vicidial uses the mysql database connection type that has been in PHP for years. However PHP started to implement mysqli a few years back. It is now the recommended mysql connection type. The standard mysql connection type has been deprecated and is no longer under development. This happened when MySQL was still in 5.0. We are thinking the issue is that enough has changed in MySQL 5.5 that it is no longer fully compatible with the mysql connection type. As such hopefully converting over to mysqli will fix the issue.

If that does not work we will be trying MariaDB.

In the mean time downgrading to MySQL 5.1 from 5.5 fixes the random agents pausing issue.


This topic is about testing the mysqli implementation I did to make sure everything is working in it. If there are no issues in it, it will probably become the connection type used in the final 2.6 Vicidial release. If you are looking at this topic because of agent pausing issues, please open a ticket in Support as that could be caused by a number of other things.
Michael Cargile | Director of Engineering | ViciDialGroup | http://www.vicidial.com

The official source for VICIDIAL services and support. 1-888-894-VICI (8424)
mcargile
Site Admin
 
Posts: 614
Joined: Tue Jan 16, 2007 9:38 am

Re: Need help testing mysqli in PHP

Postby williamconley » Thu Feb 21, 2013 6:16 pm

If you have a live box experiencing the sudden pausing and would like another set of eyes, let me know. We've not had this problem as yet, and while a downgrade for mysql is a simple fix, I'd like to see this problem myself once to see if I can hit it. I've used mysqli exclusively for quite some time (except in Vicidial!) and have a fair amount of mysql experience. So if I had access to a machine experiencing this particular problem, I may be of assistance.
Vicidial Installation and Repair, plus Hosting and Colocation
Newest Product: Vicidial Agent Only Beep - Beta
http://www.PoundTeam.com # 352-269-0000 # +44(203) 769-2294
williamconley
 
Posts: 20018
Joined: Wed Oct 31, 2007 4:17 pm
Location: Davenport, FL (By Disney!)

Re: Need help testing mysqli in PHP

Postby mcargile » Fri Feb 22, 2013 9:01 am

Most of our clients who have the pausing issue are not particularly interested in letting us play around with it. They want it fixed quickly. Downgrading to 5.1 does that.

My concern in this topic really isn't the pausing agent issue though. The mysql connector is depreciated and scheduled to be removed from PHP. We have to switch to mysqli. I need people to try out my code and let me know if there is any problems. Thus far DomaDan helped me find one bug. Hopefully that is it.

If you want to look into the pausing issue, search the support forums. Kumba has already helped a few people downgrade to 5.1.
Michael Cargile | Director of Engineering | ViciDialGroup | http://www.vicidial.com

The official source for VICIDIAL services and support. 1-888-894-VICI (8424)
mcargile
Site Admin
 
Posts: 614
Joined: Tue Jan 16, 2007 9:38 am

Re: Need help testing mysqli in PHP

Postby williamconley » Fri Feb 22, 2013 12:50 pm

I was just hoping to get my hands on one. After all, when the moment comes, as you say, the client will have NO interest in "troubleshooting", only in Fix it!!!

MySQL downgrade is of course simpler, but I hate downgrading when I can avoid it. :)

Unfortunately, I have no clients presently in "beta" mode upon whom I can test a mysqli (a lot of cheapskates, no doubt, but none presently that hungry!).
Vicidial Installation and Repair, plus Hosting and Colocation
Newest Product: Vicidial Agent Only Beep - Beta
http://www.PoundTeam.com # 352-269-0000 # +44(203) 769-2294
williamconley
 
Posts: 20018
Joined: Wed Oct 31, 2007 4:17 pm
Location: Davenport, FL (By Disney!)

Re: Need help testing mysqli in PHP

Postby ruben23 » Sat Mar 09, 2013 6:26 am

Hi, im willing to test this now on production im having
Scratch install
Ubuntu Server 12.04 LTS
mysql 5.5
asterisk 1.8-vici-beta
SVN trunk
Multi Server 1DB, 3 AST, 2 (virtualweb-loadbalance-KVM)
SkypeID: rlacumba
IBM x3200 Dual Core 2.4 Ghz.
4GB Ram
VERSION: 2.4-311a
BUILD: 110514-1351
© 2011 ViciDial Group
Asterisk 1.4.27-vici
Another VICI_day, same trunK, same Channel-->Transcode...
ruben23
 
Posts: 1161
Joined: Thu Jul 31, 2008 10:35 am
Location: Davao City, Philippines

Re: Need help testing mysqli in PHP

Postby mcargile » Mon Mar 11, 2013 10:36 am

Make sure you are using svn 1932 then just extract this into your web root directory:

http://download.vicidial.com/beta-apps/agci-1932.tgz

Have the agents use the agci directory rather than agc directory.
Michael Cargile | Director of Engineering | ViciDialGroup | http://www.vicidial.com

The official source for VICIDIAL services and support. 1-888-894-VICI (8424)
mcargile
Site Admin
 
Posts: 614
Joined: Tue Jan 16, 2007 9:38 am

Re: Need help testing mysqli in PHP

Postby ruben23 » Mon Mar 11, 2013 10:41 am

@ mcargile
My production system now is this -------------> SVN Version: 1938 <-----------------is this ok..?
SkypeID: rlacumba
IBM x3200 Dual Core 2.4 Ghz.
4GB Ram
VERSION: 2.4-311a
BUILD: 110514-1351
© 2011 ViciDial Group
Asterisk 1.4.27-vici
Another VICI_day, same trunK, same Channel-->Transcode...
ruben23
 
Posts: 1161
Joined: Thu Jul 31, 2008 10:35 am
Location: Davao City, Philippines

Re: Need help testing mysqli in PHP

Postby mcargile » Mon Mar 11, 2013 11:01 am

It is important that the SVN versions match so no this will not work. I will be updating the mysqli code sometime this week, but in the mean time you need to be running 1932.
Michael Cargile | Director of Engineering | ViciDialGroup | http://www.vicidial.com

The official source for VICIDIAL services and support. 1-888-894-VICI (8424)
mcargile
Site Admin
 
Posts: 614
Joined: Tue Jan 16, 2007 9:38 am

Re: Need help testing mysqli in PHP

Postby ruben23 » Tue Mar 12, 2013 6:51 pm

@ mcargile

How do i download that specific svn version 1932..? kindly help, i really wanted to test it.Thanks
SkypeID: rlacumba
IBM x3200 Dual Core 2.4 Ghz.
4GB Ram
VERSION: 2.4-311a
BUILD: 110514-1351
© 2011 ViciDial Group
Asterisk 1.4.27-vici
Another VICI_day, same trunK, same Channel-->Transcode...
ruben23
 
Posts: 1161
Joined: Thu Jul 31, 2008 10:35 am
Location: Davao City, Philippines

Re: Need help testing mysqli in PHP

Postby williamconley » Wed Mar 13, 2013 1:29 pm

you use one of these to "acquire" the correct code:

Update: (if your present version is below the required version)
Code: Select all
 cd /usr/src/astguiclient/trunk
 svn up -r 1932

Checkout: (if you do not have any svn version or just want to install in a whole new folder, or have just deleted the previous folder outright)
Code: Select all
 cd /usr/src/astguiclient/
 svn co -r 1932 svn://svn.eflo.net:43690/agc_2-X/trunk

Downgrade: (to move aside the previous svn trunk without deleting it)
Code: Select all
 cd /usr/src/astguiclient/
 mv trunk trunkOLD
 svn co -r 1932 svn://svn.eflo.net:43690/agc_2-X/trunk


This must happen before your final installation.
Vicidial Installation and Repair, plus Hosting and Colocation
Newest Product: Vicidial Agent Only Beep - Beta
http://www.PoundTeam.com # 352-269-0000 # +44(203) 769-2294
williamconley
 
Posts: 20018
Joined: Wed Oct 31, 2007 4:17 pm
Location: Davenport, FL (By Disney!)

Re: Need help testing mysqli in PHP

Postby ruben23 » Wed Mar 13, 2013 6:39 pm

@ williamconley Thanks for this...
SkypeID: rlacumba
IBM x3200 Dual Core 2.4 Ghz.
4GB Ram
VERSION: 2.4-311a
BUILD: 110514-1351
© 2011 ViciDial Group
Asterisk 1.4.27-vici
Another VICI_day, same trunK, same Channel-->Transcode...
ruben23
 
Posts: 1161
Joined: Thu Jul 31, 2008 10:35 am
Location: Davao City, Philippines

Re: Need help testing mysqli in PHP

Postby bobbymc » Mon Oct 14, 2013 10:47 pm

does anybody have a update on this?
bobbymc
 
Posts: 425
Joined: Fri Jan 05, 2007 12:26 am

Re: Need help testing mysqli in PHP

Postby mflorell » Wed Oct 16, 2013 5:24 am

We committed mysqli changes to all PHP scripts a month or two ago. All appears to be working properly.
mflorell
Site Admin
 
Posts: 18335
Joined: Wed Jun 07, 2006 2:45 pm
Location: Florida

Re: Need help testing mysqli in PHP

Postby saulortega » Tue Dec 17, 2013 9:27 am

Hello.

I think this is the reason of my problem: viewtopic.php?f=7&t=20223&start=40#p108505

How can I to fix it?
saulortega
 
Posts: 118
Joined: Mon Jul 29, 2013 11:46 am

Re: Need help testing mysqli in PHP

Postby saulortega » Tue Dec 17, 2013 9:38 am

In functions.php

Before:

Code: Select all
   require("dbconnect.php");

        $CFoutput='';
        $stmt="SHOW TABLES LIKE \"custom_$list_id\";";
        if ($DB>0) {echo "$stmt";}
        $rslt=mysql_query($stmt, $link);
                if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'05002',$user,$server_ip,$session_name,$one_mysql_log);}
        $tablecount_to_print = mysql_num_rows($rslt);
        if ($tablecount_to_print > 0)
...



Now:

Code: Select all
   require("dbconnect_mysqli.php");

   $CFoutput='';
   $stmt="SHOW TABLES LIKE \"custom_$list_id\";";
   if ($DB>0) {echo "$stmt";}
   $rslt=mysql_to_mysqli($stmt, $link);
      if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'05002',$user,$server_ip,$session_name,$one_mysql_log);}
   $tablecount_to_print = mysqli_num_rows($rslt);
   if ($tablecount_to_print > 0)



mysqli_num_rows($rslt) returns 0. :(
saulortega
 
Posts: 118
Joined: Mon Jul 29, 2013 11:46 am

Re: Need help testing mysqli in PHP

Postby mflorell » Tue Dec 17, 2013 7:20 pm

Just tested this to confirm on our development system and a live production system and it worked properly on both.
mflorell
Site Admin
 
Posts: 18335
Joined: Wed Jun 07, 2006 2:45 pm
Location: Florida


Return to Development

Who is online

Users browsing this forum: No registered users and 37 guests