Welkom bij Bandhosting.nl,
hosting en webdevelopment.

Install memcached on php 7.4 on OSX

The following commands can be used in order to install memcached in php 7.4:

brew install libmemcached
brew install zlib
pecl install memcached

Enter the following items:

libmemcached directory [no] : /usr/local/Cellar/libmemcached/1.0.18_2/
zlib directory [no] : /usr/local/Cellar/zlib/1.2.11/
use system fastlz [no] :
enable igbinary serializer [no] :
enable msgpack serializer [no] :
enable json serializer [no] :
enable server protocol [no] :
enable sasl [yes] :
enable sessions [yes] :

After this, you can extension="memcached.so" to your php.ini file (if it wasn't added automatically).

You can verify the installation with the following command: php -m

That will list all enabled modules, memcached should be on the list.

Email instellen als POP account in Google en Outlook.com

Er zijne en aantal gebruikers die hun email standaard laten doorsturen naar hun Gmail of Outlook emailadres. Door deze opzet worden een aantal problemen veroorzaakt:

  • Door mechanismen als SPF en DKIM wordt email die door onze servers zijn doorgestuurd als spam gezien omdat ons server ipadres niet voorkomt in de lijst met geauthoriseerde servers
  • Doordat mail die door onze spamfilter niet als spam wordt gezien, maar wel door de spam filter van Google/Outlook wordt de ip-reputatie van onze servers besmet, omdat we in de ogen van Google/Outlook spam versturen

Gelukkig is dit makkelijk te voorkomen door email niet door te laten sturen, maar door in Gmail en Outlook in te stellen dat deze de mailbox via POP uitlezen.

Email/database instellingen Websites-Enzo

Met de overname van hosting door Bandhosting veranderen een aantal emailinstellingen. Deze zullen in uw apparaat nagelopen moeten worden om ervoor te zorgen dat email weer aan komt:

  Oude omgeving Nieuwe omgeving
POP/IMAP server mail.websites-enzo.nl web1.bandhosting.nl
SMTP server mail.websites-enzo.nl web1.bandhosting.nl
SSL/STARTTLS optioneel actief

Ook voor de mysql database is een andere host nodig:

  Oude omgeving Nieuwe omgeving
host localhost db1.bandhosting.nl

Block a specific POST request

Today I've received a notification from our VPS provider that one server was sending out spam. Turned out to be an old Joomla form that wasn't protected properly.

Since I don't manage the site myself, I've notified the customer to take action. In the meantime, I've added a rule at the top of the .htaccess file of the site to block the spam from being sent at all:

RewriteEngine On
RewriteCond %{THE_REQUEST} /index\.php\?option=com_contact\&view=contact\&id=1 [NC]
RewriteRule ^ - [F,L]

Make sure you place this at the very top of the .htaccess file.

The result is that every form submit, will result in a 403 error:

x.x.x.x - - [14/May/2020:17:00:25 +0200] "POST /index.php?option=com_contact&view=contact&id=1 HTTP/1.1" 403 1705 "-" "-"

Install gearman on php 7.4

The following commands can be used in order to install Gearman in php 7.4:

curl -L https://github.com/php/pecl-networking-gearman/archive/master.tar.gz | tar -xz
cd pecl-networking-gearman-master
make install

This will install the master branch of the pecl-networking-gearman project (there's no release for the php 7.4 support yet).

After this, you can extension="gearman.so" to your php.ini file.

You can verify the installation with the following command: php -m

That will list all enabled modules, gearman should be on the list.

Rescue faulty harddrives with ddrescue

If a certain external or internal harddrives give you issues, you can use ddrescue to extract a backup from it (for as far as data isn't damages by broken sectors yet).

It's a long process, but luckily ddrescue allows you to stop and resume the process as often as you need.

Doctrine migration up vs postUp

We are using Doctrine Migrations to update our table structure with changes that are needed when we implement new code.

This week we ran into an issue where data migration failed in the postUp part of a certain migration. When we retried the migration, it failed on the up part since that part was executed successfully...

Checking mysql progress on startup with cluster

Mysql startup can take quite some time in a cluster setup, where it's net pretty obvious what mysql is doing. (At least, not visible with journalctl -u mysql -f)

If it hangs with one CPU on 100% load, it's most likely scanning .ibd files.

You can verify this (and the progress) with watch -n1 'lsof -n -p $(pidof mysqld) |grep var.*lib'

Install older version of ansible with Homebrew

I ran into an issue today where I could not execute a deployment on kubernetes due to a bug in ansible's k8s_raw module with ansible 2.6.5.

On my older mac I could simply switch to the older installed version of ansible, on my old mac however I wasn't as fortunate. Luckily there's a way to solve this by fetching the full git history of ansible yourself.

Clean up excessive docker usage

Ran into an issue today where the /var/lib/docker folder had grown to a full 45gb of size. After some futher inspection, it turned out to be the overlay2 and the volumes folder that were large.

Since this was a CI server (a server that runs build pipelines), no data needed to be persisted there. This allowed me to clean it up using the following commands:

docker system prune -a -f cleaned out the overlay2 folder docker volume rm $(docker volume ls -qf dangling=true) cleaned out the volumes folder

After this, the /var/lib/docker folder was only 3mb large.

Installing xdebug in homebrew after the latest homebrew/php change

On the 31st of march, the homebrew-php library got deprecated and archived. A few php modules have been bundled with the php brew install php@7.1 command, but not all.

To install xdebug, you will need to do the following:

pecl install xdebug

remove the following line that was inserted by the pecl installer from your php.ini (/usr/local/etc/php/7.1/php.ini):


Create a new file in the php conf.d (/usr/local/etc/php/7.1/conf.d/ext-xdebug.ini) folder, with the following content:


Now, if you execute php -m it should list xdebug as installed.

VueJS cli template for plugins with jest testing

Since I'm using VueJS quite a lot I needed a good template to set up new plugin type projects. Since the default vue-cli templates mostly focus on building SPA's or don't include any testing suites, I've created one that handles that.

It includes JestJest as a testing suite and some useful script hooks for publising to an NPM registry.

You can find the details on my Github.

Or start using it: vue init websmurf/vuecli-plugin-setup my-project

Gitlab Logo

Share your composer cache between jobs and pipelines in gitlab

Running a Gitlab CI pipeline can take quite some time depending on the amount of tests or tasks that are being executed. Luckily we can cut some time off the composer install step which an easy hack.

This will change your composer cache directory and allow them to be cached between jobs and pipelines allowing composer to use the local cache in stead of having to download packages from packagist and github every time.

Observe the following (shortened) gitlab.ci file:

  - composer-cache/

  stage: test
  image: php:7.1
    - curl -sS https://getcomposer.org/installer | php
    - COMPOSER_CACHE_DIR=composer-cache php composer.phar install --no-progress --no-suggest
    - vendor/bin/phpunit

The cache part will cache a directory named composer-cache using the default gitlab cache logic thus sharing all files in this folder between jobs and pipelines.

The other adjustment is to change the composer cache directory forcing composer to use this directory in stead of the default one. Luckly we can do that with a simple environment variable in the composer call:

COMPOSER_CACHE_DIR=composer-cache php composer.phar install --no-progress --no-suggest

In this way, composer won't have to look online everytime a job is executed.

Fix access denied error while mounting a NFS share from mac osx on linux

If you ever get this error while mounting a NFS share from OSX on Linux:

root@stretch:/# mount -v /export
mount.nfs: access denied by server while mounting

Or in verbose modus:

root@stretch:/# mount -v /export
mount.nfs: timeout set for Thu Jan  4 11:28:51 2018
mount.nfs: trying text-based options 'vers=4.2,addr=,clientaddr='
mount.nfs: mount(2): Protocol not supported
mount.nfs: trying text-based options 'vers=4.1,addr=,clientaddr='
mount.nfs: mount(2): Protocol not supported
mount.nfs: trying text-based options 'vers=4.0,addr=,clientaddr='
mount.nfs: mount(2): Protocol not supported
mount.nfs: trying text-based options 'addr='
mount.nfs: prog 100003, trying vers=3, prot=6
mount.nfs: trying prog 100003 vers 3 prot TCP port 2049
mount.nfs: prog 100005, trying vers=3, prot=17
mount.nfs: trying prog 100005 vers 3 prot UDP port 996
mount.nfs: mount(2): Permission denied
mount.nfs: access denied by server while mounting

You can fix this by setting nfs.server.mount.require_resv_port = 0 in /etc/nfs.conf. Do not forget to reload the nfs server on osx after you apply this config setting by using the following command: sudo nfsd restart

Converting your local development from .dev to .local

With the arrival of Chrome 63, every .dev domain you visit will be redirected to https due to a change in HSTS settings. This is normally no issue, except when you have set up your local development on the .dev domain (as I had).

I decided to move everything over to the .local domain using the following steps:

Change your dnsmasq.conf

Open the /usr/local/etc/dnsmasq.conf file and change this line:




This will direct all .local domains to your local host.

Change the resolver file

Move the /etc/resolver/dev to /etc/resolver/local:

sudo mv /etc/resolver/dev /etc/resolver/local

Restart the dnsmasq service

sudo launchctl stop homebrew.mxcl.dnsmasq
sudo launchctl start homebrew.mxcl.dnsmasq

That should be all

Selenium logo

Testing your application using Selenium, Chrome/Firefox and Behat on docker-machine

Selenium is an automation tool which you can use to automate testing of your application. It allows you to run instances of Chrome and Firefox locally and perform automated tests against it, with which you can validate if your application does what it should.

We had quite a lot of issues with it in the past when running Selenium 2 in combination with Firefox. Things broke down with every new release of Firefox and needed a lot of time to get things running again. Eventually we pinned Firefox down on our test machine to Firefox 46 and never touched it again.

Luckily Selenium started to release docker containers which combined Firefox/Chrome with a specific version of Selenium making it a lot easier to test stuff. It took us a while to understand how this should interact with our local application development, but in the end we got things running.

  • 1
  • 2