Unofficial JMB Support Forums

UnofficialJMBSupport.Com => TradeX Discussion => Topic started by: The Dawg on September 13, 2013, 10:09:47 AM

Title: Error after install.
Post by: The Dawg on September 13, 2013, 10:09:47 AM
Dedicated server:

Script Version: Master trade X (from github)
PHP Version: 5.2.5
MySQL Version: 5

Have you tried the server test script: No

Have you modified any code yourself: No

Link to site: No

Description of issue: On the control panel I have this error right above the black bar header for the trades.

A fatal error has occurred: unpack(): Type L: not enough input, need 4, have 2 in .......tx/lib/stats.php on 186

The page does not completely load and the new trades do not appear.

Title: Re: Error after install.
Post by: a4evermedia on September 13, 2013, 02:38:54 PM
Here is a link to a post with that same error msg.
http://jmbforumarchives.unofficialjmbsupport.com/index9024.html?i=viewtopic/8809/ (http://jmbforumarchives.unofficialjmbsupport.com/index9024.html?i=viewtopic/8809/)

Its seems the problem was resolved with a fresh install.

Here is another solution:
http://jmbforumarchives.unofficialjmbsupport.com/indexd8aa.html?i=viewtopic/7889/ (http://jmbforumarchives.unofficialjmbsupport.com/indexd8aa.html?i=viewtopic/7889/)

You might try deleting the files in your stats directory.  They should be recreated as necessary. If not, you will have to try a reinstall anyway.

Good Luck
a4ever
Title: Re: Error after install.
Post by: The Dawg on September 13, 2013, 07:40:42 PM
Thanks for the reply.

I deleted files, replaced files from working copies... Reinstalled... Nothing worked.
Title: Re: Error after install.
Post by: a4evermedia on September 13, 2013, 08:02:36 PM
Hmm, I havent installed the Github version of tradex yet.  I'll have to try it on one of my domains and see how it goes. 

Don't know how soon I'll get a chance to work on it, but when I do I'll post the results.
Title: Re: Error after install.
Post by: Chad on September 13, 2013, 09:33:54 PM
Hmm, I havent installed the Github version of tradex yet.  I'll have to try it on one of my domains and see how it goes. 

Don't know how soon I'll get a chance to work on it, but when I do I'll post the results.

I'll install it on my dev server tomorrow night and give it a look if you don't get a chance to do it before then.

Thanks,
Chad
Title: Re: Error after install.
Post by: Chad on September 15, 2013, 02:53:32 PM
I have it installed and a test trade added but I don't see the error on my install.  The second JMB forum link that a4ever posted above suggests that it is caused by bad files in the stats directory.

Can you provide a FTP login via a ticket (http://tickets.unofficialjmbsupport.com/index.php?a=add) so I can take a look at the files?

Thanks,
Chad
Title: Re: Error after install.
Post by: The Dawg on September 16, 2013, 04:14:52 PM
Hey,

I looked at a "auto-install" to see the structure and I noticed that there are .htaccess files in a few of the data folders (GitHub) version that are not in the old version.  I removed them and the error went away.  Why are there .htaccess files that say "deny from all" in those data folders?
Title: Re: Error after install.
Post by: a4evermedia on September 18, 2013, 11:06:39 AM
Yeah, they are there to enhance some security concerns - but they dont really do a lot without the prescence of the ORDER directive.

Google 'Apache ORDER, DENY, ALLOW directives' for more info.

Glad you got it resolved.  I am very happy with TradeX on all my sites.  Now I don't have anyone peeling off my traffic - lol.

I'm going to install the github version on my next new domain.
Title: Re: Error after install.
Post by: timlover on October 25, 2013, 03:31:32 PM
I did a fresh github install on a domain and I'm getting the same error

unpack(): Type L: not enough input, need 4, have 2 in .......tx/lib/stats.php on 186

Going to try and debug this issue today and get it resolved. The issue is not in the
stats.php file as I've examdiffed them to another older working copy and there is
no difference in files at that location.
Title: Re: Error after install.
Post by: Chad on October 25, 2013, 08:38:37 PM
Did you try removing the extra .htaccess files that Dawg talked about above?  If that fixes the errors I will delete them in github.

Thanks,
Chad

I did a fresh github install on a domain and I'm getting the same error

unpack(): Type L: not enough input, need 4, have 2 in .......tx/lib/stats.php on 186

Going to try and debug this issue today and get it resolved. The issue is not in the
stats.php file as I've examdiffed them to another older working copy and there is
no difference in files at that location.
Title: Re: Error after install.
Post by: peeperd on November 03, 2013, 10:37:44 AM
guess you didnt update the zip i had to delete the .htaccess files to get it working
Title: Re: Error after install.
Post by: Chad on November 06, 2013, 06:37:34 PM
Nobody confirmed that removing them fixed the error until you did so I will remove them.
Title: Re: Error after install.
Post by: pornclaw on December 30, 2013, 08:28:42 AM
I also struggled with this error after trying to install the github version. I finally managed to solve it, so I thought I'd make an account to share what I did  :)

I've tried all the suggestions above. Delete the .htaccess files, reinstall a couple of times, emptied the stats folder.. None of them seemed to work.

What I did eventually did was remove the whole data folder, and replaced it with the data folder from a backup I had of a tradeX version I bought about a year ago. I set all the permissions to 777 again, ran the reset-access script, and the error was gone. All my old data was showing, so I deleted all the trades and did a 'reset' on the general in/out stats.

I have no idea what really solved it. But it probably has something to do with missing files somewhere in the data folder.
Title: Re: Error after install.
Post by: pacoc on January 18, 2014, 11:03:16 AM
Nobody confirmed that removing them fixed the error until you did so I will remove them.

Hi Chad. I just installed the GitHub version. After changing the permissions (777 and 666) and follow the installation guide manual, I could not install.

I had to create the "_compiled" folder in the template directory. So YES I could install Tradex.

But, now when I login to my panel, I see the following:

Code: [Select]
A fatal error has occurred: unpack(): Type L: not enough input, need 4, have 0 in /home/XXXX/public_html/tx/lib/stats.php on 186

I deleted all the htaccess files in the "data directory" but that error keeps coming.

I guess all of that install the GitHub version are having the same mistake I did. Please, we need help.

Regards
Title: Re: Error after install.
Post by: pacoc on February 02, 2014, 12:43:43 PM
Did anyone want to help?
is a serious mistake because the problem is in the version of Github!

Regards

Nobody confirmed that removing them fixed the error until you did so I will remove them.

Hi Chad. I just installed the GitHub version. After changing the permissions (777 and 666) and follow the installation guide manual, I could not install.

I had to create the "_compiled" folder in the template directory. So YES I could install Tradex.

But, now when I login to my panel, I see the following:

Code: [Select]
A fatal error has occurred: unpack(): Type L: not enough input, need 4, have 0 in /home/XXXX/public_html/tx/lib/stats.php on 186

I deleted all the htaccess files in the "data directory" but that error keeps coming.

I guess all of that install the GitHub version are having the same mistake I did. Please, we need help.

Regards
Title: Re: Error after install.
Post by: Zug on February 28, 2014, 08:59:30 AM
Ya ... I am getting this error as well. I dont see any extra .htaccess files. But I do see these files:
/data/trade_stats/.Empty_Directory.txt
/data/sessions/.Empty_Directory.txt

Those look out of place. I have not added any trades. I just installed it and see that error:
Code: [Select]
A fatal error has occurred: unpack(): Type L: not enough input, need 4, have 0 in /var/www/site.com/tx/lib/stats.php on 186 

Any help please?
Title: Re: Error after install.
Post by: Zug on March 01, 2014, 06:59:00 AM
Yeah, they are there to enhance some security concerns - but they dont really do a lot without the prescence of the ORDER directive.
Google 'Apache ORDER, DENY, ALLOW directives' for more info.

http://httpd.apache.org/docs/2.2/howto/access.html

Quote
Access control by host

If you wish to restrict access to portions of your site based on the host address of your visitors, this is most easily done using mod_authz_host.

The Allow and Deny directives let you allow and deny access based on the host name, or host address, of the machine requesting a document. The Order directive goes hand-in-hand with these two, and tells Apache in which order to apply the filters.

The usage of these directives is:

Allow from address

where address is an IP address (or a partial IP address) or a fully qualified domain name (or a partial domain name); you may provide multiple addresses or domain names, if desired.

For example, if you have someone spamming your message board, and you want to keep them out, you could do the following:

Deny from 10.252.46.165

Visitors coming from that address will not be able to see the content covered by this directive. If, instead, you have a machine name, rather than an IP address, you can use that.

Deny from host.example.com

And, if you'd like to block access from an entire domain, you can specify just part of an address or domain name:

Deny from 192.168.205
Deny from phishers.example.com moreidiots.example
Deny from ke

Using Order will let you be sure that you are actually restricting things to the group that you want to let in, by combining a Deny and an Allow directive:

Order deny,allow
Deny from all
Allow from dev.example.com

Listing just the Allow directive would not do what you want, because it will let folks from that host in, in addition to letting everyone in. What you want is to let only those folks in.
Title: Re: Error after install.
Post by: Zug on March 01, 2014, 07:10:11 AM
error:
Code: [Select]
A fatal error has occurred: unpack(): Type L: not enough input, need 4, have 0 in /var/www/site.com/tx/lib/stats.php on 186 

This is the /tx/lib/.htaccess ( as installed from github 2 days ago)

Code: [Select]
deny from all


This is the area of /tx/lib/stats.php on line 186:

Code: [Select]

    foreach( $trades as $trade )
    {
        $domain = $trade['domain'];
        $file = $directory . '/' . $domain;

        $rt24 = array_fill(1, STATS_PER_RECORD, 0);
        $fp = fopen($file, 'r');
        for( $i = 0; $i < HOURS_PER_DAY; $i++ )
        {
*LINE 186>>>            $r = unpack('L' . STATS_PER_RECORD, fread($fp, RECORD_SIZE_STATS));
            foreach( $r as $j => $k )
            {
                $rt24[$j] += $k;
            }
        }

        $rt60 = array_fill(1, STATS_PER_RECORD, 0);
        fseek($fp, $minute_offset, SEEK_CUR);
        for( $i = 0; $i < MINUTES_PER_HOUR; $i++ )
        {
            //$minute++;
            $r = unpack('L' . STATS_PER_RECORD, fread($fp, RECORD_SIZE_STATS));
            foreach( $r as $j => $k )
            {
                $rt60[$j] += $k;
            }

            // Wrap around midnight with a seek
            if( ftell($fp) == $end_of_file )
            {
                fseek($fp, HOURS_PER_DAY * RECORD_SIZE_STATS, SEEK_SET);
            }
        }

        fclose($fp);
Title: Re: Error after install.
Post by: Huge on March 25, 2014, 05:17:32 PM
delete the .htaccess file in /tx/data/trades/.htaccess and then hit reload and the error goes away  8)
Title: Re: Error after install.
Post by: Grafrat on June 21, 2014, 02:36:29 AM
So is there a reliable solution to this problem?
Title: Re: Error after install.
Post by: morf on October 04, 2016, 01:41:42 PM
I have no .htaccess files in the directory but still get the error.

Any solution?
Title: Re: Error after install.
Post by: The Dawg on July 07, 2017, 10:40:10 AM
delete the .htaccess file in /tx/data/trades/.htaccess and then hit reload and the error goes away  8)
This is the correct answer.

The file is now called ".Empty_Directory.txt" - Delete that from /tx/data/trades/