Usort problem

software development

#1

Hey guys,

New to Dreamhost, having issues with my site, particularly a usort function - http://www.mblsim.com/bosi/stats.php?G_tid=1&G_type=0&G_batsort=PLAYER&G_pitchsort=P_ROLE&G_btype=O&G_ptype=O&G_showpitcher=0&G_roster=Active&G_year=2012

Any thoughts on how to resolve this? I am using 3rd party software, but guessing it’s a simple fix hopefully.


#2

Well, the code around the line numbers reported n the error, and the assignments that precede the usort() 's use are the key to figuring out where it “borked”. :wink:

Ther error message is pretty much self-explanatory, but without the code there is no way to guess what the source of the problem might be.

Inspecting the code itself, in light of the relevant section(s) of the PHP manual, should get you pointed in the right direction.

Are you running that code under PHP4 or PHP5 (It could make a difference!). Have you tried running it under PHP4?

–rlparker


#3

According to my phpinfo.php file, I am on version 4.4.7 though I honestly have no idea if that’s right. In terms of the code surrounding it and looking at the manual, I’ve tried that, but I am very much a beginner when it comes to PHP so I am quite lost.


#4

The strange thing here is that on my old site which is still up for a few more days (http://majorbaseballleague.com/bosi/stats.php?G_tid=4), it works just fine.

The same script here on DH and it gives me this bug.


#5

If that is what the phpinfo() function is telling you, then it’s “right”.

That is certianly understandable; not everyone is a programmer.

Is the software you are running a commercial product, is it open source, is it readily available for others to inspect the code?

If you purchased the software, you should try contacting the author/seller, report the error message you are receiving. and ask for help in getting it sorted out.

If it is readily available source code (opensource, etc.), the community of users that use that product is often a good place to seek help - they use it and certianly some of them understand how it works. Some have likely already run into a similar problem as you, and the fix is likely to be fairly simple.

The problem you have here is that we don’t know what software you are running, can’t see the code, and can only point you to a definition of the function that returns the error for help.

IF the product is freely (free as in “free beer” as well as free as in “freedom”), posting a link to where the software can be obtained might induce someone here with the interest, expertise, and time to look at it for you. :wink:

–rlparker


#6

It is what I would call open source. The creator stopped making and supporting the program a few years ago, but I certainly have it available for inspection at http://www.mblsim.com/bosi.zip

I have posted in what’s left of the community that used the software, but no one really has an answer.

I would certainly be indebted if someone could point me in the right direction regarding the code and how to fix it.


#7

Then there is likely some difference in the configuration of the server at DreamHost and the server at your other host that is related to the error. That is where I would start troubleshooting if I didn’t understand the problem with the code as indicated in the error message.

Things that are possibly/likely to be different on Dreamhost:

  1. PHP-CGI vs mod_php. Dreamhost run PHP-CGI.

  2. PHP version in use. You know what your DreamHost site is running, compare that with your other host.

  3. php.ini settings. - Comparing phpinfo() output from each site should tell you where/how things are different between the two host environments.

Those are the common candidates, and should give you a start. :wink:

–rlparker


#8

I’m not familiar with PHP-CGI vs mod_php, I will check.

Regarding the other two, I know the sites are on the same version and I’ve compared the settings as well thinking that might be it. They seem to be the same from what I can tell though I will double check.

Since it works on one though, I do agree, it doesn’t make sense that the code would be wrong.


#9

That’s a logical assumption, and hopefully you are right. :slight_smile:

I’m thinking it is just something different in the hosting environment, and once you find that and either tweak the code, or the environment, appropriately you should be in business.

One other thing to check, though I really don’t think it is related it *could be, are file permissions - DreamHost’s PHP-CGI runs under suEXEC, and as such programs (scripts) should be set to 755 and files to 644 (at least initial;ly, you can 'tweak" until “borkage” after everything is running).

Also be sure and pay special attention to the register_globals php setting - since a comparison is at issue, this could be relevant. :wink:

–rlparker


#10

I double checked everything. It seems both sites are as identical as can possibly be. Here is the error I get:

Warning: usort() [function.usort]: Invalid comparison function


#11

You might ant to check my last post for edit (It seems we were typing at the same time).

When you say that the sites are identical as can possibly be, you mean all the contents of the respective phpinfo() outputs is the same?

–rlparker


#12

Here’s the only differences in comparison where old site is old server and new site is DH:

Old site has disable_functions popen, exec, system, shell_exec popen, exec, system, shell_exec

New site has disable_functions no_value

Old site has error log as error_log where New site has no value for error log

Register globals is on for both sites.


#13

That makes me think that the old site is running mod_php; have you confirmed that yet? (we might be making progress here!)

–rlparker


#14

http://majorbaseballleague.com/phpinfo.php

It says server api = CGI though I am just guessing that’s what that means. If not, I’m not sure how to find it.


#15

Pfft.

Take a gander at this: http://www.mblsim.com/bosi/lib/

You need to upload sorts.inc again!

:cool: openvein.org -//- One-time [color=#6600CC]$50.00 discount[/color] on [color=#0000CC]DreamHost[/color] plans: Use ATROPOS7


#16

I feel dumb!

Thanks so much guys, very much appreciated.


#17

Thanks for that link - it helps! They are both running PHP-CGI, that that shouldn’t be the issue. But, now there is some info to compare to help track down the source of the problem.

First, while I can’t see your DH phpinfo() output, from the phpinfo() output of a standard DreamHost PHP4.4.7 installation, I can see some obvious differences that could be related to your problem. :slight_smile:

If you load your old hosts phpinfo() output in a browser window, and the default DH phpinfo() output I linked above (or your own) in another window, you can easily compare the difference, and there are many that could be relevant to your problem.

Check particularly the “Configure Command” info box (third one from the top of the page) and note that the DH installation of PHP is not configured with the same modules/libraries - there are several modules your old host has enabled at configure time that you do not have by default at DreamHost.

I’m thinking that the code that is throwing you problem is in some way related to that. You never answered regarding the source of the software - is it FOSS, or proprietary, or custom?

With what you now have discovered about the differences in your environment, the author, or other users of the software (particularly any that have written mods, etc) should be able to pretty easily identify the fix. :wink:

–rlparker


#18

Or it could be that he just needed to upload the source file containing all the comparison functions because it was zero-length :stuck_out_tongue:

I took the approach that perhaps the functions went missing…

:cool: openvein.org -//- One-time [color=#6600CC]$50.00 discount[/color] on [color=#0000CC]DreamHost[/color] plans: Use ATROPOS7


#19

AH! (slinks quietly away … )

That’s a real good point - I just “ASSumed” that he had moved the whole application intact, and I definitely should have asked. :frowning: Thanks!

I did not at all catch the zero length file - where did you see that from the error message?

–rlparker


#20

I feel dumb - I didn’t see your response pointing me to the .zip file because I was typing an answer … and I apologize for pointing you in the wrong direction! Hooray for Atropos7!

–rlparker