I decided to upgrade my web server containers to PHP 7 but ran into a problem with WordPress, all articles had no text. The problem seemed to be within the plugin CodeColorer since disabling it resolved the problem

PHP Warning:  preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead in /var/www/wp-content/plugins/codecolorer/codecolorer-core.php on line 50

In wp-content/plugins/codecolorer/codecolorer-core.php locate this code block:

  /** Search content for code tags and replace it */
  function BeforeHighlightCodeBlock($content) {
    $content = preg_replace('#(\s*)\[cc([^\s\]_]*(?:_[^\s\]]*)?)([^\]]*)\](.*?)\[/cc\2\](\s*)#sie', '$this->PerformHighlightCodeBlock(\'\\4\', \'\\3\', $content, \'\\2\', \'\\1\', \'\\5\');', $content);
    $content = preg_replace('#(\s*)\<code(.*?)\>(.*?)\</code\>(\s*)#sie', '$this->PerformHighlightCodeBlock(\'\\3\', \'\\2\', $content, \'\', \'\\1\', \'\\4\');', $content);

    return $content;

and replace it with this

  /** Search content for code tags and replace it */
  function BeforeHighlightCodeBlock($content) {
    $content = preg_replace_callback('#(\s*)\[cc([^\s\]_]*(?:_[^\s\]]*)?)([^\]]*)\](.*?)\[/cc\2\](\s*)#si', function($matches){
      return $this->PerformHighlightCodeBlock($matches[4], $matches[3], $matches[2], $matches[1], $matches[5]);
    }, $content);
    $content = preg_replace_callback('#(\s*)\<code(.*?)\>(.*?)\</code\>(\s*)#si', function($matches){
      return $this->PerformHighlightCodeBlock($matches[3], $matches[2], '', $matches[1], $matches[4]);
    }, $content);

    return $content;

It would of course make sense to find a replacement for CodeColorer since it does not seem to be maintained but that would probably also mean having to edit all old articles.

My collection – Enjoy.

(This is the same folder I use for randomized backgrounds on my computers)

Nowhere.dk (the entire domain) was offline today from 09:47 to 10:46 UTC follwing a major outage at Cloudflare.com.

Points to Cloudflare.com for releasing a full incident report.

Nowhere.dk has been moved to nginx (with php5-fpm) and most things seem to be working.

There is one problem though.

It seem that some of the older articles are indexed as /articles/-title-/index.php (which is sort of wrong) and accessing that type of URI results in a blank page.

The problem seem to be that I’ve configured nginx to serve file in this order:

location / {
                        try_files $uri $uri/ @rewrites;

In theory it should then be a matter of defining the right rewrite

location @rewrites {
       rewrite ^/articles/(.*)/index.php$ /articles/$1 permanent;
       rewrite ^ /index.php last;

but – There’s also a location definition for all php “files” (locations ending in .php, not files mind you) and I believe that the .php locations are handed over to php5-fpm withouth nginx actually testing to see if it’s there.

Perhaps I can solve this – but it is a minor problem.

The performance of the site should have increased considerably – but since it meant disabling WordPress HTTPS you will probably see a warning about all elements of the page not being secured; I am working on that.

It might seem as if Nowhere.dk has been out of commission for a while. That is not the case – but a firewall configuration error (on my part) accidently blocked port 80; an error I did not see since I always use SSL.



A Christmas Cacophony – Epilogue

Too manee shinees fur my brain to handul!

Have yourselves a merry little Christmas – Have you ever thought about what Santa REALLY does while you’re asleep?

While my site might not be as important or visited as Google or Facebook, I decided to switch it to SSL.

Some pages will show an “error” in the browser because not all content is encrypted (external images); I hope I’ll get that fixed some day.

But I haven’t really had anything to write about. I assure you, if anything pops up, I will make a real blog post :)

My Twitter account is updated somewhat regularly and I post less important stuff (mostly links to stuff) on Tumblr.

IPv6 readyJust a quick note to let you know that www.nowhere.dk is now accessible through IPv6

$ host -t AAAA www.nowhere.dk
www.nowhere.dk          CNAME   coredump.nowhere.dk
coredump.nowhere.dk     AAAA    2001:2010:0:2:0:0:0:DEAD

The only thing I had to do was to enable IPv6 in Lighttpd, enable IPv6 in ufw (done in /etc/default/ufw) and then re-add any rules to ufw that affect IPv6 (like web and ssh). The last part is crucial and not very well documented.