Check your ssh key passphrase

How can we check the passphrase of a private key?

Is it possible to do that using the following command:

  • If the input is the correct passphrase, it will show you the associated public key.
  • the wrong passphrase, it will display load failed.
  • If the key has no passphrase, it will not prompt you for a passphrase and will immediately show you the associated public key.

How to use multiple SSH private keys on a client

To use multiple shh private keys on a client you need to create the file config inside the folder .ssh and use the following entries:

where IdentityFile is the private key for realname.

Create Autoloader using Composer

  • Create a new file composer.json in the main folder and insert the just curly brackets

  • Run, to generate the autoload structure :

Acme is a example of Company/Project name, and src is the directory that contains all the files we want include in our project.

  • Run, to generate the psr-4 autoload file, the command:

The content of the file will be the following one:

  • Require the file autoload.php in your main project file (e.g.: index.php):

  1. Use namespaces Acme in your project for the file not in subfolder but just in src: So for example if you have the class Test.php in src you just need to use this.

You don’t need to use src in your namespace because the autoload has the $basedir on src.

The general rule is >>> what is inside the namespace + Class Name

So for example if you have the folder User in src for the class Person:

You must have the following code structure:

Class Person.php in src/User/:


Read a JSON file with php

Get the JSON content using file_get_contents() and to not avoid warnings specify the sources:

To read the file with an http request specify http/https:

To read the file form the filesystem:

decode the JSON using json_decode():

Use var_dump or print_r to understand the data structure. If for example the data content is:

To print the database name of databaseOne:

To loop through the array:

To print the database name for each entries:

Composer basics

Start new php project:

Install a new packages with:

Use to find the exact component name

In order to get the latest versions:

Uninstall packages from composer:

Search package from composer:

Shows a list of installed packages that have updates available:

You should always run the validate command before you commit your composer.json file:


When you try to connect to a remote server via ssh and you receive the message:

you can reset the known_host for the ip_address with the command:

the -R hostname Removes all keys belonging to hostname from a known_hosts file.

Install WordPress updates without ftp

If you have wordpress in a local machine and you want update the wordpress version without enable ftp you can add to the wordpress config file wp-config.php this setting:

remember you need to have permission to write in the wordpress folder. If you have a LAMP server make sure you have the user set to www-data.

sass installation on Mac – Gem::FilePermissionError

If you receive the following error during sass installation:

try to use this command:

Install LAMP ubuntu 16.04

Install and configure LAMP

Install apache2:

Set Global ServerName to Suppress Syntax Warnings. Append in /etc/apache2/apache2.conf (bottom of the file):

Launch the command:

you should receive the message Syntax OK.

Restart Apache to implement the changes:

Adjust the Firewall to Allow Web Traffic

http://your_server_IP_address to see the welcome page from apache.

Install MySQL

Set a secure password for the root user and launch the script to remove some dangerous defaults and lock down access to our database system

try the connection to the db with:

Install PHP

Modify the way that Apache serves files when a directory is requested serving php file before instead of html edit the file:

And insert the php index file before:

restart apache: sudo /etc/init.d/apache2 restart

test php with a phpinfo page.