Blog Page

PHP Mime Type in Webmin Ubuntu

askadmin 0 Comments

After setting up a Fresh Ubuntu and Webmin over it. When you create a New Virtual Host your PHP sites might not be working properly.

This happens as PHP Mime type is not setup in Webmin by default. Do the following if you come across the issue.

First Install php mime
# sudo apt-get install php-mime-type

After you Install the mime type

  1. Goto Apache Webserver
  2. Click on global config tab
  3. Click on Mime Types
  4. Click on Add a new MIME type
  5. On Mime Type textbox : application/x-httpd-php
  6. On Extensions textarea : php php5
  7. Click on Save
  8. Return to Apache Webserver and click on “Apply Changes” (mostly Second Button on Top Right)

Now your PHP sites should work fine.

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 install -y 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 | 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

command [options] [arguments]

-h, –help Display this help message


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

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
# sudo mkdir

Now lets add the host entry in Apache2

# cd /etc/apache2/sites-available
# sudo vi

Insert the Code below

<VirtualHost *:80>
# This is your domain name

# 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


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
# 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

Now open the browser of your choice and type

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.