How to Install Latest Nodejs & Npm on Ubuntu 16.04 & 14.04

Node.js is a platform built on Chrome’s JavaScript runtime for easily building fast, scalable network applications. Latest version node.js ppa is maintaining by its official website. We can add this PPA to Ubuntu 16.04 LTS (Trusty Tahr) and 14.04 LTS (Xenial Xerus) Systems and install node.js with few easy commands.

Install nodejs

Step 1: Add NodeJs PPA

First, you need to node.js PPA in our system provides by nodejs official website. We also need to install python-software-properties package if not installed already.

$ sudo apt-get install python-software-properties
$ curl -sL | sudo -E bash -

Step 2: Install Nodejs and NPM

After adding required PPA file lets install Node package. NPM will also be installed with node.js. This command will also install many other dependent packages on your system.

$ sudo apt-get install nodejs

Step 3: Check Node.js and NPM Version

After installing node.js verify and check the installed version. You can find more details about current version on node.js official website.

$ node -v 


Also, check the version of installed npm.

$ npm -v 


Step 4: Create Demo Web Server (Optional)

This is an optional step. If you want to test your node.js install. Let’s create a web server with “Hello World!” text. Create a file http_server.js

$ vim http_server.js

and add following content

var http = require('http');
http.createServer(function (req, res) {
  res.writeHead(200, {'Content-Type': 'text/plain'});
  res.end('Hello World\n');
}).listen(3001, "");
console.log('Server running at');

Now start the web server using below command.

$ node --debug http_server.js

debugger listening on port 5858
Server running at

The web server has been started on port 3001. Now access URL in browser. Now you will need to configure a front-end server for your app.


credit :

Cara Install Phalcon Di Ubuntu 16.04

Pada kesempatan kali ini saya akan berbagi kepada sobat tentang cara Install Phalcon Di Ubuntu 16.04 tentu saja cara ini tidak sama seperti halnya kita Install Phalcon Di Ubuntu 14.04. Sebelum sobat menginstall ini pastikan dahulu sobat mengenal phalcon jika belum kenal sobat bisa baca artikel saya sebelumnya tentang Perkenalan Framework Phalcon dan saya akan membuat tutorial series yang artinya setiap artikel yang satu dengan yang lain saling berkaitan. Nantikan tulisan saya lainnya tentang Tutorial Phalcon yang lainnya.

Yang berbeda cara installasi phalcon diubuntu 14.04 & ubuntu 16.04 adalah versi php yang berbeda. Perlu kalian ketahui bahwa ubuntu 16.04 hanya support menginstall dan menggunakan php7 , sementara ubuntu 14.04 menggunakan php 5. Tentu sangat berbeda apabila kita install ubuntu 16.04 dengan cara ubuntu 14.04.

1. Install LAMP-stack (Apache2, Mysql, Php 7)
Untuk cara penginstallan tidak akan saya jelaskan disini karena akan menjadi artikel yang sangaat panjang hahaha untuk saya rekomendasikan sobat untuk bisa ikuti cara di :
Setelah berhasil Install LAMP-stack kita akan mulai melakukan instalasi phalcon diharap untuk ikuti baik-baik step-by-stepnya.

2. Installasi Phalcon Ubuntu 16.04
Masukan command dibawah ini melalui terminal sobat secara bertahap satu per-satu.


$ sudo apt-add-repository ppa:phalcon/stable
$ sudo apt-get update
$ sudo apt-get install php7.0-phalcon
$ sudo apt-get install -y gcc make re2c libpcre3-dev php7.0-dev build-essential php7.0-zip


3. Aktifkan Extensi Phalcon
$ sudo apt-get install gcc make autoconf libc-dev pkg-config
$ git clone --depth=1 git://
$ cd cphalcon/build
$ sudo PATH=/opt/sp/php7.0/bin:$PATH ./install
4. Tambahkan Extensi Phalcon Ke Apache
$ sudo bash -c "echo > /etc/php7.0/conf.d/phalcon.ini"
$ sudo service php7.0-fpm restart


5. Cek Ekstensi Phalcon.
Cek ekstensi phalcon apakah sudah aktif atau belum.
Runing terlebih dahulu Apache2 sobat “sudo service apache2 start”
lalu buat file didirektori default apache2 /var/www/html/ cari ekstensi phalcon ctrl + f phalcon.
Selamat! Kini Phalcon v.3.0.1 telah diinstall diubuntu 16.04 sobat silahkan untuk terbang bersama phalcon ?

How To Install Apache MySQL PHP (LAMP Stack) on Ubuntu 16.04

LAMP (Linux, Apache, MySQL and PHP ) Stack is the most popular environment in PHP website development and hosting. Linux is the operating system, Apache is the popular web server developed by Apache Foundation. MySQL is relational database management system used for storing data and PHP is an development language.

This article will help you to Install Apache 2.4, MySQL 5.7 and PHP 7.0 . on Ubuntu 16.04 LTS Systems.

Step 1 – Install PHP

PHP 7 is the default available packages in Ubuntu 16.04 repositories. Simply use the following commands to update apt cache and install PHP packages on your system.

$ sudo apt update
$ sudo apt install -y php

Verify installed PHP version using following command.

rahul@tecadmin:~$ php -v

PHP 7.0.4-7ubuntu2 (cli) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
    with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies

Step 2 – Install Apache2

After installing PHP on your system, let’s start installation of Apache2 in your system. Your also required to install libapache2-mod-php module to work PHP with Apache2.

$ sudo apt install apache2 libapache2-mod-php

Step 3 – Install MySQL

Finally install mysql-server packages for MySQL database. Also install php-mysql package to use MySQL support using php. Use following command to install it.

$ sudo apt install mysql-server php-mysql

Installer will prompt for root password, This password will work for your MySQL root user. After installing MySQL execute following command for initial settings of MySQL server. You will she that script will prompt about more settings than earlier mysql versions like password validation policy etc.

$ sudo mysql_secure_installation

Step 4 – Restart Apache2, MySQL Services

After installing all services on your system, start all required services.

$ sudo systemctl restart apache2.service
$ sudo systemctl restart mysql.service

Step 5 – Open Access in Firewall

If you are using iptables, Use following commands to open port 80 for public access of webserver.

Iptables Users:

$ sudo iptables -A INPUT -m state --state NEW -p tcp --dport 80 -j ACCEPT

UFW Users:

$ sudo ufw allow 80/tcp

Step 6 – Test Setup

After completing all setup. Let’s create a info.php file website document root with following content.

Now access this file in web browser. You will see the screen like below with all details of PHP on server.


Congratulation’s! You have successfully configured web server on your ubuntu System.

credit :

Uploading multiple files with Phalcon PHP and HTML5.

First of all, if you just fell here and don’t know what Phalcon is, I recommend you to first take a ride at its website, or documentation. If you feel ready or already knew it, then we can go on.

Note: if you want the tl;dr version you can go down the page, download the whole project and see the code by yourself.

Note²: my goal here is just show the simplest way to implement a multiple file upload system using Phalcon, so don’t expect to see security rules such as file size limiters, file extension filtering, upload bot blocking, etc.

For this example we will be using the native HTML5 multiple attribute for file inputs, which according to CanIUse, its suported by: IE10+, Chrome, Firefox, Safari 7+, iOS 5+, and Android 4.4+.

So, first of all lets create a new Phalcon project (you can create it manually or using Phalcon Dev Tools, which I highly recommend you to use, you can find more about it here).

Using Dev Tools we can simply use this command to create all Phalcon project structure and files automatically:

$ phalcon project multiple-uploader-example

Where “multiple-uploader-example” is the name you want to give to our project.

Ok, so now we have our fresh created project which will have an structure like this:

Dat Sublime Text 2 Theme…

See these green arrows pointing to IndexController.php and index.volt? These are the only files we will be working at.

Also, we need to create a folder that we will call temp inside public’s folder which will receive the uploaded files:

Ok, so now we need to create a form in the view (index.volt) to send our images, it will be something like this:

<form action=”index/upload” method=”post” enctype=”multipart/form-data”>
 <input type=”file” name=”files[]” multiple>
 <input type=”submit” value=”Send File(s)”>

The form itself is pretty common, the magic happens when we add the multiple attribute and the brackets in input’s name, now our input supports multiple files. Also, as you can see, the action is leading to index/upload which we will be coding bellow.

In our IndexController.php we now need to handle the upload action, checking if there is any file sent, and handling them properly.

Our yet untouchable IndexController.php is probably looking like this:

class IndexController extends ControllerBase
 public function indexAction()

You can see that there is already a function which responds to /index actions which is empty, now we need to create the one that will handle /index/upload. To do this we will create another action:

class IndexController extends ControllerBase
 public function indexAction()
 public function uploadAction()

And then put the code which will handle the uploaded files:

#check if there is any file
if($this->request->hasFiles() == true){
 $uploads = $this->request->getUploadedFiles();
 $isUploaded = false;
 #do a loop to handle each file individually
 foreach($uploads as $upload){
 #define a “unique” name and a path to where our file must go
 $path = ‘temp/’.md5(uniqid(rand(), true)).’-’.strtolower($upload->getname());
 #move the file and simultaneously check if everything was ok
 ($upload->moveTo($path)) ? $isUploaded = true : $isUploaded = false;
 #if any file couldn’t be moved, then throw an message
 ($isUploaded) ? die(‘Files successfully uploaded.’) : die(‘Some error ocurred.’);
 #if no files were sent, throw a message warning user
 die(‘You must choose at least one file to send. Please try again.’);

Kind of fuzzy eh? As Medium don’t support syntax highlight (yet! I hope) I think that a image of the whole controller would become handy and easier to understand:

This image is the code above in any editor with syntax highlight

Aaand this is it! Now all you need to do is run your project in a browser (in an apache environment with phalcon installed, obviously) and see the magic happens!

If you want to see what we just created here, you can download the example project here (watch out, its a .rar file, it may contain viruses that will eat you brain inside out while singing shitty pop songs).

If you got stuck somewhere or have any doubts you can always leave a comment in the part you are having troubles. →

And a good week for everyone. ☺

Raw SQL Query PhalconPHP

Phalcon is a high perfomance PHP framework based on MVC pattern.  Phalcon has good performance in handle many request/second compared to other PHP framework, such as : Laravel, Zend, Code Igniter, and Kohana.

This tutorial will show you how to call raw SQL query for insert,update,select, and delete in Phalcon PHP Framework.

1. Select

This example shows you how to call raw select from Phalcon controller class.

public function selectAction()
    $result=$this->db->query("SELECT employee_id,employee_name FROM employee order by employee_id desc");
        echo $row['employee_id']." ".$row['employee_name']."<br>";


2. Insert

This example shows you how to call raw insert from Phalcon controller class.

public function insertAction()
    $success=$this->db->execute("INSERT INTO employee (employee_id,employee_name)
                            VALUES ('14','Aditya Nugraha')");
    if($success)echo "Success!!";
    else echo "Failed!!";


3. Update

This example shows you how to call raw update from Phalcon controller class.

public function updateAction()
    $success=$this->db->execute("UPDATE employee SET employee_name='Aditya'
                                WHERE employee_id='14'");
        echo $updatedCount." rows updated";
    else echo "Failed!!";


4. Delete

This example shows you how to call raw delete from Phalcon controller class.

public function deleteAction()
    $success=$this->db->execute("DELETE FROM employee
                                WHERE employee_id='14'");
        echo $updatedCount." rows deleted";
    else echo "Failed!!";

Cara Upload Project ke Github Melalui CMD

Upload File ke Github

1. Pertama yang harus kalian lakukan adalah mendaftar akun Github terlebih dahulu. Prosesnya terbilang mudah 3 Step untuk bisa membuat akun di Github.


2.   Setelah berhasil di buat akun Githubnya. Lihat pada pojok kanan atas pilih tanda + samping gambar profil Github kalian. Lalu pilih New repository.

New repository Github

3. Lalu pada bagian Create a new repository . Kalian bisa isikan  Nama Repository di kolom bagian atas. Lalu bagian bawah (optional) kalian bisa mengisikan deskripsinya. Setting ke Public , jika sudah pilih tombol Create Repository yang bewarna hijau. 

Create Repository Github

4.   Jika sudah Copykan alamat atau url repository gitnya. Alamat ini akan kita gunakan untuk tempat meremote folder atau file kita di Github.

alamat atau url Github remote

5. Sekarang kembali ke Command Prompt atau Git Bash, masuk ke dalam folder dan file sebelumnya
( folder : belajargit file : latihan1.txt).

6. Lalu ketikan perintah git config

git config adalah suatu perintah untuk mengkonfigurasi username,  dan alamat email Github kita agar tersimpan di dalam Command Line.


git config cmd Windows
git config

git config –global “username Github”
git config –global “alamat email Github”

7.  Kemudian ketikan perintah  git init

8. Sekarang kita akan coba tambahkan 3 file tambahan. Ketikan git add * 

9.  Jika di artikel sebelumnya kita sudah menambahkan commit , sekarang kita tambahkan lagi yaitu dengan mengetikan.

 git commit –m “Upload di Github”

10.  Setelah itu kita akan meremote ke alamat , atau url repository git yang sudah kita copykan tadi.

git remote adalah perintah untuk tempat meremote folder atau file kita sebelumnya yang sudah terinisiaisasi Git, yang tersimpan di local (Komputer kita ) ke server atau tempat repository (Github)

Ketikan perintah :

git remote add origin <alamat git kalian>

//origin adalah nama remote yang telah kita tambahkan
//jika kalian ingin mengubah url remote atau mensetting kembali remote kalian bisa mengetikan perintah :
git remote set-url origin <alamat git>

git remote cmd windows
git remote

11. Lalu ketikan

 git pull origin master.


git pull digunakan untuk menarik atau nama lain dari mengunduh,  beberapa file di dalam project yang tersimpan di repository (server),  ke dalam tempat penyimpanan Komputer kita (local).


Biasanya ini digunakan untuk suatu project yang dikerjakan atau dikembangkan lebih dari satu orang (kolaboratif) , dan kita mengambil beberapa file yang telah di kerjakan oleh orang tersebut. Jadi ketika ada perubahan dan penambahan file di server atau repository Github, kalian harus menggunakan git pull terlebih dahulu sebelum mempush (git push).


12. Terakhir kita ketikan.

 git push origin master

git push digunakan untuk mengupload atau menyimpan,  beberapa file di dalam project dari  tempat penyimpanan Komputer kita (local) , ke dalam project yang tersimpan di repository (server).

Tapi tunggu dulu jika kalian memiliki kegagalan saat mempush  , atau kendala erorr dan server (Github) menolak project  kita seperti pada gambar dibawah:

git push error cmd Windows
git push error

Tenang kalian bisa mencari solusinya di forum diskusi tanya jawab.

Disini :

atau kalian bisa ketikan perintah berikut :

git reset –mixed origin/master
git add .
git commit -m “Upload Github Lagi”
git push origin master

 Jika berhasil maka tampilanya akan seperti ini :

git push sukses cmd Windows
git push sukses

Nah sekarang kita lihat ke akun github kita, Jika tampilanya seperti gambar dibawah. Maka project kita telah sukses di upload atau disimpan ke server (Repository) Github.

project sukses tersimpan atau terupload di Github
Oh ya kalian juga dapat mengkloning atau mendownload,  project Github kalian atau orang lain  lewat Command Line dengan perintah:

git clone <alamat git>

git clone alamat git
git clone

Tambahan jika kalian ingin melakukan perubahan atau penambahan :

  • 1. Jadi intinya gini jika kita ingin menambahkan folder ( harus berisi file ) atau file baru dan perubahan pada beberapa file ,kita bisa menampilkan status folder atau file tersebut dengan perintah: git status.
  • 2. Nah ketika status folder atau file tersebut terlihat maka akan di tandai dengan warna merah. Artinya folder atau file dalam mode (unstaged) belum di daftarkan ke system Git.
  • 3. Selanjutnya agar folder atau file tersebut terdaftar ke system git , dan beralih ke mode (staged) , yang dimana telah terjadi perubahan atau penambahan pada project, kita bisa mengetikan perintah git add <namafile> atau git add *.
  • 4. Setelah itu kita beri keterangan atau pesan, kepada system Git, bahwa terjadi perubahan pada project tersebut dengan perintah: git commit -m “Pesan kalian”
  • 5. Lalu baru lah kalian bisa mengupload atau menyimpan project kalian ke repository Github (Server), dengan mengetikan perintah : git push origin master.
Alur Langkah Langkah Mengupload Project ke Github
Alur Mengupload Project ke Github

Selengkapnya jika ingin melihat Basic Git Command lainya ( Perintah Dasar Git ):

Kurang lebih itu saja  tentang Cara Mengupload Project ke Github Melalui Command Line. Jika terdapat kekurangan disana sini mohon maaf sebelumnya. Terima kasih.