Installing PHP7 pecl extensions on Alpine 3.4 Docker Images

Cant install pecl packages on Alpine PHP7 Docker Image.

Since PHP Container is based on Alpine 3.4 which in turn does not have library memcached available.

It seems Alpine 3.4 is meant to work with PHP5.
Thus creating a gap with the availability of packages for PHP7 and up. Luckily newer versions are switching to the alpine 3.7 where all the packages already available from the distro’s package source.

However this step in your Dockerfile will allow you to install anything you like with pecl on Alpine.

RUN apk update\
  && apk upgrade \
  && apk add libmemcached \
    libmemcached-libs \
    libmemcached-dev \
    build-base \
    zlib-dev \
    php5-dev \
    git \
    autoconf \
    cyrus-sasl-dev \
  && pecl config-set php_ini  /usr/local/etc/php/php.ini \
  && pecl install -f memcached \ #Or any Additional packages
  && echo >> /usr/local/etc/php/conf.d/docker-php-ext-memcached.ini \
  && rm -rf /tmp/pear \
  && apk del php5-dev \
     build-base \
     zlib-dev \
     php5-dev \
     git \
     autoconf \

Where command pecl install -f runs you can install extensions necessary such as memcached, xdebug or anything you like from .

And don’t forget to include your package, by creating file inside of the new conf.d directory.
So to resolve the deficiency I have been using a work around where I install pecl with PHP5 and make all necessary extension installations for the PHP7, and cleanup afterward.

Images affected:

 7.1.14-cli-alpine3.4, 7.1-cli-alpine3.4, 7.1.14-alpine3.4, 7.1-alpine3.4, 7.1.14-cli-alpine, 7.1-cli-alpine, 7.1.14-alpine, 7.1-alpine (7.1/alpine3.4/cli/Dockerfile)
 7.1.14-fpm-alpine3.4, 7.1-fpm-alpine3.4, 7.1.14-fpm-alpine, 7.1-fpm-alpine (7.1/alpine3.4/fpm/Dockerfile)
 7.1.14-zts-alpine3.4, 7.1-zts-alpine3.4, 7.1.14-zts-alpine, 7.1-zts-alpine (7.1/alpine3.4/zts/Dockerfile)
7.0.27-cli-alpine3.4, 7.0-cli-alpine3.4, 7.0.27-alpine3.4, 7.0-alpine3.4, 7.0.27-cli-alpine, 7.0-cli-alpine, 7.0.27-alpine, 7.0-alpine (7.0/alpine3.4/cli/Dockerfile)
7.0.27-fpm-alpine3.4, 7.0-fpm-alpine3.4, 7.0.27-fpm-alpine, 7.0-fpm-alpine (7.0/alpine3.4/fpm/Dockerfile)
7.0.27-zts-alpine3.4, 7.0-zts-alpine3.4, 7.0.27-zts-alpine, 7.0-zts-alpine (7.0/alpine3.4/zts/Dockerfile)

And any derivatives. Such as:


Angular Templates

Templates for Angular Development Prototyping.

One of the exciting feature of Angular 1.5 Is accent on use of Components.
Something that changes the way how you think about reusable parts of your application.
It helps to organised your thought around notion of independent components that serve focused job,
and responsible for themselves only. That approach will help avoid most common problems of angular
development called “Scope Soup”. If you have seen this $scope.$parent… you know what its about.

Problem comes when you need to make what seems small change and it turns in to debugging nightmare,
while you hunt down all places who access and modify same that object.

Anyway this post is not aimed on educating, there are quite of few materials on it already, however Less then desirable. Highly recommend this guide to help you convert your existing application in to components.


Component Template that include Angular 1.5, Lodash, Bootstrap, Jquery.

Simple Controller display.

Source for Additional Libraris for your own codepens:

Video Reviews for Woocommerce & Site Comments, 2 Easy Solutions.

Have you ever wanted to include video reviews to your Woocommerce store? Or allow users to post videos with comments, which works same as reviews. Well now we will see how to achieve this with two ways.

First Solution is to have users to post comment with necessary html code for embed the video.
To make this work our default user role need to have necessary (unfiltered_html) permission. Dont be scared its easy to do with 2 lines of code. Make sure you selected correct user role, by default its ‘subscriber’, but may change with woocommerce as it creates role ‘customer’.

$role = get_role( 'subscriber' );
$role->add_cap( 'unfiltered_html' );

Now this allowed users to post unfiltered html to our website. Okay as you might already guessed it can result in some html code be posted. If you manually review each comment that should not be big problem.
And user needs to know how to acquire html for video embed to be posted in comments.
This would look something like this: <iframe width=”560″ height=”315″ src=”” frameborder=”0″ allowfullscreen></iframe>.

However that’s not it, I have promised 2 solution and here is the second and better solution.

We create filter that hooks in to the comment and checks for embeds.
Everything is done with build-in wordpress functionality, without giving permissions or html. All we need is link to the video, or other supported build in WordPress embed service.

$wp_embed = new WP_Embed;
add_filter( 'comment_text', array( $wp_embed, 'autoembed' ), 8 );

Modification of plugin’s hooks and actions regardless of load order.

To have access to all other plugins hooks, we need run our script when wordpress done loading plugin.
Use following workaround.

Place your hooks in to the function, and call it when plugins_loaded.


function modify_actions_custom(){


WordPress Codex with loading structure.

WordPress – Creating Site specific plugin

Why create wordpress modification as a plugin? That allow us to keep theme files (function.php) clean of setup or plugin specific modifications. With that said lets begin.

Create a folder in the plugin directory of your wordpress website.
Create index.php file with following content as template for plugin:

Plugin Name: 

/* Below this line content of the plugin */



As you can see its pretty simple. To get started, as it always with wordpress. However there are some difference from how plugin operates compared with theme.

  • Include paths
    • To include any of your file in to the plugin or a theme we use function that determines its location. That includes JS, CSS or images. In theme location is passed with get_template_directory_uri(),

      In theme they are passed with get_template_directory_uri(),
      In child theme its get_stylesheet_directory_uri(),
      while for plugins its: plugin_dir_url( __FILE__ ).
      Followed by the file name with extension.

  • Execution order
    • Plugins are loaded before themes, therefore some of the hooks may not be available as plugins themselves are executed in wordpress determined order. So your site specific plugin maybe executed before required hooks or action becomes available. Little snippet on how to solve it.

Keep this things in mind when moving the code from function.php to your new site specific plugin. If you have encountered any other problems with migration to plugin from theme, feel free to comment.

WordPress – Sensei plugin auto grading of ALL question types

Sensei is a Learning Platform Plugin, with build-in Woocommerce integration. It is also developed by Woothemes, company which was recently purchased by Automatic (Owner of WordPress) to simplify building of e-commerce websites.
Sensei is premium plugin, means you need to buy it, but its also GPL, and has its development open on

By The Default Sensei Supports only multiple choice, fill in the blank, and true and false, auto-grading. However in the recent project I have worked on I have encountered need for auto-grading the questions of the single line, multi-line and file upload types. So in order to do it we need to make couple of things.

I recommend create Site specific plugin for this modification.

First allow in administrator menu for this question types to be gradable automatically. That achieved with simple jquery.

Create the JS file, with this content:
and save it as sensei/sensei-admin-scripts.js

	$( 'input#quiz_grade_type' ).removeAttr( 'disabled' );
	$( 'input#quiz_grade_type' ).closest('p.form-field').removeClass( 'disabled' );
	$( 'input#quiz_grade_type_disabled' ).val( 'enabled' );

Then we create an index.php file with our plugin content

add_action( 'admin_enqueue_scripts', 'load_custom_sensei_admin_script');

add_filter( 'sensei_autogradable_question_types', function($supported){return array_merge( $supported, array('multi-line','single-line','file-upload'));});

add_filter( 'sensei_grade_question_auto', 'sensei_autograde_question_score', 10, 4 );

function load_custom_sensei_admin_script() {
	wp_enqueue_script( 'custom-sensei-admin-script', plugin_dir_url( __FILE__ ).'sensei/sensei-admin-scripts.js');


Update: 8/19/15
In future 2.0 Release it is planned to have ability to set questions without grading, enhancement which I have purposed back in july (

So this logic will be changed. But for now this solution works perfectly.