DOMDocument not found

I installed the YooTheme master template (yoo-master2) and activated it directly. The only thing I got was a blank page. I had to remove the template folder to get the default template back again and started debugging.

The following error was thrown:

PHP Fatal error:  Class 'DOMDocument' not found in /var/www/mysite/current/public/wp-content/themes/mytheme/warp/src/Warp/Dom/Document.php on line 15, referer:

The problem was that PHP’s xml library was not installed on my VPS. To install it I had to run:

yum install php54w-xml 

Laravel 4 and environment detection

Lately I was struggling with the environment detection in Laravel 4.1. I am using one VPS for my staging and production environment. So environment detection based on the hostname won’t work for my situation because they are the same. URL detection has been removed in 4.1 due to security issues.

I found a blog post which almost suits my needs. The problem with this approach was that every time I do a deployment (via Rocketeer) I had to create a new environment.php to specify which environment it should use.

Rocketeer pulls a Github repository into a releases folders and creates a symlink from the ‘current’ directory to the right release. Rocketeer has also a ‘shared’ section which will remain (logs / sessions / settings (PhilF)) on deployment. So that would be a nice location for the environment.php


return 'staging'; //or 'production'

So what you should do is to change the detectEnvironment (bootstrap/start.php) file like this:

$app->bindInstallPaths(require __DIR__.'/paths.php');

$env = $app->detectEnvironment(function () use ($app) {

    $environment = include $app['path.base'].'/app/storage/settings/environment.php';
    return $environment ? $environment : 'local';


Note 1: Make sure bindInstallPaths is called before detectEnvironment.

Note 2: I am using ‘include’ instead of ‘required’, because the environment.php is optional. Required will stop the application. When the file is not found it will default to the ‘local’ configuration (for development).

Additional info:
The app/storage/settings directory is a symlink to /var/www/mysite/staging/shared/app/storage/settings

Directory structure:
/var/www/mysite/staging/current –> symlink to a release
/var/www/mysite/staging/releases/201401172200/app/storage/settings –> symlink to staging/shared/settings

See also

Laravel 4 and NodeJs/Redis pub/sub realtime notifications

Currently I am building an application where we can fill in live scores and I needed something to update all my visitors whenever a score has been updated by one of the admins.

Whenever an admin updates the score via the Laravel 4 backend I fire an event and publish it to Redis. I’ve setup a simple NodeJS server which listens to Redis for incoming changes. NodeJS will redirect the message to all Socket.IO clients.

Continue reading Laravel 4 and NodeJs/Redis pub/sub realtime notifications

VSFTPD for CentOS 6.4 (Selinux)

A couple of days ago I was setting up VSFTP on my CentOS 6.4 installation. I followed a tutorial and was able to connect to my server via FTP but however I did not see any contents. No error, nothing. My FTP users are bound to their home dir.

Did some searching on the internet and a lot of people turned off Selinux which causes the issue! Not a ‘real’ solution IMHO. To fix this first run the following command:

getsebool -a|grep ftp

Now check the values: ‘ftp_home_dir’ and ‘allow_ftpd_full_access’. Those should be set to ‘on’.

setsebool -P ftp_home_dir ON
setsebool -P allow_ftpd_full_access ON

Laravel and HTML 5 datetime component

I want to store all dates in UTC format into the database. To use HTML5 datetime-local element you have to do some conversion of datetimes. The HTML5 element expects a format of ‘2013-08-14T18:55’ (Y-m-d*H:i). In this post I’ll show you how I solved this.

Continue reading Laravel and HTML 5 datetime component

Laravel 4: Redirect to the intended url after login

The best way to redirect a user who is not logged in is to use the ‘Redirect::guest(..)’ method. This method will store the intended url in the session of the user. After logging in he can be be redirected back to the intended url via ‘Redirect:intended(..)’.

See example below.
Continue reading Laravel 4: Redirect to the intended url after login

Yii hide buttons of a CButtonColumn / TbButtonColumn

When you are using the CButtonColumn or TbButtonColumn and you want to hide a particular link you have to set the template attribute. You can also use this approach to change the order of the icons. See example below:

Continue reading Yii hide buttons of a CButtonColumn / TbButtonColumn

Yii CJuiDatePicker dateformat

Today I struggled with the datepicker provided by Yii. I wanted to show the date in format ’24-02-2013′. In this post I will show how I solved this.

Continue reading Yii CJuiDatePicker dateformat

Wicket mounting in an OSGi environment

This page describes how to do page mounting in Wicket in an OSGi environment. A resource/page/etc. can be registered to Wicket’s WebApplication via a couple of ‘mount’ methods. This example only shows how to mount a page (to keep it simple) but can be extended for IRequestMapper/resource/package as well.

Continue reading Wicket mounting in an OSGi environment

Wicket and CKEditor in Internet Explorer

CKEditor was working properly in Internet Explorer while developing our Wicket application. After deployment to our demo server it wasn’t working anymore. We had no issues with FireFox/Chrome or Safari. First we thought it had to do with some timing issues but after a lot of debugging we found out the issue (and of course the solution 😉 ).

Continue reading Wicket and CKEditor in Internet Explorer