1 (edited by farooq 2004-02-20 13:52)

Topic: error with admin_index.php

Great stuff, this PunBB...

I just installed it, everything works great, but for my little issue..

I click the admin link, and I recieve "Error:  unable to fetch online count"

I know its something simple..

with debugging, I get this error..

File: /mnt/web_j/d42/s15/a0002mwr/www/forums/admin_index.php
Line: 87

PunBB reported: Unable to fetch online count
Database reported: Lost connection to MySQL server during query (Errno: 2013)

2

Re: error with admin_index.php

If you haven't modified anything, then it should work, what version of MySQL do you have?
This error means that the select count query returned an error.
You can try bypassing it, but I strongly recommend that you find out why is this error appearing, or you might find yourself in trouble elsewhere.

To bypass it, edit the mentioned file and instead of:

// Get number of current visitors
$result = $db->query('SELECT COUNT(user_id) FROM '.$db->prefix.'online') or error('Unable to fetch online count', __FILE__, __LINE__, $db->error());
$num_online = $db->result($result, 0);

write:

// Get number of current visitors
//$result = $db->query('SELECT COUNT(user_id) FROM '.$db->prefix.'online') or error('Unable to fetch online count', __FILE__, __LINE__, $db->error());
$num_online = 0;

I'm not sure, even if there's no visitor there, you should be able to retrieve it. Are all tables there? Chech if there's any kind of problem with the (prefix)online table.

Re: error with admin_index.php

There's nothing wrong with the code or the query. It's something with the communication between PHP and MySQL on your server. What version of MySQL are you using?

Also, do have root access to the server? In that case, could you tail -f the mysqld logfile when attempting to open the admin page?

"Programming is like sex: one mistake and you have to support it for the rest of your life."

4 (edited by farooq 2004-02-21 11:32)

Re: error with admin_index.php

I use netfirms.com as a webhost..  I do not have root access to the mysql server, which is version 3.23.55
I'm new to the whole PHP & mySQL development stuff..   I use phpmyadmin to administer my dbases..   I'll temporarily try MarcB's bypass..

::Edit::
MarcB's bypass did not work.   sad


It's an interesting problem..

Re: error with admin_index.php

Well, my guess is that it's a bug in that version of MySQL. According to the changelog, the version after that, 3.23.56, contained the following fix:

"Fixed bug with connect timeout. This bug was manifested on OS's with poll() system call, which resulted in timeout the value specified as it was executed in both select() and poll()."

I'm guessing this is related to that bug. Perhaps you should ask your host to upgrade?

"Programming is like sex: one mistake and you have to support it for the rest of your life."

Re: error with admin_index.php

thanks for the advice.  I'll try that..  see if they can do it..   knowing corporate america, I'll not hold my breath though.


Is there anyway to work around that issue temporarily?

Re: error with admin_index.php

Sorry. Not that I know of :(

"Programming is like sex: one mistake and you have to support it for the rest of your life."

Re: error with admin_index.php

would calling the database connection function *or whatever it's called*  before getting the online count help out?

Re: error with admin_index.php

Probably not. What happened when you tried MarcBs suggestion above?

Edit: Also, try changing the value of p_connect in your config.php from true to false (or vice versa).

"Programming is like sex: one mistake and you have to support it for the rest of your life."

10

Re: error with admin_index.php

Since MySQL 3.23.37 works fine, you could be right and it might be OS dependant (or OS-configuration dependant).
You can try asking them to upgrade the DB, or upgrade the OS... I guess that would make the decision easier...

11 (edited by farooq 2004-02-21 16:00)

Re: error with admin_index.php

#1, I deleted it all, and ran it again..  Same error..

#2, with the value of p_connect switched gave me the same error..

File: /mnt/web_j/d42/s15/a0002mwr/www/forums/admin_index.php
Line: 87

PunBB reported: Unable to fetch online count
Database reported: Lost connection to MySQL server during query (Errno: 2013)

#3, marcB's suggestion:

File: /mnt/web_j/d42/s15/a0002mwr/www/forum/admin_index.php
Line: 87

PunBB reported: Unable to fetch online count
Database reported: Lost connection to MySQL server during query (Errno: 2013)

::EDIT::

Also ran marcB's suggestion with the value of p_connect in config.php changed..  Same error.

Re: error with admin_index.php

You shouldn't receive that error message if you did what MarcB suggested. Did you really put // in front of the row like he suggested?

"Programming is like sex: one mistake and you have to support it for the rest of your life."

13

Re: error with admin_index.php

oh.. god, no..  I didn't even see the comment slashes...

smacks his head on the desktop

Ok..  running his REAL suggestion got me anothor error.

File: /mnt/web_j/d42/s15/a0002mwr/www/forum/admin_index.php
Line: 92

PunBB reported: Unable to fetch version info
Database reported: Lost connection to MySQL server during query (Errno: 2013)

14

Re: error with admin_index.php

... I thought I hit a wall...  but I may have gotten around it...



I reported one of my messages...   and clicked on the link it put under my name...

thanks for the help...  hopefully my webhost pulls it's head out of it's arse and upgrades...

Re: error with admin_index.php

Is it only the script admin_index.php that is giving you problems? I.e. does admin_options.php and admin_permissions.php work?

"Programming is like sex: one mistake and you have to support it for the rest of your life."

16

Re: error with admin_index.php

yup...

Only admin_index.php

Everything else seems to be working fine now..  except for that..

Re: error with admin_index.php

Ok, I honestly have no idea why it only occurs in that script. However, you can try commenting out the version query as well (line 92). If you still get an error, you can comment out the whole block of code below that. The code that strarts with "if ($db_type == 'mysql')".

"Programming is like sex: one mistake and you have to support it for the rest of your life."

18

Re: error with admin_index.php

*update*

I've updated from 1.1.2 to 1.1.3..  same error..

1.1.3 to 1.1.4 same thing. tongue

I haven't yet tried the work around above..  I will when I get a chance.

19

Re: error with admin_index.php

I am having the same error and will block out all that code, but is there a better fix for the connection issue?

Thanks,
Tim

Re: error with admin_index.php

BreCalmor: First, we need to figure out why there is a connection issue in that code. It's very odd.

"Programming is like sex: one mistake and you have to support it for the rest of your life."

21 (edited by pogenwurst 2005-09-04 19:18)

Re: error with admin_index.php

An error was encountered
File: /mnt/web_g/d20/s22/a000skup/www/awesome/forum/admin_index.php
Line: 96

PunBB reported: Unable to fetch online count

Database reported: Lost connection to MySQL server during query (Errno: 2013)

That's from 1.2.7; I had that error with 1.2.6 too.
Also using Netfirms. From my own experience, they have good tech support. I don't really care much, I can just change the navbar link to admin_options.php, but I'll email Netfirms if you want me to Rickard. Just tell me what I should say.

Looking for a certain modification for your forum? Please take a look here before posting.

22 (edited by Usayd 2005-11-29 17:50)

Re: error with admin_index.php

Hi

I also have this problem (running 1.2.10) on netfirms. ^^ From my experience they have very bad support but I will also contact them.

No one found a fix then?

Update: I contacted Netfirms in request of an upgrade. (This isn't the first time i've requested something though...)

23

Re: error with admin_index.php

Ditch Netfirms, if you want punBB.   And believe me, it's worth it! smile

phpwebhosting.com is decent, and punbb works very well there..   and it's not too bad for the features it gives you, and the price! smile

24

Re: error with admin_index.php

farooq - in all honesty I already have ditched Netfirms - but for the use of Wordpress (mod_rewrite not availiable on netfirms!) and now this...I still have the account on there, but I'm slowly edging my other sites away .

25

Re: error with admin_index.php

I think any hosting provider that doesn't give you the ability to use an .htaccess file is in the dark ages.

mod_rewrite is more often than not the only way to make urls nice looking. I also like to be able to alter the default PHP values, like turn register_globals off, etc.

The more I look at shared hosting, the more I'm inclined towards a VPS.