Discussion Forums  >  Self Hosted Control Panels

Replies: 11    Views: 509

Bonzo
Apple Fan
Profile
Posts: 783
Reg: Jan 30, 2012
Basingstoke
13,530
02/13/17 12:02 AM (7 years ago)

fnExecuteNonQuery() method in utilityFunctions.php

Every single one of self hosted my apps produces "An error ocurred in running the fnExecuteNonQuery() method in utilityFunctions.php (6)" when trying to look at the JSON. i notice this message on my web hosting "PHP 5.2 & 5.4 extended support This website is currently using a version of PHP that is end of life. We strongly recommend you review the compatibility of your websites with the latest available versions of PHP and upgrade these sites as soon as possible." could this be the cause for my suddenly failure on self hosted? I still seem to get the same even if i update to PHP5.6 which my hosting site is recommending This is fnExecuteNonQuery() method in utilityFunctions.php // execute sql, DOES NOT return Id . function fnExecuteNonQuery($theSql, $host, $db, $user, $pass){ $conn = db_connect($host, $db, $user, $pass); if(!$conn ){ if(APP_ERROR_REPORTING > 0){ die("fnExecuteNonQuery, connection.<br>" . fnSqlError()); }else{ die("An error ocurred in the fnExecuteNonQuery() method in utilityFunctions.php (5)"); } }else{ // fetch array $result = mysql_query($theSql, $conn); if($result){ return 1; }else{ if(APP_ERROR_REPORTING > 0){ die("fnExecuteNonQuery :: fnDbGetResult (get result)<br>" . fnSqlError()); }else{ die("An error ocurred in running the fnExecuteNonQuery() method in utilityFunctions.php (6)"); } } } // end if connected }
 
AlanMac
Aspiring developer
Profile
Posts: 2612
Reg: Mar 05, 2012
Esher, UK
37,120
like
02/14/17 02:36 PM (7 years ago)
It usually takes an intervention by Mr Book to figure out these types of problems.
 
Bonzo
Apple Fan
Profile
Posts: 783
Reg: Jan 30, 2012
Basingstoke
13,530
like
02/15/17 02:24 AM (7 years ago)
i know :( i've reached out but no response yet. I don't think its my PHP version because everything else on my self hosted seems to be working and most pages are .php files. I've checked my DB and its only 3MB of a 300MB allowance. I can run select statements against it and delete records OK so it doesn't seem to be corrupt. I just don't understand why it just stopped working on the JSON page, and therefore all of my apps have stopped working as soon as a user hits refresh :(
 
Bonzo
Apple Fan
Profile
Posts: 783
Reg: Jan 30, 2012
Basingstoke
13,530
like
02/15/17 02:38 AM (7 years ago)
same error when trying to create a new app on self hosted...... 'An error ocurred in running the fnExecuteNonQuery() method in utilityFunctions.php (6)'
 
AlanMac
Aspiring developer
Profile
Posts: 2612
Reg: Mar 05, 2012
Esher, UK
37,120
like
02/15/17 02:54 AM (7 years ago)
Have you tried rolling back to the older (BT version 3) of the patched files? If that works, it proves the patches are causing the problem in your setup. Alan
 
Bonzo
Apple Fan
Profile
Posts: 783
Reg: Jan 30, 2012
Basingstoke
13,530
like
02/15/17 03:12 AM (7 years ago)
My self hosted has worked since the patched files so I'm not so sure they are related?
 
AlanMac
Aspiring developer
Profile
Posts: 2612
Reg: Mar 05, 2012
Esher, UK
37,120
like
02/15/17 04:38 AM (7 years ago)
Apologies @bonzo, I made the assumption this had happened since you added the patches. If that is not the case, and it just broke without any changes on your part, I agree, probably not related. FYI, I had issues when I changed host, I'm not suggesting your problems are the same, but might be worth a look in case anything sounds similar? I'm wondering if your self hosted link to buzztouch might be where the problems might be? https://www.buzztouch.com/forum/thread.php?tid=3CA1D4A25613C3B5F4AB874 And a good post by Smug: https://www.buzztouch.com/forum/thread.php?fid=96A4B2BBF646EFF569A9A23&tid=96A4B2BBF646EFF569A9A23
 
David @ buzztouch
buzztouch Evangelist
Profile
Posts: 6866
Reg: Jan 01, 2010
Monterey, CA
78,840
like
02/16/17 01:14 AM (7 years ago)
Commented on another similar thread before seeing this one. I'll bet a bunch it's related to running PHP5.6 or higher (version 5.6 or higher). There are lots of calls to built in mysql functions in the utilityFunctions.php file. The good news is that there are no other calls to mysql methods outside of this utilityFunctions.php file. All the database methods are included in that file. This of course is intentional so it's easier to modify how the database connection stuff works (it's all in the same file). For years and years PHP supported some standard mysql method calls then later introduced mysqli (notice the i, it stands for Improved). These are commonly referred to as the "MySQL Extensions". The older extensions are still used on millions of servers worldwide, and, the NEW MySQL Extensions are also used on millions of servers. They are similar but slightly different. There differences ARE important in some contexts, not for this conversation. So, I'll be zillion that @bonzo's machine no longer supports the "older" mysql extensions and today only supports the "newer" mysqli extensions. I'm making these educated guesses based on the reported symptoms. "It was fine and now it's not." and the message from his webhost like "This website is currently using a version of PHP that is end of life" So, what the heck to do! These are the different method calls used in the mysql extensions.... mysql_connect mysql_query mysql_fetch_row mysql_query Notice NONE of these mysql extension method calls have the "i" (lower case i). They are using the older MySql Extensions. My thought is that these are the older mysql extensions that your machine no longer supports. I can't say this 100% without referencing some docs but I believe the only difference between these method calls and the newer "improved" method calls is adding the i to the method name. This tells PHP to use the new and improved mysql extensions. Example: mysql_query BECOMES mysqli_query (not the additional i) BUT, it's not as simple as finding and replacing all the mysql_ with mysqli_ in the utilityFunctions.php file. It's close to that but not exactly. The fix would be something like this... a) Modify the db_connect method in utilityFunctions.php so it returns a reference to a mysqli connection (new) instead of a mysql connection (old). This is the whole idea, if you connect with the newer extensions you have to then use the newer methods. If you connect with the older extensions you have to use the older methods. So...connect with "i" instead... b) Find / replace all the other mysql_ calls with mysqli_ calls in utilityFunctions.php. I'll bet there are only 10 or 12 of them. I don't have the file in front of me to inspect. c) Test. This isn't a huge change but a bit tedious if you're unsure of what's happening. Of course you'll want to COPY AND BACKUP the original before making any changes so you can revert back as needed. Bottom line, machines / hosts that don't support the older MySql Extensions will show all sorts of funkyness. Lots of folks run the older extensions so it's not as easy as us releasing a newer utilityFunctions.php to support the new extensions. And, of course, there are likely other PHP changes in the latest release that could cause other issues in other places (not database stuff) but I haven't heard of any. WE'RE HAPPY TO DIG INTO SOMEBODY's PHP 5.5 or higher machine and track down these differences, list them, report them, issue another set of changed files. No biggie. Or, go at it yourself, it's fun! Hope this helps...
 
Bonzo
Apple Fan
Profile
Posts: 783
Reg: Jan 30, 2012
Basingstoke
13,530
like
02/16/17 04:11 AM (7 years ago)
David. Really appreciate your response! Thank you for taking the time to reply. I use Fasthosts.co.uk and they inform me it can take 3-4 hours to take affect on my hosting, the upgrade to 5.6 from 5.4. I tried changing all mysql_ to mysqli_ and there was 23 occurrences! Multiples of the below: mysql_ERRNO mysql_ERROR mysql_connect mysql_select_db mysql_query mysql_fetch_row mysql_insert_id This then gave me "An error occurred in running the fnExecuteNonQuery() method in utilityFunctions.php (2)" when it tried to open my self hosting rather than trying to display JSON data in control panel. So a different error number ((2) rather than (6)). I will therefore wait until this evening to see if this 3-4 hours makes any kind of difference...... This is all foreign to me :) THanks Steve
 
David @ buzztouch
buzztouch Evangelist
Profile
Posts: 6866
Reg: Jan 01, 2010
Monterey, CA
78,840
like
02/16/17 08:38 AM (7 years ago)
@Bonzo, no stress...should be easy never seems to work that way in tech. If you email me your server info (FTP user / pass, along with a BT control panel login / pass) I'll get a look. Bet I can make it work on both the newest and older version of PHP, that way it won't matter which version you or anyone else is running. Anyway, send me the server info (david at buzztouch.com) or wait for the host folks to do their thing, see if that changes anything.
 
Bonzo
Apple Fan
Profile
Posts: 783
Reg: Jan 30, 2012
Basingstoke
13,530
like
02/16/17 10:58 AM (7 years ago)
Email sent David. Thanks again
 
David @ buzztouch
buzztouch Evangelist
Profile
Posts: 6866
Reg: Jan 01, 2010
Monterey, CA
78,840
like
02/17/17 04:18 AM (7 years ago)
QUICK EDIT. As it turns out there are WAY MORE changes to the self hosted package to support a newer PHP 5.6 > version than I suspected. We're working them out now. It's a big list and We're trying to figure the best way to package / release it all. Posting here to make sure interested folks understand that my previous comments were valid and interesting...but not at all complete. I'll post more on the forum when we figure out a way to package / release enough files to support PHP 5.6 and above. Laters..
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.