Blog Page

Composer install in Ubuntu 14

askadmin 0 Comments

Composer is very popular package these days, most of web development projects require the same. Here are the steps to install composer on a Ubuntu 14 System

First update your package manager
# sudo apt-get update

Now check/install the following packages required for composer
# sudo apt-get git curl php5-cli

Now Download the composer installer using Curl and Install on /usr/local/bin folder so that its accessible globally for your login

# curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer

This will download and install composer in your system and you might see an output as below (you might have a different version of composer tough)

All settings correct for using Composer
Downloading 1.2.0…

Composer successfully installed to: /usr/local/bin/composer
Use it: php /usr/local/bin/composer

Now type “composer” in your terminal and you will find composer command list.


# composer

/ ____/___ ____ ___ ____ ____ ________ _____
/ / / __ \/ __ `__ \/ __ \/ __ \/ ___/ _ \/ ___/
/ /___/ /_/ / / / / / / /_/ / /_/ (__ ) __/ /
\____/\____/_/ /_/ /_/ .___/\____/____/\___/_/
/_/
Composer version 1.2.0 2016-07-19 01:28:52

Usage:
command [options] [arguments]

Options:
-h, –help Display this help message

Enjoy!

Install Java 8 on Ubuntu 14

askadmin 0 Comments

Ubuntu by default repository supports upto Java 7, so to Install Java 8 on your Ubuntu Box. Please follow the steps as below

  1. Add webupd8team Java Repository
    sudo add-apt-repository ppa:webupd8team/java
  2. Update apt get
    sudo apt-get update
  3. Run Oracle 8 Installer
    sudo apt-get install oracle-java8-installer

Once Setup is finished, check your installed Java Version

  1. Check Java Version
    java -version

Now configure default Java Environment

  1. Setup default Java Environment
    sudo apt-get install oracle-java8-set-default

Ref :: Ref Site

add new domain / subdomain / virtualhost in ubuntu apache2

askadmin 0 Comments

Let assume you want to add a domain yourdomain.com

To add a New Domain/Subdomain in Ubuntu Apache2, please follow the step below

Create seperate folder for your domain within /var/www/html (This is good practice to follow keeping your domain files in specific folder)

# cd /var/www/html
# sudo mkdir yourdomain.com
# sudo mkdir yourdomain.com/public

Now lets add the host entry in Apache2

# cd /etc/apache2/sites-available
# sudo vi yourdomain.com.conf

Insert the Code below
———————–

<VirtualHost *:80>
# This is your domain name
ServerName www.yourdomain.com

ServerAdmin webmaster@yourdomain.com
# This the path to same folder you created above as Document Root for your domain
DocumentRoot /var/www/html/yourdomain/public

# Available loglevels: trace8, …, trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>

once done hit ESC and then type wq (To write and save the file)

Now you have to enable the site in apache2


# sudo a2ensite yourdomain.com.conf
# sudo service apache2 restart

Now you have to add the domain in hosts file

# sudo vi /etc/hosts

Add this line in hosts file and save

127.0.0.1 yourdomain.com

Now open the browser of your choice and type yourdomain.com.

Note : Make sure you have index.html or index.php file in /var/www/html/yourdomain/public folder. As this will be your document root folder now so you should add all files related to your site there.

Set environment path in windows from command prompt

askadmin 0 Comments

To add environment path in windows operating system from command prompt.

# Open command prompt
# set PATH = %PATH%;C:\Yourfolderforpath\subfolder

%PATH% adds the value stored in your existing path.

; separator for you new environment variable

C:\Yourfolderforpath\subfolder is the location of the new environment you want to add (eg. c:\program files\mysql\bin)

Another MySQL daemon already running with the same unix socket

askadmin 0 Comments

Are you getting Database Error “Error establishing a database connection”.

Check your mysql log and try to restart your mysql service

"#/etc/init.d/mysqld restart"

If you get the message “Another MySQL daemon already running with the same unix socket”, preform the steps as below

#shutdown -h now

#mv /var/lib/mysql/mysql.sock /var/lib/mysql/mysql.sock.bak

#/etc/init.d/mysqld restart

Disable foreign key constraint in MySQL

askadmin 0 Comments

While creating, updating, deleting database tables or while inserting, updating deleting records in table we come across “foreign key constraint Errors”. ¬†Here is the work around to get our job done. The the lines below before and after your sql query.

SET FOREIGN_KEY_CHECKS=0;

YOUR QUERY

SET FOREIGN_KEY_CHECKS=1;