Currently Viewing Posts in phpBB Mod & Tips

How to setup Gmail in phpBB 3.2.x in 2019?

I wrote a post long time ago about how to use Gmail with phpBB 3. Now it is 2019. It may get error with the same settings. It is not because my guide is wrong. Actually Google add more security protection on its Gmail facility.

Let me review the settings.

1) Make sure your Gmail account (Google Apps account) is working properly.

Sample below:

Gmail account: myname@gmail.com

Gmail password: 123456

You can sign in your Gmail from the browser, Chrome or Firefox, etc.

2) Enable POP

Forwarding and POP / IMAP. Under POP Download, click either Enable POP for all Mail, or Enable POP for Mail that Arrives Now (which ever suits your purpose). Configure anything else that appeals to you too. Exit from the Gmail Settings Window after saving your selections (this is important).

3) Settings in phpBB 3.2.x

Login the phpBB administrator panel.
Goto General Admin > Configuration > Email Settings
SMTP Server Address:tls://smtp.gmail.com
SMTP Ports: 465
Authentication method for SMTP: PLAIN
SMTP Username: myname@gmail.com
SMTP Password: 123456

After the above three steps, try to send email by forget password or register a new user.

Check the error log on the phpBB Admin panel.

There are may be erro 535 or error 534. The error looks like below:

Error 535

Email 错误
» EMAIL/SMTP
/forum/ucp.php

Ran into problems sending email at Line 1662. Response: 535 5.7.8 https://support.google.com/mail/?p=BadCredentials q128sm62190489pga.60 - gsmtp
.
Backtrace

Connecting to tls://smtp.gmail.com:465
LINE: 1205 <- 220 smtp.gmail.com ESMTP q128sm62190489pga.60 - gsmtp

# EHLO freesat.cn
LINE: 1552 <- 250-smtp.gmail.com at your service, [165.227.55.7]

LINE: 1552 <- 250-SIZE 35882577

LINE: 1552 <- 250-8BITMIME

LINE: 1552 <- 250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH

LINE: 1552 <- 250-ENHANCEDSTATUSCODES

LINE: 1552 <- 250-PIPELINING

LINE: 1552 <- 250-CHUNKING

LINE: 1552 <- 250 SMTPUTF8

# AUTH PLAIN
LINE: 1655 <- 334

# Omitting sensitive information
LINE: 1662 <- 535-5.7.8 Username and Password not accepted. Learn more at

LINE: 1662 <- 535 5.7.8 https://support.google.com/mail/?p=BadCredentials q128sm62190489pga.60 - gsmtp 

Error 534

Email 错误
» EMAIL/SMTP
/forum/ucp.php

Ran into problems sending email at Line 1662. Response: 534 5.7.14 https://support.google.com/mail/answer/78754 c3sm70133058pfg.88 - gsmtp
.
Backtrace

Connecting to tls://smtp.gmail.com:465
LINE: 1205 <- 220 smtp.gmail.com ESMTP c3sm70133058pfg.88 - gsmtp

# EHLO freesat.cn
LINE: 1552 <- 250-smtp.gmail.com at your service, [165.227.55.7]

LINE: 1552 <- 250-SIZE 35882577

LINE: 1552 <- 250-8BITMIME

LINE: 1552 <- 250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH

LINE: 1552 <- 250-ENHANCEDSTATUSCODES

LINE: 1552 <- 250-PIPELINING

LINE: 1552 <- 250-CHUNKING

LINE: 1552 <- 250 SMTPUTF8

# AUTH PLAIN
LINE: 1655 <- 334

# Omitting sensitive information
LINE: 1662 <- 534-5.7.14 <https://accounts.google.com/signin/continue?sarp=1&scc=1&plt=AKgnsbvN

LINE: 1662 <- 534-5.7.14 oQL0Oh8c3yyrQ3pFWK8OSPe0ZeGUxF2IhoMTilIFwIhrm23Gh3AzeyJieBixBumfmLEUcK

LINE: 1662 <- 534-5.7.14 8uGA3j9f8ivM_fTF4QTY7IjShfbixidMFTu6snmNH9dGueiZpHaWPcVtrUFLGIQqhSVSl7

LINE: 1662 <- 534-5.7.14 wxVGeVOzTzQnsRZbpMRXhyL1L6dmZbpzwZhRrQPbmg_MzYMtjzW7UwBT> Please log

LINE: 1662 <- 534-5.7.14 in via your web browser and then try again.

LINE: 1662 <- 534-5.7.14 Learn more at

LINE: 1662 <- 534 5.7.14 https://support.google.com/mail/answer/78754 c3sm70133058pfg.88 - gsmtp

At this point, you should go to change the settings of your Gmail or Google account.

4) Settings at Google

Enable less secure apps to access account

Sign in to your Google account

Click Security

On the bottom of the page, in the Less secure app access panel, click Turn on access.

 

Unlock Captcha

Sign in to your Google account

Open https://accounts.google.com/DisplayUnlockCaptcha link and click button to unlock Captcha

Now, the Gmail can handle the mailing from phpBB without errors.

 

SphinxSearch WARNING: word overrun buffer, clipped!!!

It is a warning information when the cronjob running every night.  This cronjob is used to update or re-index the phpBB powered forum, which is a Chinese forum.

The whole error is a kind of a list of warning with same problem.

WARNING: word overrun buffer, clipped!!!
clipped (len=126, word='请注意只有使用中国付款互联网付款服务支持的中国信用卡和借记卡才可以启动该话务中心的服')
original (len=126, word='请注意只有使用中国付款互联网付款服务支持的中国信用卡和借记卡才可以启动该话务中心的服')
WARNING: word overrun buffer, clipped!!!
clipped (len=126, word='我想不管你后面是因为衣服的问题还是喜欢不喜欢的问题应该不能退了如果当时店里的人已经告')
original (len=126, word='我想不管你后面是因为衣服的问题还是喜欢不喜欢的问题应该不能退了如果当时店里的人已经告')
WARNING: word overrun buffer, clipped!!!
clipped (len=126, word='新的网上申请表含有条形码而这些条形码将可以允许我们电子传输信息从而减少了签证申请过程')
original (len=126, word='新的网上申请表含有条形码而这些条形码将可以允许我们电子传输信息从而减少了签证申请过程')

How to solve the problem with the overrun buffer warning?

Continue reading “SphinxSearch WARNING: word overrun buffer, clipped!!!”

How to use Sphinx Search Engine on phpBB 3.1.6

This how-to is made on Centos6.7 64bit. It is a phpBB forum in Chinese with more than 680K posts. If I use phpBB native Fulltext or MySQL Fulltext search, the search tables are over 1.4GB. Too big. And it is very slow when do the search.

Now, my solution is use Sphinx Search Engine.

Step 1)

SSH to VPS as root

yum install sphinx

Step 2)

Sign in with Administrator account in phpBB 3.1.6, and sign in again to ACP

General >> Search settings

Choose Sphinx Fulltext from the Search backend list. Save.

Step 3)

In SSH window, edit /etc/sphinx/sphinx.conf

Add following into sphinx.conf to replace the original sample content. These content is copied from the Step 2 screen.


source source_phpbb_669b8066d06af641_main
{
type = mysql # mysql or pgsql
sql_host = localhost # SQL server host sphinx connects to
sql_user = [dbuser]
sql_pass = [dbpassword]
sql_db = fromchinatousa31x
sql_port =  # optional, default is 3306 for mysql and 5432 for pgsql
sql_query_pre = SET NAMES 'utf8'
sql_query_pre = UPDATE phpbb_sphinx SET max_doc_id = (SELECT MAX(post_id) FROM phpbb_posts) WHERE counter_id = 1
sql_query_range = SELECT MIN(post_id), MAX(post_id) FROM phpbb_posts
sql_range_step = 5000
sql_query = SELECT \
p.post_id AS id, \
p.forum_id, \
p.topic_id, \
p.poster_id, \
p.post_visibility, \
CASE WHEN p.post_id = t.topic_first_post_id THEN 1 ELSE 0 END as topic_first_post, \
p.post_time, \
p.post_subject, \
p.post_subject as title, \
p.post_text as data, \
t.topic_last_post_time, \
0 as deleted \
FROM phpbb_posts p, phpbb_topics t \
WHERE \
p.topic_id = t.topic_id \
AND p.post_id >= $start AND p.post_id <= $end
sql_query_post =
sql_query_post_index = UPDATE phpbb_sphinx SET max_doc_id = $maxid WHERE counter_id = 1
sql_query_info = SELECT * FROM phpbb_posts WHERE post_id = $id
sql_attr_uint = forum_id
sql_attr_uint = topic_id
sql_attr_uint = poster_id
sql_attr_uint = post_visibility
sql_attr_bool = topic_first_post
sql_attr_bool = deleted
sql_attr_timestamp = post_time
sql_attr_timestamp = topic_last_post_time
sql_attr_string = post_subject
}
source source_phpbb_669b8066d06af641_delta : source_phpbb_669b8066d06af641_main
{
sql_query_pre =
sql_query_range =
sql_range_step =
sql_query = SELECT \
p.post_id AS id, \
p.forum_id, \
p.topic_id, \
p.poster_id, \
p.post_visibility, \
CASE WHEN p.post_id = t.topic_first_post_id THEN 1 ELSE 0 END as topic_first_post, \
p.post_time, \
p.post_subject, \
p.post_subject as title, \
p.post_text as data, \
t.topic_last_post_time, \
0 as deleted \
FROM phpbb_posts p, phpbb_topics t \
WHERE \
p.topic_id = t.topic_id \
AND p.post_id >=  ( SELECT max_doc_id FROM phpbb_sphinx WHERE counter_id=1 )
}
index index_phpbb_669b8066d06af641_main
{
path = /home/admin/sphinx-forum/index_phpbb_669b8066d06af641_main
source = source_phpbb_669b8066d06af641_main
docinfo = extern
morphology = none
stopwords =
min_word_len = 2
charset_type = utf-8
charset_table = U+FF10..U+FF19->0..9, 0..9, U+FF41..U+FF5A->a..z, U+FF21..U+FF3A->a..z, A..Z->a..z, a..z, U+0149, U+017F, U+0138, U+00DF, U+00FF, U+00C0..U+00D6->U+00E0..U+00F6, U+00E0..U+00F6, U+00D8..U+00DE->U+00F8..U+00FE, U+00F8..U+00FE, U+0100->U+0101, U+0101, U+0102->U+0103, U+0103, U+0104->U+0105, U+0105, U+0106->U+0107, U+0107, U+0108->U+0109, U+0109, U+010A->U+010B, U+010B, U+010C->U+010D, U+010D, U+010E->U+010F, U+010F, U+0110->U+0111, U+0111, U+0112->U+0113, U+0113, U+0114->U+0115, U+0115, U+0116->U+0117, U+0117, U+0118->U+0119, U+0119, U+011A->U+011B, U+011B, U+011C->U+011D, U+011D, U+011E->U+011F, U+011F, U+0130->U+0131, U+0131, U+0132->U+0133, U+0133, U+0134->U+0135, U+0135, U+0136->U+0137, U+0137, U+0139->U+013A, U+013A, U+013B->U+013C, U+013C, U+013D->U+013E, U+013E, U+013F->U+0140, U+0140, U+0141->U+0142, U+0142, U+0143->U+0144, U+0144, U+0145->U+0146, U+0146, U+0147->U+0148, U+0148, U+014A->U+014B, U+014B, U+014C->U+014D, U+014D, U+014E->U+014F, U+014F, U+0150->U+0151, U+0151, U+0152->U+0153, U+0153, U+0154->U+0155, U+0155, U+0156->U+0157, U+0157, U+0158->U+0159, U+0159, U+015A->U+015B, U+015B, U+015C->U+015D, U+015D, U+015E->U+015F, U+015F, U+0160->U+0161, U+0161, U+0162->U+0163, U+0163, U+0164->U+0165, U+0165, U+0166->U+0167, U+0167, U+0168->U+0169, U+0169, U+016A->U+016B, U+016B, U+016C->U+016D, U+016D, U+016E->U+016F, U+016F, U+0170->U+0171, U+0171, U+0172->U+0173, U+0173, U+0174->U+0175, U+0175, U+0176->U+0177, U+0177, U+0178->U+00FF, U+00FF, U+0179->U+017A, U+017A, U+017B->U+017C, U+017C, U+017D->U+017E, U+017E, U+0410..U+042F->U+0430..U+044F, U+0430..U+044F, U+4E00..U+9FFF
min_prefix_len = 0
min_infix_len = 0
}
index index_phpbb_669b8066d06af641_delta : index_phpbb_669b8066d06af641_main
{
path = /home/admin/sphinx-forum/index_phpbb_669b8066d06af641_delta
source = source_phpbb_669b8066d06af641_delta
}
indexer
{
mem_limit = 40M
}
searchd
{
compat_sphinxql_magics = 0
listen = 127.0.0.1:9312
log = /home/admin/sphinx-forum/log/searchd.log
query_log = /home/admin/sphinx-forum/log/sphinx-query.log
read_timeout = 5
max_children = 30
pid_file = /home/admin/sphinx-forum/searchd.pid
max_matches = 20000
binlog_path = /home/admin/sphinx-forum/
}

Continue reading “How to use Sphinx Search Engine on phpBB 3.1.6”

Dirty Hack: Add CDN support into phpBB 3.1.6

It works for phpBB 3.1.x, not just phpBB 3.1.6. For a national forum or global forum, it is a must to have a CDN support.

The way I used is not a formal extension or plugin. It is a hack, actually a dirty hack. If you have no experience for it, you can close this page now.

Now, let’s start.

  1. Backup everything of your phpBB, include files and database.\
  2. URL path example.
    Forum url is http://www.myforum.com/
    CDN url is http://myforum.kxcdn.com/
  3.  Open /includes/functions.php
    add following in line 5112

    // Add CDN path
    $cdn_cache = '//myforum.kxcdn.com/';

    Find following around Line 5216

    'T_ASSETS_PATH'         => "{$web_path}assets",
    'T_THEME_PATH'         => "{$web_path}styles/" . rawurlencode($user->style['style_path']) . '/theme',
    'T_TEMPLATE_PATH'      => "{$web_path}styles/" . rawurlencode($user->style['style_path']) . '/template',
          

    Replace by

    'T_ASSETS_PATH'         => $cdn_cache."assets",
    'T_THEME_PATH'         => $cdn_cache."styles/" . rawurlencode($user->style['style_path']) . '/theme',
    'T_TEMPLATE_PATH'      => $cdn_cache."styles/" . rawurlencode($user->style['style_path']) . '/template',

    Find following around Line 5230

    'T_STYLESHEET_LINK'      => "{$web_path}styles/" . rawurlencode($user->style['style_path']) . 'https://d22rw8pyewxbkl.cloudfront.net/theme/stylesheet.css' . $config['assets_version'],
    'T_STYLESHEET_LANG_LINK'    => "{$web_path}styles/" . rawurlencode($user->style['style_path']) . '/theme/' . $user->lang_name . 'https://d22rw8pyewxbkl.cloudfront.net/stylesheet.css' . $config['assets_version'],

    Replace by

    'T_STYLESHEET_LINK'      => $cdn_cache."styles/" . rawurlencode($user->style['style_path']) . 'https://d22rw8pyewxbkl.cloudfront.net/theme/stylesheet.css' . $config['assets_version'],
    'T_STYLESHEET_LANG_LINK'    => $cdn_cache."styles/" . rawurlencode($user->style['style_path']) . '/theme/' . $user->lang_name . 'https://d22rw8pyewxbkl.cloudfront.net/stylesheet.css' . $config['assets_version'],

    Save and overwrite the original file.

  4.   Open /includes/functions_content.php
    Find following around Line 902

    return preg_replace('#<!\-\- s(.*?) \-\-><img src="\{SMILIES_PATH\}\/(.*?) \/><!\-\- s\1 \-\->#', '<img class="smilies" src="' . $root_path . $config['smilies_path'] . '/\2 />', $text);

    Replace by

    return preg_replace('#<!\-\- s(.*?) \-\-><img src="\{SMILIES_PATH\}\/(.*?) \/><!\-\- s\1 \-\->#', '<img class="smilies" src="' .'//forum.kxcdn.com/forum/'.$root_path. $config['smilies_path'] . '/\2 />', $text);

    Save and overwrite the old file.

  5. Then purge cache in the ACP.

Look at the waterfall chat after this hack.

cdn-phpbb-hack

The CDN service provider is KEYCDN. You can apply through this link.

The way to fix the problem when Upgrade phpBB 3.1.1

It is so fast, phpBB 3.1.1 released.

I did meet the problem when I tried to upgrade my phpBB 3.0.12 to 3.1.0 or 3.1.1. Same problem here.

One is mentioned in the previous post.

Request-URI Too Large when updating

I copied the URI when this error came. I found the URI is so long. More than 8190 characters.

So, I tried to change it to 11000. Restart the Apache server.

LimitRequestLine 11000

It works. And this error doesn’t come back.

 

Later, during the process of preparing the merged file, another error shown as below.

Bad Request 
Your browser sent a request that this server could not understand. 
Size of a request header field exceeds serv

I thought it is a simlar error as the first one. So I google it and add the limit .

LimitRequestFieldSize 16380

 

Continue reading “The way to fix the problem when Upgrade phpBB 3.1.1”

Errors when upgrade phpBB 3.0.12 to phpBB3.1

I am going to upgrade my forums which are powered by phpBB.  The package I downloaded is automatic upgrade package. phpBB-3.0.12–3.1.0.zip

One is small forum, with most of the default settings. When I upgrade it as old way, the error came as below:

Fatal error: Composer dependencies have not been set up yet

Laterly, I found I just uploaded the folder “install”. The thing I missed is folder “vendor”.

Then, I uploaded both install and vendor folders to my forum root directory.

This error is gone and following upgrade procedures are smooth.

 

Continue reading “Errors when upgrade phpBB 3.0.12 to phpBB3.1”

How to Install a Mobile Style on phpBB 3

It is based on phpBB 3.0.11. I checked the Google Analytics report. There are about 20% users using cellphone or iPad.
To accommodate these users, I installed a mobile style on it and added the Mobile device detection facilitate.

There are 4 steps to install it. Very easy.

Step 1
Download the Style package and unzip it.
Blue/Orange style
Unzip it and the folder structure looks like below.
art-mobile-blue

Step 2
Upload all files unziped into the Styles folder on server.

Continue reading “How to Install a Mobile Style on phpBB 3”

Add Advanced BBcode Box 3 for phpBB 3

I have a forum powered by phpBB3.0.7 PL1. It works great. Even I added so many mods and some my customized changes on it, it still has room to improve.

Last week, it took me about two hours to add Advanced BBcode Box 3.
You can find it and download it here.

After installation, the edit box looks like following:

abbcodeb3

Let me describe the steps I took to add it.

1) Backup, backup, backup.
The most important things before doing any major changes is BACKUP.
Backup all files under phpbb by command tar.
Backup mysql database, though command mysqldump. It is about 1GB big.

2) Ftp the backup file to other place for safe.

3) Download Advanced BBcode Box 3 package from the link above.

Continue reading “Add Advanced BBcode Box 3 for phpBB 3”

When phpBB 3.1 release

Right now, latest version of phpBB is 3.0.7 PL1. The features of the next version 3.1 freeze on July 20, 2010. So what is the exact date to release it.
The following are features or changes on phpBB 3.1
Merged:
* Coding Guideline Modifications RFC Ticket
* Autoloading & Class Naming Convention RFC Ticket
* Removal of subsilver2 RFC Ticket
Patch in progress:
* Improved Page Titles RFC Ticket
* Avatar improvements, Gravatar RFC Ticket
* Improved template engine RFC Ticket
* SQLite 3.0+ Support RFC Ticket
* Updated BBcode engine RFC
* Request Class RFC Ticket
* Switch to PHP timezone handling RFC Ticket
* Modular Cron RFC Ticket
* General Hook Architecture RFC Ticket
* Resume support for attachments / HTTP range support RFC Ticket
* Soft Delete RFC Ticket
* Enhanced Team Page RFC Ticket
* Improve User Pruning feature RFC Ticket
* Rename MSNM to WLM RFC Ticket
* Link global announcements to forumsRFC Ticket
* Simple message API RFC Ticket
* Attachments Management RFC Ticket
* MOD Installer RFC Ticket
* Cleaning up the ACP UI RFC Ticket
* No db storage of themes and stylesheets RFC Ticket
RFC only:
* Migrations (UMIL) RFC Ticket Data Providers RFC
* Changing IP banning to use ‘longest prefix matching’ RFC Ticket
* Ability to delete auto login keys RFC Ticket
* Authentication Plugin Refactoring, User Integration & OpenID RFC Ticket
* Session Backend Abstraction (memcache support) RFC Ticket
* Search Backend Refactoring RFC Ticket
* Pre-Compile Template Includes RFC
* Overridable imageset and theme paths for CDNs RFC

Continue reading “When phpBB 3.1 release”

How to upgrade phpBB 3.0.4 to phpBB3.0.5

To upgrade phpBB properly without problem, I make a detailed upgrading plan. I would like to share it with you.
1. Disable forum board.
It is important to make the board clean. And keep resource usage low.
2. Backup
The most important part is backup.
2.1. Database backup
2.1.1. phpBB own tools
Admin Control Panel > Maintenance > Backup
Complete backup with gzip, including all tables, save and download.
(if your board has a lot of posts, the index table is very big. I prefer to clean the index first. Just like me, index table is about 200MB)
2.1.2. phpMyAdmin tool
Login your own phpMyAdmin web tool for MySQL database. Select your database and click Export all tables. My exported file is about 50MB.
2.2. Backup all phpBB 3.0.4 files.
SSH your host.

tar czvf forum.tar.gz ~/your.forum/

3. Download “Automatic Update Package”.
For upgrade, I like this package. It can merge your previous changes or mod on you old phpBB when doing upgrading.

cd ~/source/
wget the package.
tar xjf phpBB-3.0.4_to_3.0.5.tar.bz2
cp -r ./install/ ~/your.forum/

4. Upgrade
http://your.forum/install/
start upgrade following the upgrading wizard.
After it. Rename the install folder or delete it.
Enable the board.
Done.

  • Archives