Keys shortcuts in Linux and Screen/Byobu session

I’m fascinated with shortcuts – I can’t understand why wouldn’t you want to learn them, cut the process and get the job done in a fast speed.

So, I was going like usually though my duties and had to dig a bit through one of our servers and got annoyed by some typing difficulties and I told myself enough is enough you have to do something about it.   

Bash uses a library (a shared collection of routines that different programs can use) called Readline to implement command line editing. We have already seen some of this. We know, for example, that the arrow keys move the cursor, but there are many more features. Think of these as additional tools that we can employ in our work. It’s not important to learn all of them, but many of them are very useful. Pick and choose as desired.

Configure Web Server for Magento [Ubuntu, Nginx…] (Part 1)

There are some default good practice when installing/configure a server and I think is good to follow them and improve where is possible.

I tend to use [ apt ] instead of  [ apt-get ] as they are almost the same: apt is designed for end-users (human) and its output may be changed between versions > Means the output is more reach and pleasant.

Read more “Configure Web Server for Magento [Ubuntu, Nginx…] (Part 1)”

Troubleshooting SOAP: requesting multiple elements

I’m integrating the Whistl shipping carrier in our custom framework through SOAP protocol.

The fastest way is to build an array with all the required elements and send it to Whistl API.

Working with SOAP in php is very simple. Especially when you use the array as a container to pass to SOAP.

Example of SOAP initialisation and the method to be called with the array:

// initiate the soap request
$client = new SoapClient($url, array("soap_version" => SOAP_1_1,"trace" => 1));

// Building the array 
$DespatchParcel = array(

// my method was DespatchParcel
// and the array was build into 
$result = $client->DespatchParcel($DespatchParcel);

But later, going a bit closer through documentation spotted this bit of requirement for the request:


And at that moment I realised, there’s no way I could pass multiple elements with the same tag (<parcelProduct> ) using the array.

Overcome the multiple elements restriction

Tried multiple approaches and the best solution (the one and only one)  was to use the empty generic php Object.
It allows you to pass a request with same multiple elements, for example the upper XML request would look like:

// new object 
$DespatchParcel = new stdClass();

$parcelProduct1 = new stdClass();
// assign property 
$parcelProduct1->Code = "30205958";
$parcelProduct1->Quantity = "1";

$parcelProduct2 = new stdClass();
$parcelProduct2->Code = "30205959";
$parcelProduct2->Quantity = "2";

$ParcelProducts = new stdClass();
$ParcelProducts->parcelProduct = $parcelProduct1;
$ParcelProducts->parcelProduct = $parcelProduct2;

$DespatchParcel->ParcelProducts = $ParcelProducts;

After the object is properly build and is passed to the method as in the following example:

// Make the SOAP call 
$result = $client->DespatchParcel($DespatchParcel);

That’s what I’m calling a neat solution 😀 !

P.S. Don’t forget to pass every bit of code through GIT, that’s a life saver.

Fix “no signature key” in Ubuntu/Debian

Trying to update an Ubuntu 16.04 but was failing constantly because no signature key was there as you can see from the following warning:

- The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 40976EAF437D05B5 NO_PUBKEY 3B4FE6ACC0B21F32
- The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 40976EAF437D05B5 NO_PUBKEY 3B4FE6ACC0B21F32

Looking at the error above, apt is telling us that the following keys are missing: 40976EAF437D05B5 and 3B4FE6ACC0B21F32.


Notice that these are listed multiple times. Each unique key will only need to be added once.

Assuming we know the app and the server is considered secure then the fastest way of fixing this is by adding the missing keys.

To add these keys, grab the keys from the warning message and run the following commands:

sudo apt-key adv --keyserver --recv-keys 40976EAF437D05B5
sudo apt-key adv --keyserver --recv-keys 3B4FE6ACC0B21F32

After that you can safely update your Ubuntu/Debian.



MAMP Error – Unable to load dynamic library

I’m at the end of my patients, God knows what was update, MAMP or Brew or something else but I ended with this nasty error for Redis integration:

Warning: PHP Startup: Unable to load dynamic library 
'/Applications/MAMP/bin/php/php5.6.32/lib/php/extensions/no-debug-non-zts-20131226/' - dlopen(/Applications/MAMP/bin/php/php5.6.32/lib/php/extensions/no-debug-non-zts-20131226/, 9): image not found in Unknown on line 0

Whaaat was that?

Ok, I know I don’t have the redis library or php is not able to load dynamically the library therefore  I fixed this couple times through different methods, like:

  • install the library through brew
  • install phpredis through macport

But, I have MAMP I don’t want to mess with brew if it’s not necessary, I want to keep it simple and mostly I need a damn quick solution.

I need redis in my project otherwise I would disable the extension from php.ini .


Anyway, decided to take the straight approach. The error says it doesn’t have the in that location. A short search on google revealed a github project with Pecl redis Extension for MAMP 3.x & 4.x I forked the project so it would be available at any point at this location:  And:

  1. From the upper error got the version of php: php5.6.32
  2. Checked if the path from the upper error exists:
    1. Open Finder
    2. Pressed the combination of keys CMD+SHIFT+G or from top menu Go > Go to Folder and past the path from the error:  /Applications/MAMP/bin/php/php5.6.32/lib/php/extensions/no-debug-non-zts-20131226/ if it opens we’re good to go and skip (c).
    3. In terminal just run the following command which will create the entire folder structure (the folder might look different for a different version of PHP):
      mkdir -p /Applications/MAMP/bin/php/php5.6.32/lib/php/extensions/no-debug-non-zts-20131226/
  3. Download from github the redis version closer to what php version you have and save to(created directory): /Applications/MAMP/bin/php/php5.6.32/lib/php/extensions/no-debug-non-zts-20131226/

That’s it, that’s everything. I saved the file in the location it was looked by MAMP and everything works properly.

PHP extension mcrypt, intl, … missing as composer uses default environment

I got a bit tired of this error, it’s a bit of nightmare to setup Magento2 on OSX using the MAMP PRO PHP in CLI.

As composer is not able to pick the MAMP php but instead is loading the native one (if u’re in a hurry go to end of article, to update 2, for the solution).

The entire error looks like this:

Problem 1
- Installation request for magento/framework 100.1.5 -> satisfiable by magento/framework[100.1.5].
- magento/framework 100.1.5 requires ext-mcrypt * -> the requested PHP extension mcrypt is missing from your system.

Problem 2
- Installation request for magento/magento2-base 2.1.5 -> satisfiable by magento/magento2-base[2.1.5].
- magento/magento2-base 2.1.5 requires ext-intl * -> the requested PHP extension intl is missing from your system.

Problem 3
- Installation request for magento/product-community-edition 2.1.5 -> satisfiable by magento/product-community-edition[2.1.5].
- magento/product-community-edition 2.1.5 requires ext-intl * -> the requested PHP exte
nsion intl is missing from your system.

Read more “PHP extension mcrypt, intl, … missing as composer uses default environment”