How can I downgrade from PHP 7 to PHP 5.6 on Ubuntu 16.04?

Standard

Assuming libapache2-mod-php is a suitable way to enable PHP in Apache for you, you can proceed in this way:

sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install php7.0 php5.6 php5.6-mysql php-gettext php5.6-mbstring php-mbstring php7.0-mbstring php-xdebug libapache2-mod-php5.6 libapache2-mod-php7.0

yes ” | sudo update-alternatives –force –all

Switching PHP VERSION:

  • From php5.6 to php7.0:
    • Apache:
      sudo a2dismod php5.6 ; sudo a2enmod php7.0 ; sudo service apache2 restart
      
    • CLI:
      sudo update-alternatives --set php /usr/bin/php7.0
      
  • From php7.0 to php5.6:
    • Apache:
      sudo a2dismod php7.0 ; sudo a2enmod php5.6 ; sudo service apache2 restart
      
    • CLI:
      sudo update-alternatives --set php /usr/bin/php5.6

How To Install and Configure Redis on Ubuntu 16.04

Standard

Introduction

Redis is an in-memory key-value store known for its flexibility, performance, and wide language support. In this guide, we will demonstrate how to install and configure Redis on an Ubuntu 16.04 server.

Prerequisites

To complete this guide, you will need access to an Ubuntu 16.04 server. You will need a non-root user with sudo privileges to perform the administrative functions required for this process. You can learn how to set up an account with these privileges by following our Ubuntu 16.04 initial server setup guide.

When you are ready to begin, log in to your Ubuntu 16.04 server with your sudo user and continue below.

Continue reading

Install composer on ubuntu

Standard

Then, assuming Composer is already installed
<br />
$ curl -sS https://getcomposer.org/installer | php — –install-dir=/usr/local/bin<br />
$ ln -s /usr/local/bin/composer.phar /usr/local/bin/composer<br />

$ composer global require "phpunit/phpunit=4.1.*"
$ composer global require "phpunit/php-invoker=~1.1."

next, find the “.composer” directory, mine was in my home directory, and create a symbolic link so we can call it from the command line like so: $phpunit

$ sudo ln -s  ~/.composer/vendor/phpunit/phpunit/phpunit   /usr/bin/

How to convert .CR file to .jpg on Ubuntu

Standard

This simple tutorial will show you how to convert PNG to JPG in Ubuntu, so that it reduce the memory size and speed up loading image time.

1.) Install the required package by running below command in terminal

apt-get install ufraw

2.) cd <dir of cr2>

3) Here the command :

for i in *.CR2; do ufraw-batch $i –out-type=jpeg –output $i.jpg; done;

Upgrade mysql 5.5 to 5.6 ubuntu 14.04

Standard

step 1 : take a backup

mysqldump –lock-all-tables -u root -p –all-databases > dump.sql

step 2 : remove old mysql

sudo apt-get remove mysql-server
sudo apt-get autoremove

step 3 : install new version of mysql

sudo apt-get install mysql-client-5.6 mysql-client-core-5.6

sudo apt-get install mysql-server-5.6

step 4 : restore your data

mysql -u root -p < dump.sql

How To See Crontab

Standard

You can create a cron.log file to contain just the CRON entries that show up in syslog. Note that CRON jobs will still show up in syslog if you follow the following directions.

Open the file

/etc/rsyslog.d/50-default.conf

Find the line that starts with:

#cron.*

uncomment that line, save the file, and restart rsyslog:

sudo service rsyslog restart

You should now see a cron log file here:

/var/log/cron.log

Cron activity will now be logged to this file (in addition to syslog).

Note that in cron.log you will see entries for when cron ran scripts in /etc/cron.hourly, cron.daily, etc. – e.g. something like:

Apr 12 14:17:01 cd CRON[14368]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)

However, you will not see more information about what scripts were actually ran inside /etc/cron.daily or /etc/cron.hourly, unless those scripts direct output to the cron.log (or perhaps to some other log file).

If you want to verify if a crontab is running and not have to search for it in cron.log or syslog, create a crontab that redirects output to a log file of your choice – something like:

01 14 * * * /home/joe/myscript >> /home/log/myscript.log 2>&1

This will redirect all standard output and errors that may be produced by the script that is run to the log file specified.

link -> http://askubuntu.com/questions/56683/where-is-the-cron-crontab-log

How To Restore MongoDB

Standard

Mongo db is raw data, so it’s different with mysql .

Restore mongoDb data is simple to restore it:

– mongorestore –db {name your mongodb}  {your dump path db like ~/mike/mongodb/dump/}

BackUp :

– First stop the process mongodb, On ubuntu you can type sudo service mongodb stop

– After stop process create folder you want to backup

– cd {your folder}

– mongodb –db {your mongodbname}

Referensi: http://www.thegeekstuff.com/2013/09/mongodump-mongorestore/

Mysql adding user for remote access

Standard

IN order to connect remotely you have to have MySQL bind port: 3306 to your machines IP in my.cnf. Then you have to have created the user in both localhost and ‘%’ wildcard and grant permissions on all DB’s as such . See below:

my.cnf

#Replace xxx with your IP Address 
bind-address        = xxx.xxx.xxx.xxx

then

CREATEUSER'myuser'@'localhost' IDENTIFIED BY'mypass';CREATEUSER'myuser'@'%' IDENTIFIED BY'mypass';

Then

GRANTALLON*.*TO'myuser'@'localhost';GRANTALLON*.*TO'myuser'@'%';

Depending on your OS you may have to open port 3306 to allow remote connections.

Referensi link -> http://stackoverflow.com/questions/16287559/mysql-adding-user-for-remote-access

SQL Server On Ubuntu

Standard

Inspect Server Settings

There are three significant aspects that users may neglect, which lead to the failure of the connection to the SQL Server.

Enable TCP/IP Connection

To check whether your server enabled to TCP/IP connections:

Continue reading