phpBB upgrade 3.0.9 to 3.3 – 500 http errors fixed

I recently tried to upgrade a 4 year old phpBB forum to the latest version (3.3).

First: there is a lot of talk when you move from 3.0.x to 3.1/3.2. You need to download the support toolkit to clean up the existing board software because of major updates. So be sure the read those guidelines. For me this wasn’t an issue because my phpBB installation was one without any MODifications, special skins or additional language packs. I ran the support toolkit on my board anyway, but it didn’t do anything…

I took a shot at jumping from 3.0.9 straight ahead to the 3.3 installation, following the guide Upgrade from 3.0 to 3.2.

At step 12 problems started to occur when updating the database. The update program stopped multiple times at different stages. I solved this by deleting the install and production directory in the cache folder and running the update process again, and again, … and again, until it reached 100%.

At first glance the board seemed to function right away. But when browsing around, many 500 http errors were thrown. I tried deleting browser cache, removing production directory (cache folder) again, and again… but the problem persisted. I was unable to access the administration control area, etc…

I decided to take a look at the php error log and the one thing that kept popping up was:

Got error ‘PHP message: PHP Fatal error: Uncaught phpbb\exception\http_exception: Failure while aqcuiring locks. in /***/***/***/***/phpbb/lock/flock.php:106

When you have a look on the community board at phpBB customers from hosting company ‘STRATO’ run into the same problems. However, I’m not on STRATO hosting and from what I know my hosting also has a different setup.

The solution to fix is offered by IMC_ger: find in the file phpbb/lock/flock.php line 104.

Code

if (!@flock($this->lock_fp, LOCK_EX))

And replace:

if (!@flock($this->lock_fp, $mode == 'wb' ? LOCK_EX : LOCK_SH))

All 500 errors are gone now and the phpBB is fully operational.

Setting up PEAR mail on Scotch Box

You have Vagrant and Scotch Box installed. You still need to install Pear.

$ vagrant ssh
$ sudo apt-get -y install php-pear
$ sudo pear install mail_mime

In your PHP script

include_once('Mail.php');
include_once('Mail/mime.php');

Parameters to define SMTP Scotch Box

$params["host"] = "127.0.0.1";
$params["port"] = 1025;
$params["Date"] = date('r',time());
$mail = Mail::factory("smtp",$params);
...

Catch mails in Mailhog at http://192.168.33.10:8025

[SOLVED] XAMPP Row size too large, innoDB sql import

Ran into some problems recently with XAMPP. Exported a large mySQL production database and tried to import it locally in XAMPP (through Shell access).

Error: ERROR 1118 <42000> at line 437919: Row size too large <> 8126>. Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline.

First I tried changing table to ROW_FORMAT=COMPRESSED doing so:

ALTER TABLE <tablename>
    ENGINE=InnoDB
    ROW_FORMAT=COMPRESSED
    KEY_BLOCK_SIZE=8;

No success with that. Then I changed innodb_buffer_pool_size to 32MB (default setting was 8 or 16) in my.ini (mySQL config file in XAMPP)

xampp control panel

# Comment the following if you are using InnoDB tables
#skip-innodb
innodb_data_home_dir = "/Sites/xampp-portable-win32-1.8.3-5-VC11/mysql/data"
innodb_data_file_path = ibdata1:10M:autoextend
innodb_log_group_home_dir = "/Sites/xampp-portable-win32-1.8.3-5-VC11/mysql/data"
#innodb_log_arch_dir = "/Sites/xampp-portable-win32-1.8.3-5-VC11/mysql/data"
## You can set .._buffer_pool_size up to 50 - 80 %
## of RAM but beware of setting memory usage too high
innodb_buffer_pool_size = 32M
innodb_additional_mem_pool_size = 2M
## Set .._log_file_size to 25 % of buffer pool size
innodb_log_file_size = 10M
innodb_log_buffer_size = 32M
innodb_flush_log_at_trx_commit = 1
innodb_lock_wait_timeout = 50
innodb_file_per_table = 1
innodb_file_format = Barracuda

Doing so made it possible to import a 1GB sql table without any problem.

The above applies to XAMPP portable version xampp-portable-win32-5.5.19-0-VC11.zip

 

PHP UTF8 test-template (jQuery, Bootstrap)

This is just a webdevelopment template for PHP (all errors, xdebug), HTML, jQuery, Bootstrap (UTF8 encoding).

<?php
ini_set('display_errors' , 'On');
error_reporting(E_ALL);
session_start();
header("Content-Type:text/html;charset=utf-8");
ini_set('xdebug.var_display_max_depth', -1);
ini_set('xdebug.var_display_max_children', -1);
ini_set('xdebug.var_display_max_data', -1);
?>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Your Page Title</title>
	<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
	<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.min.js" integrity="sha384-0pUGZvbkm6XF6gxjEnlmuGrJXVbNuzT9qBBavbLwCsOGabYfZo0T0to5eqruptLy" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz" crossorigin="anonymous"></script>

<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script src="https://code.jquery.com/jquery-migrate-3.3.2.min.js"></script>

</head>
<body>
	<div class="container">
		<div class="row">
			<div class="col-md-12">


			</div>
		</div>
	</div>
</body>
</html>

Password protect a subsite in a WordPress network with .htaccess

A wordpress network / multisite setup uses virtual directories.

When you have a wordpress network setup on www.yourdomain.com, you can have multiple blogs with only one WordPress installation, for example:

www.yourdomain.com
www.yourdomain.com/johndoe
www.yourdomain.com/janedoe

Suppose you want to password protect only one subsite e.g. ‘janedoe’, you can’t just create a ‘janedoe’ folder on your webserver with a particular .htaccess in it.

You need to create a secured environment for the virtual folder in your main .htaccess (where all other WordPress rules reside) using the following code:

SetEnvIfNoCase Request_URI "^/janedoe/" SECURED
AuthType Basic
AuthName "restricted area"
AuthUserFile /home/mydomain/.htpasswd
require valid-user
Satisfy any
Order allow,deny
Allow from all
Deny from env=SECURED

Enable Apache Error Logging for Mod_Rewrite in Xampp

Mod_Rewrite enables you to do fancy stuff with URLs, but it isn’t always transparent when it comes to debugging. In a development environment it can be useful to enable apache error logging to see where a mod_rewrite line fails.

In XAMPP you can do this by opening httpd.conf (open control panel > config > Apache (httpd.conf)) and append mod_rewrite.c:trace3 to LogLevel.

LogLevel warn mod_rewrite.c:trace3

CSS use EM as a relative font-size, instead of PX

It goes back to Internet Explorer 3.0, but EMs are still the better way to define font-sizes. It takes a small learning curve to get the hang of it, but when it comes to quick changes in overall font-size, this is the way to go. Default font-size for most common browsers is 16 pixels. There are only three articles you need to read to tame that size with relative ems.

1em = 12pt = 16px = 100%

Useful reads

The EM formula

Child pixels / Parent pixels = Size in EM

Not good at calculating? Use the EM calculator

Still targeting Internet Explorer 6?

While Internet Explorer handles EM, it does so only when the base font is set to a percentage!

body { font-size: 62.5%; }
body wrapper { font-size: 1em; }