Common problems while updating

Get help with installation and running phpBB 3.1.x here. Please do not post bug reports, feature requests, or extension related questions here.
Anti-Spam Guide
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

NOTE: phpBB 3.1.x is at its End of Life stage and support will NOT be provided after July 1st, 2018.
Locked
User avatar
Noxwizard
Support Team Leader
Support Team Leader
Posts: 10552
Joined: Mon Jun 27, 2005 8:41 pm
Location: Texas, USA
Name: Patrick Webster
Contact:

Common problems while updating

Post by Noxwizard »

Problem: Unsupported version of PHP #
If your PHP version is not greater than PHP 5.3.3, you will be unable to run phpBB 3.1.0. If you are running an unsupported version, you will see an error similar to this:

Code: Select all

Unexpected character in input: '\' (ASCII=92) state=1
Solution:
Update your version of PHP to 5.3.3 or higher. You may need to ask your host to do this or simply toggle a setting in your website's control panel.


Problem: Malformed links when "Links Opening New Windows" KB article used from 3.0 #
If you applied the changes from Knowledge Base - Links Opening New Windows, then your links will be malformed when you attempt to edit posts after updating to 3.1.x.

Solution:
The following script will reset links that were modified to open in an external window. As with all database updates, please create a backup of your database first.
Create a text file called fix.php with the following in it:

Code: Select all

<?php
define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
still_on_time();

$batch_size = 100;

$sql = 'SELECT COUNT(post_id) as cnt
    FROM ' . POSTS_TABLE . ' 
    WHERE post_text ' . $db->sql_like_expression($db->get_any_char() . 'onclick="window.open(this.href);return false;"' . $db->get_any_char());
$result = $db->sql_query($sql);
$affected = (int) $db->sql_fetchfield('cnt');

if (set_time_limit(0))
{
    echo 'Successfully disabled execution time<br />';
}
else
{
    echo 'Unable to disable execution time limit. You may need to run this script again.<br />';
}
echo '<br />';
echo 'Updates needed: ' . $affected . '<br />';
echo 'Running updates in batches of ' . $batch_size . '<br />';

flush();

// Counting basically holds the amount of rows processed.
$counting = -1;
$batch_time = 0;

$patterns = array(
    '#<!\-\- l \-\-><a (class="[\w-]+" )?href="([^"]*)" onclick="window\.open\(this\.href\);return false;">([^<]*)</a><!\-\- l \-\->#',
    '#<!\-\- ([mw]) \-\-><a (class="[\w-]+" )?href="([^"]*)" onclick="window\.open\(this\.href\);return false;">([^<]*)</a><!\-\- \1 \-\->#',
);

$replacements = array(
    '<!-- l --><a \1 href="\2">\3</a><!-- l -->',
    '<!-- \1 --><a \2 href="\3">\4</a><!-- \1 -->',
);

$_sql = 'SELECT post_id, post_text 
    FROM ' . POSTS_TABLE . ' 
    WHERE post_text ' . $db->sql_like_expression($db->get_any_char() . 'onclick="window.open(this.href);return false;"' . $db->get_any_char());

$skip_rows = 0;
while ($counting === -1 || ($counting >= $batch_size && still_on_time()))
{
    $result = $db->sql_query_limit($_sql, $batch_size, $skip_rows);
    
    // Now handle the rows until time is over or no more rows to process...
    $counting = 0;
    while ($counting === 0 || still_on_time())
    {
        $row = $db->sql_fetchrow($result);
        if (!$row)
        {
            // move to the next batch
            break;
        }

        $message = preg_replace($patterns, $replacements, $row['post_text']);

        $sql_update = array(
            'post_text'        => $message,
            'post_checksum'    => md5($message),
        );
        
        $sql = 'UPDATE ' . POSTS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_update) . ' WHERE post_id = ' . $row['post_id'];
        $db->sql_query($sql);

        $counting++;
        $skip_rows++;
    }
    $db->sql_freeresult($result);
}

if (still_on_time() && $counting < $batch_size)
{
    echo 'Finished processing ' . $skip_rows . ' rows.';
    exit;
}
else
{
    echo 'Rows completed: ' . $skip_rows . '<br />Rows remaining: ' . ($affected - $skip_rows) . '<br /><br />This script will resume in 5 seconds';
    echo '<meta http-equiv="refresh" content="5;" />';
}
Upload this file to your forum's root (the same place where config.php is located) and point your browser to it. If the script times out, simple refresh the page. At the end, it will say "Finished processing".


Problem: Conflict encountered while updating to 3.1.5 #
If you updated your board from 3.1.3 to 3.1.4 using the automated update package and now attempt to update your board from 3.1.4 to 3.1.5 using the automated update package yet again, you will see a conflict in the file difference calculation:
conflict.png
The conflict occurs because the automated update packages for 3.1.x to 3.1.4 were missing a change in the listed includes/acp/acp_prune.php file, because it consisted of whitespaces changes only. So in order to get the fix to your board we were forced to create a conflict by moving some lines around, to make sure the updater realises that your file is not yet up to date.

The correct way to resolve the conflict is to use either:
  • Option 3: Do not merge - use new file - HIGHLY RECOMMENDED or
  • Option 1: Merge modifications (removes modified code within conflicting block)
    This option should only be used when you have modifications installed in includes/acp/acp_prune.php.
To avoid the conflict you can also add the missing change manually before running the automated update:

open includes/acp/acp_prune.php find (line ~510):

Code: Select all

((!empty($user_ids)) ? 'AND ' . $db->sql_in_set('ug.user_id', $user_ids) : '') . '
replace with

Code: Select all

((!empty($user_ids)) ? ' AND ' . $db->sql_in_set('ug.user_id', $user_ids) : '') . '
find (line ~536):

Code: Select all

((!empty($user_ids)) ? 'AND ' . $db->sql_in_set('p.poster_id', $user_ids) : '') . '
replace with

Code: Select all

((!empty($user_ids)) ? ' AND ' . $db->sql_in_set('p.poster_id', $user_ids) : '') . '
The cause of the missing change has been identified and fixed in the packaging script, so it should not occur again in the future.



Fixed in 3.1.8
Problem: Users are not being removed from Newly Registered Users group after updating to/installing 3.1.7-PL1 #
There is a bug in 3.1.7-PL1 that prevents users from being automatically removed from the Newly Registered Users group.

Solution:
A patch level release will not be made, so this will not be officially fixed until 3.1.8. In the meantime, you can apply the patch that has already been accepted into the official repository: https://github.com/phpbb/phpbb/pull/4119/files

Open: phpBB/phpbb/session.php
Find: (line 1558)

Code: Select all

public function update_session_infos()
{
     global $db, $request; 
Find: (line 1560)

Code: Select all

global $db, $request; 
Replace with:

Code: Select all

global $config, $db, $request; 


Fixed in 3.1.2
Problem: Changes do not take effect, data lost moving between pages, etc.. #
After updating to 3.1.1, you may experience the following issues:
  • Actions requiring the use of a confirmation box do not work
  • Login redirects do not work (replying, quoting, administering user)
  • Redirects after making a post do not work properly
This is the result of an encoding issue (https://tracker.phpbb.com/browse/PHPBB3-13280) and will be fixed in 3.1.2.

Solution:
There is no solution yet, but some URLs can be corrected manually when you receive an error screen by replacing &amp%3B in the address bar with &.



Problem: Database Update does not complete #
When running the database updater (/install/database_update.php), you will need to advance the screen several times by pressing the "Continue database update" button at the bottom. At the very end, you will see "Database updater has completed!" indicating that the database update is complete. If your browser simply hangs, loads to only a white page, or shows an error like MySQL server has gone away, do the following:
  1. Download this file:
    migrator.php
    (20.14 KiB) Downloaded 1188 times
  2. Upload it to /phpbb/db/migrator.php. (Overwrite the existing one)
  3. Run /install/database_update.php

Fixed in 3.1.1
Problem: The board was converted while a custom style was active #
If your board was using a style other than prosilver, your users will encounter an error. Styles from 3.0 are not compatible and depending on your update method, may not exist at all after the upgrade. Possible errors that you may encounter are:

Code: Select all

General Error
SQL ERROR [ mysqli ]

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE user_id = 1' at line 3 [1064]

Code: Select all

SQL ERROR [ mysql4 ]

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 3 [1064]
Solution:
The following script will reset the board's default style to prosilver and reset all users' styles to it.
Create a text file called fix.php with the following in it:

Code: Select all

<?php
define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);

// Default style ID
$sql = 'SELECT config_value FROM ' . CONFIG_TABLE . " WHERE config_name = 'default_style'";
$result = $db->sql_query($sql);
$default_style_id = (int) $db->sql_fetchfield('config_value');
$db->sql_freeresult($result);

// Default style name
$sql = 'SELECT style_name FROM ' . STYLES_TABLE . ' WHERE style_id = ' . $default_style_id;
$result = $db->sql_query($sql);
$default_style_name = $db->sql_fetchfield('style_name');
$db->sql_freeresult($result);

// Active styles
$sql = 'SELECT style_id, style_name, style_active FROM ' . STYLES_TABLE;
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
    $styles_list[] = $row;
}
$db->sql_freeresult($result);


echo 'Default style: ' . $default_style_name . ' (' . $default_style_id . ')<br />';

$exists = file_exists('./styles/' . $default_style_name . '/style.cfg');

if ($exists)
{
    echo 'Default style exists, no work to be done.';
    exit;
}

if (!file_exists('./styles/prosilver/style.cfg'))
{
    echo 'Prosilver does not exist. Please upload a copy of prosilver from the <a href="https://www.phpbb.com/downloads/">3.1.0 Full Package</a>.';
    exit;
}

$prosilver = array();
foreach ($styles_list as $style)
{
    if ($style['style_name'] == 'prosilver')
    {
        $prosilver = $style;
        break;
    }
}

// Install style if it doesn't exist
if (!sizeof($prosilver))
{
    $sql_ary = array(
        'style_name'        => 'prosilver',
        'style_copyright'    => '&copy; phpBB Group',
        'style_active'        => 1,
        'style_path'        => 'prosilver',
        'bbcode_bitfield'    => 'lNg=',
        'style_parent_id'    => '0',
        'style_parent_tree'    => '',
    );

    $sql = 'INSERT INTO ' . STYLES_TABLE . '
        ' . $db->sql_build_array('INSERT', $sql_ary);
    $db->sql_query($sql);

    $id = $db->sql_nextid();
    $prosilver = array(
        'style_name'    => 'prosilver',
        'style_id'        => $id,
        'style_active'    => 1,
    );

    echo 'Installed prosilver (' . $id . ').<br />';
}
else
{
    // Activate prosilver
    $sql = 'UPDATE ' . STYLES_TABLE . " SET style_active = 1 WHERE style_name = 'prosilver'";
    $db->sql_query($sql);
}

// Set it as the default style
$sql = 'UPDATE ' . CONFIG_TABLE . ' SET config_value = ' . $prosilver['style_id'] . " WHERE config_name = 'default_style'";
$db->sql_query($sql);
$cache->purge();
echo 'Set prosilver as the default style.<br />';

// Set all users' styles to prosilver
$sql = 'UPDATE ' . USERS_TABLE . ' SET user_style = ' . $prosilver['style_id'];
$db->sql_query($sql);
echo 'Updated user styles to prosilver.<br />';
echo 'Done.';
?>
Upload this file to your forum's root (the same place where config.php is located) and point your browser to it. If the script runs without any errors, visit your board and you should see it load with prosilver. Delete this file when you are finished.
[Support Template] - [Read Before Posting] - [phpBB Knowledge Base]
Do not contact me for private support, please share the question in our forums.
Locked

Return to “[3.1.x] Support Forum”