March 14, 2015 asvignesh
First login to the ubuntu server via terminal or console To gain super user access, enter the following command and re-type the user password. sudo su – Type the following command to set the password for the Root user passwd root This will prompt user to enter the new password. and confirm password The terminal will return with Password updated successfully! Simply adding a password for root is not enough for Ubuntu 14.04+ Server. You need to edit /etc/ssh/sshd_config, and commend out the below line: PermitRootLogin without-password Add the following line: PermitRootLogin yes Then restart SSH: service ssh restart Yes…
February 7, 2014 asvignesh
This tutorial presumes that you understand what is a LAMP Server , how to deploy a web site and how to install software using Terminal and experience in running other Basic Terminal Commands. Root access To install any application you need root access , You can prefix sudo before every command or login to root user and execute the commands sudo -i Enter the password of your account Update You need to update the local repo by fetching indexes from remote canonical repos apt-get update Apache To install Apache you must install the Metapackage apache2. This can be done by…
July 21, 2013 asvignesh
Using Base64 encoded images in website Encode the image to base64 in php <?php $image = file_get_contents(“https://www.facebook.com/images/fb_icon_325x325.png”); $base64 = base64_encode($image); echo $base64; // This will echo the encoded base64 image ?> Load images in website using php: <?php $image = file_get_contents(“https://www.facebook.com/images/fb_icon_325x325.png”); $base64 = base64_encode($image); echo $base64; // This will echo the encoded base64 image ?> <img src= “data:image/png;base64,<?php echo $base64; ?>” > Using css background: background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAUUAAAFFEAYAAAAr5CMeAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAIGNIUk0AAG2YAABzjgAA+3UAAITUAAB6swAA/2cAADBbAAAQhVDPV6EAABJcSURBVHja7N1/dNX1fcfxd0KI4TdECFiCAioERKER/EWk0lpEB5Ra6wSROeuPqBymlnlcZzsPc5Yq/uJQpa6lHkXKOudRjvO0mbNWA6KzqKttkSq1/AgQUtQkhJCEZH/ce5slhForP5Lcx+OfzzEnDfEVT336vbnfb8bEolmzlz0ch9mIEYlz6tTEOXFi4hyZ/PjxxyfOXr0TZ1ZWAACkpYaGxFlVmTg3b06c72xMnKVrEmdJSfLjGw7Xd3KIg6xrduKcMydx3nh94jx9vB86AMCflWfJPuuX2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gZTAADQrL4uGYpVlcYAAKBZdXUyFLdsNQYAAM22bE2G4jsbjAEAQLMNG5Kh+PIaYwAA0Kx0TTIU/6vEGAAANCspSYbihuRLz7943SgAAOns9WQPvrOh1X0UH3rYOAAA6ay5B1uF4uMrEufvNhkJACCdbEr234oVBwnF+rrEedPNxgIASCc339yyBw/6CL/VqxPnypVGAwDozFK9l+q/Zh/zrOfi6xPnL//XiAAAnUmq76677mCf8TGhmHq030V/lTh//75RAQA6slTPpfquuvovDMWUrclH/E08N3G+/baRAQA6klS/pXpu68c+wjnzk/0B25Jf8JyJifOJFUYHAGjPUr129tkte+7jZf5lf2DqJek5VyTOmV9OnO+/74cBAHA0pW5z86Uvtey1g7/EfIhDsbVnnk6cI0Ymzqu+ljg96QUA4PB6Y33L/ioYlTgPfBfzJ5V1aL/R1H13fri85VlQkDinTEmcRcmXrkcmPz4kP3H26p38trL80AGA9NTQkDhTr+Bu3pw4N25MnKVrEmdJSeJMPYr50Pu/AQBZWmLMHTSOWQAAAABJRU5ErkJggg==); Advantage of using base64: The advantage lies in not having to open another connection and make a HTTP request to the server for the image. advantage for large numbers of very tiny individual…
May 1, 2013 asvignesh 1Comment
Taking backup dump and importing the dump into database can be done very easily using php. In Last posts i explained how to take the backup of Mysql using php http://asvignesh.in/take-mysql-backup-using-php-passthru-function , http://asvignesh.in/take-mysql-backup-using-php Here is the function to import the sql dump into database function import_dump($folder_name = null , $file_name) { $folder_name = ‘dumps’; $path = ‘assets/backup_db/’; // Codeigniter application /assets $file_restore = $this->load->file($path . $folder_name . ‘/’ . $file_name, true); $file_array = explode(‘;’, $file_restore); foreach ($file_array as $query) { $this->db->query(“SET FOREIGN_KEY_CHECKS = 0”); $this->db->query($query); $this->db->query(“SET FOREIGN_KEY_CHECKS = 1”); } }
May 1, 2013 asvignesh 2Comment
In the last post i explained about taking the MySQL backup using php code , This post explains to take the backup of your MySQL database using the passthru function ( passthru documentation ) The passthru() function is similar to the exec() function in that it executes a command. This function should be used in place of exec() or system() when the output from the Unix command is binary data which needs to be passed directly back to the browser <?php $datestamp = date(“Y-m-d”); // Present date to append in the filename for the identification /* CONFIGURE THE FOLLOWING SEVEN…
May 1, 2013 asvignesh
One of the most important task of developer or administrators is to take backup periodically, Most of the hosting provider and cloud providers charge more for taking backup periodically , SaaS application developers or CMS developers can let the user to take the backup of the data using the interface. Here is the easy way to take the backup dump of the MySQL take_dump(‘DB_HOST’,’UNAME’,’PASS’,’DB’); /* backup the db OR just a table */ function take_dump($host,$user,$pass,$name,$tables = ‘*’) { $link = mysql_connect($host,$user,$pass); mysql_select_db($name,$link); //get all of the tables if($tables == ‘*’) { $tables = array(); $result = mysql_query(‘SHOW TABLES’); while($row = mysql_fetch_row($result))…
April 28, 2013 asvignesh
Here is the some tips for the web admins and the web developers to speed up the image heavy website The Major drawback in the Image heavy websites is it takes more time to load , user lose their patience and just navigate away from your website Don’t use Flash Animation is unnecessary, but if you feel you need it, try: Spritely, a free jQuery plugin that lets you create animation with HTML and JavaScript or create your own animated GIFs using Photoshop or GIMP ( Image editor ) Use storage service for images Most browsers will only load two or…
April 28, 2013 asvignesh 1Comment
Removing index.php in Codeigniter application url in godaddy shared hosting server Create the .htaccess file under root of application directory RewriteEngine on RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond $1 !^(index.php|robots.txt) RewriteRule ^(.*)$ index.php?/$1 [L] If you are getting “no input file specified” ( codeigniter / wordpress ) Login to godaddy account Goto hosting Under settings frame select file extension management Here you will find this “.php PHP 5.2.x FastCGI” click on edit button change it to “.php PHP 5.2.x” no need to change for .php5, .php4 Thats it  
April 21, 2013 asvignesh 1Comment
CodeIgniter is a powerful PHP framework with a very small footprint, built for PHP coders who need a simple and elegant toolkit to create full-featured web applications. If you’re a developer who lives in the real world of shared hosting accounts and clients with deadlines, and if you’re tired of ponderously large and thoroughly undocumented frameworks You can create a dynamic sub-domains store_name.asvignesh.in username.asvignesh.in Step 1: DNS Configuration First, we need to configure our DNS settings to make all subdomains resolve to a single address. If you are working on a live server, then you will have to change your…
April 14, 2013 asvignesh
Here is the solution to fetch the data from another Database instance in word press How To Use WPDB Class to connect and fetch data from another database host Let’s say you’ve installed wordpress into the database wp_wordpress and you want to fetch some data from another independent database which has nothing to do with wordpress (ex. mydb). Here’s how you can do it. Querying for Data Using WPDB Now, here’s the trick. You have to instantiate a new WPDB instance $mydb= new wpdb(‘username’,’password’,’db_name’,’db_host’); $rows = $mydb->get_results(“select columnName from tableName”); foreach ($rows as $obj) { echo $obj->columnName; } That saves…