Upgrade problem

Get help with installation and running phpBB 3.0.x here. Please do not post bug reports, feature requests, or MOD-related questions here.
Scam Warning
User avatar
busterkat
Registered User
Posts: 55
Joined: Wed May 14, 2008 11:30 pm
Contact:

Upgrade problem

Postby busterkat » Sun Nov 22, 2009 12:53 am

Support Request Template
What version of phpBB are you using? phpBB 3.0.6
What is your board's URL? http://pcvstdog.com/forum
Who do you host your board with? the planet
How did you install your board? I used the download package from phpBB.com
Is your board a fresh install or a conversion? upgrade from 3.0.4
Do you have any MODs installed? No
Is registration required to reproduce this issue? No
What board software did you convert from? 3.0.4
What styles do you currently have installed? prosilver
What language(s) is your board currently using? english
Which database type/version are you using? MySQL 5
What is your level of experience? New to PHP but not phpBB
When did your problem begin? after upgrading from 3.0.4 to 3.0.6
Please describe your problem. after the second upload I get this:
Fatal error: Cannot redeclare set_config_count() (previously declared in /includes/functions.php:171) in /forum/includes/functions.php on line 228
Generated by SRT Generator ($Rev: 3396 $)

Code: Select all

* Set dynamic config value with arithmetic operation.
*/
function set_config_count($config_name, $increment, $is_dynamic = false)
{
   global $db, $cache;

   switch ($db->sql_layer)
   {
      case 'firebird':
         $sql_update = 'CAST(CAST(config_value as integer) + ' . (int) $increment . ' as CHAR)';
      break;

      case 'postgres':
         $sql_update = 'int4(config_value) + ' . (int) $increment;
      break;

      // MySQL, SQlite, mssql, mssql_odbc, oracle
      default:
         $sql_update = 'config_value + ' . (int) $increment;
      break;
   }

   $db->sql_query('UPDATE ' . CONFIG_TABLE . ' SET config_value = ' . $sql_update . " WHERE config_name = '" . $db->sql_escape($config_name) . "'");

   if (!$is_dynamic)
   {
      $cache->destroy('config');
   }
}

/**
* Set dynamic config value with arithmetic operation.
*/
function set_config_count($config_name, $increment, $is_dynamic = false)
{
   global $db, $cache;

   switch ($db->sql_layer)
   {
      case 'firebird':
         $sql_update = 'CAST(CAST(config_value as integer) + ' . (int) $increment . ' as VARCHAR(255))';
      break;

      case 'postgres':
         $sql_update = 'int4(config_value) + ' . (int) $increment;
      break;

      // MySQL, SQlite, mssql, mssql_odbc, oracle
      default:
         $sql_update = 'config_value + ' . (int) $increment;
      break;
   }

   $db->sql_query('UPDATE ' . CONFIG_TABLE . ' SET config_value = ' . $sql_update . " WHERE config_name = '" . $db->sql_escape($config_name) . "'");

   if (!$is_dynamic)
   {
      $cache->destroy('config');
   }
}

/**

User avatar
narqelion
I've Been Banned!
Posts: 7235
Joined: Sat Dec 13, 2008 5:00 pm
Contact:

Re: Upgrade problem

Postby narqelion » Sun Nov 22, 2009 4:57 am

busterkat wrote:after the second upload I get this:
Second upload? Are you using Automatic update?
You reported having no MOD's,
busterkat wrote:Do you have any MODs installed? No
so if that is correct and you do not have any there is an easier way to update.

User avatar
busterkat
Registered User
Posts: 55
Joined: Wed May 14, 2008 11:30 pm
Contact:

Re: Upgrade problem

Postby busterkat » Sun Nov 22, 2009 8:36 am

Hi-
I didn't use auto. I always get a connection error.

After I ran the update first time I rechecked and got another download.

I have never done an upgrade problem free...

User avatar
Paul
Extensions Team Member
Extensions Team Member
Posts: 19076
Joined: Sat Dec 04, 2004 3:44 pm
Location: The netherlands.
Name: Paul Sohier
Contact:

Re: Upgrade problem

Postby Paul » Sun Nov 22, 2009 10:19 am

As you have no MODs, use the steps below to update your board instead:

*NOTE: Before proceeding backup all files and the database.*
  • Upload all new files from a download of the full version, except for config.php, the /images and /files folders.
  • Go to yoursite.com/forumfolder/install/database_update.php
  • Let that run and then delete the install folder.
  • You now have a new up to date board containing all your users and posts but without any MODs that you might have had installed.
Knock knock
Race condition
Who's there?

User avatar
D¡cky
Former Team Member
Posts: 11812
Joined: Tue Jan 25, 2005 8:38 pm
Location: New Hampshire, USA
Name: Richard Foote
Contact:

Re: Upgrade problem

Postby D¡cky » Tue Nov 24, 2009 12:13 am

Somehow the updater inserted a new function config_count() instead of updating the original function.

You need to remove the first function config_count() which is incorrect and leave the second function config_count(). The change is supposed to be:
FIND

Code: Select all

$sql_update = 'CAST(CAST(config_value as integer) + ' . (int) $increment . ' as CHAR)';

REPLACE WITH

Code: Select all

$sql_update = 'CAST(CAST(config_value as integer) + ' . (int) $increment . ' as VARCHAR(255))';


To fix:
OPEN includes/functions.php
Remove lines 168-197

Code: Select all

/**
* Set dynamic config value with arithmetic operation.
*/
function set_config_count($config_name, $increment, $is_dynamic = false)
{
   global $db, $cache;

   switch ($db->sql_layer)
   {
      case 'firebird':
         $sql_update = 'CAST(CAST(config_value as integer) + ' . (int) $increment . ' as CHAR)';
      break;

      case 'postgres':
         $sql_update = 'int4(config_value) + ' . (int) $increment;
      break;

      // MySQL, SQlite, mssql, mssql_odbc, oracle
      default:
         $sql_update = 'config_value + ' . (int) $increment;
      break;
   }

   $db->sql_query('UPDATE ' . CONFIG_TABLE . ' SET config_value = ' . $sql_update . " WHERE config_name = '" . $db->sql_escape($config_name) . "'");

   if (!$is_dynamic)
   {
      $cache->destroy('config');
   }
}
Have you hugged someone today?

User avatar
busterkat
Registered User
Posts: 55
Joined: Wed May 14, 2008 11:30 pm
Contact:

Re: Upgrade problem

Postby busterkat » Tue Nov 24, 2009 6:29 am

Thanks Dicky-

I did that and now get a blank page!!

User avatar
D¡cky
Former Team Member
Posts: 11812
Joined: Tue Jan 25, 2005 8:38 pm
Location: New Hampshire, USA
Name: Richard Foote
Contact:

Re: Upgrade problem

Postby D¡cky » Tue Nov 24, 2009 7:28 pm

It could be that you made a mistake when deleting or another file is corrupted.

If you want to paste lines 150-205 of functions.php (which includes function set_config_count and a few lines before and after), I will check it.
Have you hugged someone today?

User avatar
busterkat
Registered User
Posts: 55
Joined: Wed May 14, 2008 11:30 pm
Contact:

Re: Upgrade problem

Postby busterkat » Tue Nov 24, 2009 8:52 pm

Thankyou

Here it is

Code: Select all

/**
* Set config value. Creates missing config entry.
*/
function set_config($config_name, $config_value, $is_dynamic = false)
{
   global $db, $cache, $config;

   $sql = 'UPDATE ' . CONFIG_TABLE . "
      SET config_value = '" . $db->sql_escape($config_value) . "'
      WHERE config_name = '" . $db->sql_escape($config_name) . "'";
   $db->sql_query($sql);

   if (!$db->sql_affectedrows() && !isset($config[$config_name]))
   {
      $sql = 'INSERT INTO ' . CONFIG_TABLE . ' ' . $db->sql_build_array('INSERT', array(
         'config_name'   => $config_name,
         'config_value'   => $config_value,
         'is_dynamic'   => ($is_dynamic) ? 1 : 0));
      $db->sql_query($sql);
   }

   $config[$config_name] = $config_value;

   if (!$is_dynamic)
   {
      $cache->destroy('config');
   }
}

/**
* Set dynamic config value with arithmetic operation.
*/
function set_config_count($config_name, $increment, $is_dynamic = false)
{
   global $db, $cache;

   switch ($db->sql_layer)
   {
      case 'firebird':
         $sql_update = 'CAST(CAST(config_value as integer) + ' . (int) $increment . ' as VARCHAR(255))';
      break;

      case 'postgres':
         $sql_update = 'int4(config_value) + ' . (int) $increment;
      break;

      // MySQL, SQlite, mssql, mssql_odbc, oracle
      default:
         $sql_update = 'config_value + ' . (int) $increment;
      break;
   }

   $db->sql_query('UPDATE ' . CONFIG_TABLE . ' SET config_value = ' . $sql_update . " WHERE config_name = '" . $db->sql_escape($config_name) . "'");

   if (!$is_dynamic)
   {
      $cache->destroy('config');
   }
}


/**
* Generates an alphanumeric random string of given length
*/
function gen_rand_string($num_chars = 8)
{
   $rand_str = unique_id();
   $rand_str = str_replace('0', 'Z', strtoupper(base_convert($rand_str, 16, 35)));

   return substr($rand_str, 0, $num_chars);
}

/**
* Return unique id
* @param string $extra additional entropy
*/
function unique_id($extra = 'c')
{
   static $dss_seeded = false;
   global $config;

   $val = $config['rand_seed'] . microtime();
   $val = md5($val);
   $config['rand_seed'] = md5($config['rand_seed'] . $val . $extra);

   if ($dss_seeded !== true && ($config['rand_seed_last_update'] < time() - rand(1,10)))
   {
      set_config('rand_seed', $config['rand_seed'], true);
      set_config('rand_seed_last_update', time(), true);
      $dss_seeded = true;
   }

   return substr($val, 4, 16);
}


User avatar
D¡cky
Former Team Member
Posts: 11812
Joined: Tue Jan 25, 2005 8:38 pm
Location: New Hampshire, USA
Name: Richard Foote
Contact:

Re: Upgrade problem

Postby D¡cky » Wed Nov 25, 2009 5:18 am

The code you have posted is fine.

A blank page usually indicates a suppressed php error. To find what the error is, you will need to look at the php error log. Your host may have to help you locate this log if it is even available at all. If the log is not available, the alternative is to compare your files against a fresh set of phpBB 3.0.6 files to find the error or even simpler, if you have no MODs, would be to follow Paul's instructions and use a fresh set of new files.

I had experienced the same error you did and removing the duplicate function fixed the problem for me. I am thinking you may have another corrupted file.
Have you hugged someone today?

User avatar
busterkat
Registered User
Posts: 55
Joined: Wed May 14, 2008 11:30 pm
Contact:

Re: Upgrade problem

Postby busterkat » Wed Nov 25, 2009 6:20 am

What would I be looking for in the error log?

User avatar
D¡cky
Former Team Member
Posts: 11812
Joined: Tue Jan 25, 2005 8:38 pm
Location: New Hampshire, USA
Name: Richard Foote
Contact:

Re: Upgrade problem

Postby D¡cky » Wed Nov 25, 2009 7:59 pm

Not to meaning to be a smart alec, you will be looking for an error. The error log records errors made by php. In a perfect world, you won't have any errors and the error log will be empty.

The errors will be listed in chronological order. Look for the latest errors which should be around the time you last accessed your board.
Have you hugged someone today?

User avatar
busterkat
Registered User
Posts: 55
Joined: Wed May 14, 2008 11:30 pm
Contact:

Re: Upgrade problem

Postby busterkat » Thu Nov 26, 2009 6:01 am

Alec-

Looks like the error is coming from phpbb3portal files. I guess I should check with them


Code: Select all

[25-Nov-2009 14:20:32] PHP Warning:  include(/forumcommon.php) [<a href='function.include'>function.include</a>]: failed to open stream: No such file or directory in /home/xxxx/public_html/portal.php on line 22
[25-Nov-2009 14:20:32] PHP Warning:  include() [<a href='function.include'>function.include</a>]: Failed opening '/forumcommon.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/xxxx/public_html/portal.php on line 22
[25-Nov-2009 14:20:32] PHP Warning:  include(/portal/includes/functions.php) [<a href='function.include'>function.include</a>]: failed to open stream: No such file or directory in /home/xxxx/public_html/portal.php on line 23
[25-Nov-2009 14:20:32] PHP Warning:  include() [<a href='function.include'>function.include</a>]: Failed opening '/portal/includes/functions.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/xxxx/public_html/portal.php on line 23
[25-Nov-2009 14:20:32] PHP Fatal error:  Call to a member function session_begin() on a non-object in /home/xxxx/public_html/portal.php on line 26
[25-Nov-2009 18:39:36] PHP Warning:  include(/forumcommon.php) [<a href='function.include'>function.include</a>]: failed to open stream: No such file or directory in /home/xxxx/public_html/portal.php on line 22
[25-Nov-2009 18:39:36] PHP Warning:  include() [<a href='function.include'>function.include</a>]: Failed opening '/forumcommon.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/xxxx/public_html/portal.php on line 22
[25-Nov-2009 18:39:36] PHP Warning:  include(/portal/includes/functions.php) [<a href='function.include'>function.include</a>]: failed to open stream: No such file or directory in /home/xxxx/public_html/portal.php on line 23
[25-Nov-2009 18:39:36] PHP Warning:  include() [<a href='function.include'>function.include</a>]: Failed opening '/portal/includes/functions.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/xxxx/public_html/portal.php on line 23
[25-Nov-2009 18:39:36] PHP Fatal error:  Call to a member function session_begin() on a non-object in /home/xxxx/public_html/portal.php on line 26


Return to “3.0.x Support Forum”

Who is online

Users browsing this forum: Bing [Bot] and 54 guests