Author: Prashant Walke

Software Engineer I loves writing articles and sharing tips about WordPress.

Why WordPress Website Backup Is Important?


WordPress has made it possible with its simplicity and ease of use for anyone to have a blog or set up a website. But due to wide range of threats or hacker attack most of blogger and developer face security issue with there site.

There are several methods used to protect the WordPress site. One of the most popular solutions among all is using WordPress Backup and Security plugins.

Unfortunately, many new WordPress users do not take backing up as seriously as they should. This is sometimes down to the assumption that everything will be ok. Others have looked into backing up their files and decided it was either too time-consuming or too costly. In reality, if something with your website goes wrong, you could lose everything.

It’s common for website owners to not take backups seriously until something goes WRONG. It is a hard lesson that they never forget. If you are smart, you will get into the habit of backing up your website from the beginning.

Having a backup with a click can mean having a fully restored website in just minutes.

Taking backup is helpful in certain ways. Here is why is taking a backup important,

  • Threat from the Hackers
  • A Catastrophe in your computer
  • When your updates go wrong
  • Viruses, trojan and other malware can hit your PC
  • An error occurred by an employee due to negligence

At times our website might experience downtime due to a server failure or hard disk crash. These are more common than people think, and without a solid reason your website can just go offline. No hosting company in the world can offer 100% uptime and reliably. In these situations a fresh backup saves you a lot of hair pulling and headaches. Don’t rely on your hosting to have the latest version of your website, but make sure you do.

WordPress is software, and it runs on PHP and MySQL. All the files are stored on your web-hosting company. As a rule, anything that is related to computers and web hosting can crash any day. A hacker might hack your server or website, or someone can log in and delete your complete WordPress directory. In the end, you will be left with nothing except a feeling of sorrow for never creating a WordPress blog backup. All of your hard work will be gone

Your database contains all your important information if the database is erased or corrupted you lose everything.

Sometimes accident can happen when we least expert it. If you can have made a careless mistake and your database is gone how can you restore your data in your database?

When you are tired the wrong files can easily get overwritten or deleted. A simple MySQL command with an error can cause lots of data to be wrongly updated. When mistakes like this happen, and don’t think they won’t happen to you, you will be glad that you have a recent backup.

Hackers hack most often for financial gain, think of it as online pick pocketing. You can also be hacked to place unwanted advertisements on your website, send people to wrong websites, replace legitimate banners, or bury you with spam email. Don’t think just because your website is about your stamp collection, that hackers wont use it to target websites that are more valuable to them. The result: your website gets blacklisted!

Most of time we use free nulled theme plugins on WordPress site and this is trap to hack your site. Most of nulled script having chance to hack your site. Using this script hacker can create file on your server, edit your site content, access database, create user in database, change contain, fetch your important data, recursively create file and folder inside your code, add there links and Spam data in to your site. so always avoid those script and keep regularly backup your files and data.

Most of All websites are vulnerable to hacking attempts, DDOS attacks, data theft and data loss. No matter how secure your website is.

This is the main thing backup is done for. So that you can blog without any worry of that particular thing getting deleted and not coming back. The settings being change and you forgetting what were they, etc. Taking backups of your blog lets you enjoy healthy blogging free of worries and tensions so that you can actually have fun while you are at blogging.

When you are blogging with the latest backup already taken, you know that even if any problem occurs with the latest thing you are doing, you can revert to the older version of blog without any problems. You can focus on new posts ideas, etc without worrying about loosing your blog’s content in times your hacking attempts or server failure. Just needs few clicks and your blog goes back online.

I have listed some point which is very important to WordPress site :

  • In the WP-content folder, you can exclude those themes which you are not using so it minimize backup size.also exclude test or dummy media files unwanted plugins etc.
  • It is important to back up your websites regularly. Backing up to your personal computer every day is not always practical, particularly if your website uses a lot of storage. A more practical solution is to use an external service to backup your files.
  • At time of create backup keep in mind Your backup files should be stored on a remote and reliable place. It should not be kept on the same server where your blog is hosted. it’s very important.
  • Set Auto Backup automatically on a repeating schedule so you will get always fresh backup.
  • Remove oldest backup from your hosting to avoid wast hosting space. Download or store backup on other place and remove older backup form hosting or keep only few backup on hosting after moving it to other remote storage.
  • Always keep your backup safer place to prevent download your backup from hacker. Config file contain database information so be sure your backup file is safe.
  • If you are running any e-commerce site or any business site and your are regularly add content and media files , products on your site then you need to take regularly database backup as well as file backup.
  • Before update latest WordPress, Plugin, Theme always take backup to prevent conflict, wrong update, Plugin/Theme comparability issue.
  • Before start new development on site or any changes or issue fixes always create backup.

Necessary files to backup in WordPress:

WordPress a web application in view of PHP and MySQL and thus you have to take backup of all the documents and its database as an alternative to your site.

WordPress Backup contain following main two parts :

  • WordPress files stored on your server
  • WordPress database

How To Manually Backup WordPress?

The simplest approach to duplicate your documents is by means of FTP. Ensure that you spare all the documents and organizers in the catalog WordPress that is introduced into your site.

The WordPress database can be moved down to some other database. Just take after the directions in our instructional exercise on the most proficient method to backup MySQL databases. In fact, if you have numerous MySQL databases and you ponder which one your site is utilizing, open the wp-config.php record in the WordPress root organizer and you’ll see the database name spared by the DB_NAME alternative.

Take Manually Backup WordPress Database with phpMyAdmin.

Create backup via FTP and phpMyAdmin is time consuming process and difficult to do backup regularly via this process.

How To Backup WordPress using plugin?

There are a number of WordPress backup plugins that will backup your a zipped version of your website to your server. There is no real benefit to doing this if your hosting company offers daily backups as the backup file will be stored on your main hosting package. So if your website goes offline or hosting plan is over, you will not be able to access the backup file.

WP Database Backup plugin helps you to create Database Backup and Restore Database Backup easily on single click.Manual or Automated Database Backups And also store database backup on safe place- Dropbox,FTP,Email,Google drive, Amazon S3

WP All Backup plugin helps you to create Backup and Restore Backup easily on single click.Manual or Automated Backups And also store backup on safe place- dropbox,FTP.

Creates a Backup of your entire website: that’s your Database, current WP Core, all your Themes, Plugins and Uploads.

Conclusion :

Do not think that because nothing bad has happened to your website in the past, nothing bad will happen in the future. Incidents usually occur when you least expect them. When they do, you will find out quickly that they are time-consuming, stressful and costly. Be smart and back up your WordPress website frequently. You will be glad you did.

One of the most important things in running a website successfully is always having a fresh backup.

Export To CSV File – PHP


CSV is a simple file format that is widely used by IT Professional, business, and all who are familar with computer. Those who use computer in day to day life, they know how to use CSV/Excel. Among its most common uses is to move tabular data between programs that naturally operate on a more efficient or complete proprietary format. This file is easily readable even in mobile with use of some basic apps.

In Web Technology fileld,  number of times we have the send Stats, Logs and detail to our client in Form of CSV files.  Event may times we got the Text in form of excel/CSV Fle.
Now, Export the PHP data into CSV is very simple. Just  you need to do few simple steps.
  1. Save into into PHP multidimensional array
  2. Set the header
  3. Now, render the rows and then render EOL (First Row)
  4. Now, render the rows and then render EOL (Second Row)
  5. Now, render the rows and then render EOL  (Third Row and so on)
 Here EOL is End of Line.

$lists = array(
    array(
        'Web', 'Technology', 'Experts', 'Notes',
    ),
    array(
        'Web1', 'Technology1', 'Experts1', 'Notes1',
    ),
    array(
        'Web2', 'Technology2', 'Experts2', 'Notes2'
    ),
    array(
        'Web3', 'Technology3', 'Experts3', 'Notes3',
    ),
    array(
        'Web4', 'Technology4', 'Experts4', 'Notes4',
    ),
    array(
        'Web5', 'Technology6', 'Experts5', 'Notes5',
    )
);

header("Content-type: text/csv");
header("Content-Disposition: attachment; filename=csv.csv");
header("Pragma: no-cache");
header("Expires: 0");

//header
echo  "Title1, Title2,Title3, Title4 \n";

foreach ($lists as $list) {
    echo implode(',', $list);
    echo PHP_EOL;
}

WordPress Web Development Advantages


1. Flexibility and lower cost of development: Being an open source CMS WordPress is free, does not involve licensing cost and has no restrictions on modifications, additions or changes to the code.
2. Customizable: WordPress CMS is the ideal platform to build websites customized to any requirements or budget,be it a small individual website, blog, an e-commerce website or a complex web portal optimized for search engines.
3. WordPress has a large pool of themes and ready-made plugins.
4. Using WordPress you can build powerful, intuitive, interactive, visually engaging and feature rich websites as it has rich in text editors as well as rich multimedia support like high definition images, audio, video, animation,etc.
5. It is easy to use, configure and setup, it is simple & convenient and does not need specialized programming kills.
6. WordPress comes packed with all core features like membership management and content management and provides powerful search engine optimization features built in to the site to handle traffic intensive websites capable of handling high loads while still remaining responsive.
7. WordPress provides multi-lingual support and easy administrative interface for managing websites including multi user accounts, role assignments, workflows, menu management, and layout customizations.

Redirection


In previous articular we have discus Migrate site from ASP to WordPress

After successfully migration your ASP site to WordPress it’s important to maintain redirection. Because If you have an old url ranking is good in Google and move to a new, permanent location, a 301 redirect can pass the search engine ranking score of the old ranking URL (not abruptly; it will take time) to the new URL. Hence the new URL will appear and start to rank in the search engine results, replacing the old URL.

Before discuss on this topic need to know about Permalink

Permalink means “Permanent Link”. It is a unique URL for each article on your blog. Even if you publish two posts with the same title, they get different permalinks.

A permalink is generated when you hit the publish button for a post or page. It remains the same after publishing, even if you make changes to the title. That is why it is called a permanent link!

On the Internet, a permalink represents a unique address for each of your blog posts and other stuff. So if a permalink breaks, your visitors will be lost.

Similarly on the Internet, if a permalink breaks, the visitors coming from search engines, social media, bookmarks, backlinks from others posts will be lost.

 

Maintaining Permalinks

Try to set your permalink to similar to your old site url.

 

As you know by now, when you move your site from (ASP) to WordPress, permalink structure gets altered. you can use some WordPress plugin for redirection.

But there are Few known limitations of redirecting permalinks are:

  • Facebook/Twitter count will reset for sure. New permalink will have all zeros.
  • Google pagerank for new permalink will be zero. New permalink may gain Google pagerank over the time but big risk.
  • Human visitors will notice delay in opening your posts on WordPress. Delay will be obvious if they are using slow Internet connection.

If you do not take any extra effort to use to maintain permalink and redirection then you will loose traffic, ranking and of-course Google AdSense revenue from your blog.

Google pagerank can be retained if you maintain permalink and redirection.

 

Improve Ajax Performance


Following are few steps to Improve Ajax Performance

  1. First try to Reduce the Number of Ajax Call
  2. If same call send again, abort the previous call
  3. If ajax call is executing, and user go for another link, then cancel the previous one.
  4. Use GET Method, As its Fast but less secure
  5. Reduce the Amount of data transmitted
    a. Only Required parameter in Ajax Request
    b. Only Required Response in Ajax Request
  6. Optimize your Server

How To Fix Headers Already Sent Error In PHP?


We are here to fix below error in PHP
Warning: Cannot modify header information – headers already sent by (output started at E:\wamp\www\testp\public_html\test.php:2) in E:\wamp\www\testp\public_html\test.php on line 4

Question: Why this Error comes? This error comes when sending header after the output.
OR
using “header” function after the output.

Question: Give an example when this error comes?

echo "arun";
header("Location: next.php");

Question: How to fix this error?
When you are using header function to send header, make sure you have not any output before. In another words, header function must be called first in any script(if applicable). you can not send header after the output. For Example: below will work 
header("Location: next.php");
echo "arun";
Question: Is there any another way to fix this error?
Yes, you need to set the output_buffering "on" (By default it is off)


Question: How to set output_buffering on in PHP?
ini_set('output_buffering','On');

Question: How to set output_buffering on in php.ini?
output_buffering = Off
replace with
output_buffering = On

Question: How to set output_buffering on in htaccess?
open you .htacces file and add following code.
  php_value output_buffering On

REST API


Representational state transfer (REST) is the software architectural style of the World Wide Web.It relies on a stateless, client-server, cacheable communications protocol — and in virtually all cases, the HTTP protocol is used.

REST is a lightweight alternative to mechanisms like RPC (Remote Procedure Calls) and Web Services (SOAP, WSDL, et al.).

Despite being simple, REST is fully-featured; there’s basically nothing you can do in Web Services that can’t be done with a RESTful architecture. REST is not a “standard”. There will never be a W3C recommendataion for REST, for example. And while there are REST programming frameworks, working with REST is so simple that you can often “roll your own” with standard library features in languages like PHP, Perl, Java, or C#.
REST was defined by Roy Thomas Fielding in his 2000 PhD dissertation “Architectural Styles and the Design of Network-based Software Architectures”.
REST is the underlying architectural principle of the web. The amazing thing about the web is the fact that clients (browsers) and servers can interact in complex ways without the client knowing anything beforehand about the server and the resources it hosts. The key constraint is that the server and client must both agree on the media used, which in the case of the web is HTML.

An API that adheres to the principles of REST does not require the client to know anything about the structure of the API. Rather, the server needs to provide whatever information the client needs to interact with the service. An HTML form is an example of this: The server specifies the location of the resource, and the required fields. The browser doesn’t know in advance where to submit the information, and it doesn’t know in advance what information to submit. Both forms of information are entirely supplied by the server.

So, how does this apply to HTTP, and how can it be implemented in practice? HTTP is oriented around verbs and resources. The two verbs in mainstream usage are GET and POST, which I think everyone will recognize. However, the HTTP standard defines several others such as PUT and DELETE. These verbs are then applied to resources, according to the instructions provided by the server.resources being manipulated using a common set of verbs: HTTP methods are the commonly seen case – the venerable Create, Retrieve, Update, Delete becomes POST, GET, PUT, and DELETE

For example, Let’s imagine that we have a user database that is managed by a web service. Our service uses a custom hypermedia based on JSON, for which we assign the mimetypeapplication/json+userdb (There might also be an application/xml+userdb andapplication/whatever+userdb – many media types may be supported). The client and the server has both been programmed to understand this format, but they don’t know anything about each other.

The REST API lets you interact with Parse from anything that can send an HTTP request. There are many things you can do with the REST API. For example:

  • A mobile website can access Parse data from JavaScript.
  • A webserver can show data from Parse on a website.
  • You can upload large amounts of data that will later be consumed in a mobile app.
  • You can download recent data to run your own custom analytics.
  • Applications written in any programming language can interact with data on Parse.
  • You can export all of your data if you no longer want to use Parse.

Cloud Computing (Salesforce) and Salesforce Integration with PHP


Cloud computing is Internet-based computing, whereby shared resources, software, and information are provided to computers and other devices on demand, like the electricity grid.

Cloud computing is the use of computing resources (hardware and software) that are delivered as a service over a network (typically the Internet).

As a metaphor for the Internet, “the cloud” is a familiar cliché, but when combined with “computing,” the meaning gets bigger and fuzzier.

Some analysts and vendors define cloud computing narrowly as an updated version of utility computing: Basically virtual servers available over the Internet.

Benefits of Cloud

  • Lower Costs – Cost savings that come with economy of scale
  • Scale as Needed – As your applications grow, you can add storage, RAM and CPU capacity as needed.
  • Cap-Ex Free Computing cash flow by eliminating the capital expense associated with building the server infrastructure
  • Deploy Projects Faster – Because servers can be brought up & destroyed in a matter of minutes.
  • Lower Maintenance Costs driven by 2 factors: Less hardware and outsourced, shared IT staff.
  • Resiliency and Redundancy –you can get automatic failover between hardware platforms and disaster recovery services
  • Guaranteed “up time“
  • Software upgrades are provided with no cost and avoids obsolescence
  • More available Capital to promote business growth

Cloud service models

cloud

Cloud Service Available

The Cloud fits into a broad categorization of service offerings split out into,

Infrastructure as a Service (e.g. Amazon EC2 and Rackspace),

Platform as a Service (e.g. App Engine)

Platform as a service (PaaS) is a category of cloud computing services that provides a computing platform and a solution stack as a service. The provider provides the networks, servers, storage, and other services that are required to host the consumer’s application

Software as a Service (e.g. Salesforce.com).

Software as a service (SaaS) is a software distribution model in which applications are hosted by a vendor or service provider and made available to customers over a network, typically the Internet.

cloud_services

The Fear of Cloud

  •   72% cited Security concernscloud_use_graph
  •    34% selected Integration issues
  •    14% cited TCO
  •     8% none of the above

 

Security of customer data has been the #1 priority of Saas companies today.

They maintain the highest security standards at three levels: Application Security, Facilities security & Network securitysalesforce

Salesforce

Salesforce.com is the Enterprise Cloud Computing Company.

  • Salesforce is originally a Customer Relationship Management (CRM) software.
  • CRM is originally software for managing customer interaction, such as scheduling tasks, emailing, texting, and many more tasks.
  • Salesforce grew into a cloud software solution and acquired several other companies for Paas and Saas.

Salesforce is also 3-tier, but many of the internals are handled through abstraction. There are:

1) Out-of-box interfaces, which include security, dashboards, workflow, and user interfaces. Coding is optional.

2) VisualForce is an editor for customization of User Interfaces if not out-of-box.

Visualforce is a framework that allows developers to build sophisticated, custom user interfaces that can be hosted natively on the Force.com platform. The Visualforce framework includes a tag-based markup language, similar to HTML, and a set of server-side “standard controllers” that make basic database operations, such as queries and saves, very simple to perform.

3) Apex, using the developer console, is for writing code to the Salesforce API, for example a SOAP or batch application for importing custom data.

Apex is a strongly typed, object-oriented programming language that allows developers to execute flow and transaction control statements on the Force.com platform server in conjunction with calls to the Force.com API. Using syntax that looks like Java and acts like database stored procedures, Apex enables developers to add business logic.

Salesforce in Business

Salesforce in Business

Salesforce Offers

Sales Cloud 2Sales Cloud 2 :  

The world’s #1 sales application

Give reps, managers and execs everything they need to focus on what’s important: more selling and less administration.

  • Close more deals — faster
  • Gain real-time visibility into sales
  • Collaborate instantly and know what matters

 

Service Cloud 2Service Cloud 2 : 

The future of customer service

Provide faster, more responsive service across every channel — from the call center to the social Web.

With the Service Cloud 2, you can:

  • Keep agents productive
  • Reduce service costs
  • Satisfy every customer

 

ChatterChatter :  

The real-time Collaboration Cloud

Chatter is a brand-new way to collaborate with people at work. Where the status of important projects and deals are automatically pushed to you — so you’re always in the loop.

  • Share securely and collaborate instantly
  • Stay on top of what matters most
  • Gain insight and make smarter decisions

 

Force.comForce.com : 

The leading cloud platform for business apps

Give developers a platform to create rich, collaborative cloud apps fast—without buying hardware or installing software.

  • Build apps 5 times faster, at 1/2 the cost
  • Deploy apps easily to anyone, anywhere
  • Make apps instantly collaborative and mobile

Salesforce Integration with PHP

  • Web Services API
  • PHP Toolkit

We can easily access the salesforce objects, fields & data using below is the basic steps to Integration Between Salesforce and PHP.
STEP 1:
Salesforce providing support to PHP and delivered the PHP Toolkit. Using this toolkit we can connect with salesforce and perform all API operations supported like Insert, Update, Delete, Retrieve the data and much more.

STEP 2:
Salesforce PHP Toolkit Requires is,
PHP 5.x
SOAP Enabled
SSL Enabled
cURL Enabled
OpenSSL Enabled

STEP 3:
Download the latest PHP toolkit using below URL

PHP Toolkit: http://wiki.developerforce.com/page/Force.com_Toolkit_for_PHP
unzip the folder(soapclient Folder) and paste it in your PHP Htdocs Folder (Ex: PHP Project Folder Name is “PHP_SFDC”)

STEP 4:
The WSDL file can be downloaded from wihin your SALESFORCE Org. Once you login to Salesforce, go to Setup > App Setup > Develop > API and then you can generate a Partner WSDL or Enterprise WSDL file from there and and save it to your PHP Project Folder(www/Htdocs/PHP_SFDC/partner.wsdl)

STEP 5:
In PHP Project Folder (PHP_SFDC), Create a new File called getRecord.php file and save it to www/Htdocs/PHP_SFDC/getRecord.php path

add the following lines to getRecord.php file

Retriving the Salesforce Contact Record using PHP
<?php
ini_set("soap.wsdl_cache_enabled", "0");
// PHP Tool Kit class scripts to login to Salesforce Org
require_once ('../includes/soapclient/SforcePartnerClient.php');
require_once ('../includes/soapclient/SforceHeaderOptions.php');
// Salesforce Login information
$wsdl = 'partner.wsdl.xml';    // PARTNER WSDL FILE PATH
$userName = "salesforce username";
$password = "salesforce password"; // PASSWORD SHOULD BE COMBINATION OF "PASSWORD + SECURITY TOKEN", if it's a Developer ORG.
// Process of logging on and getting a salesforce.com session
$client = new SforcePartnerClient();
$client->createConnection($wsdl);
$loginResult = $client->login($userName, $password);
//Then perform to get your Contact records from Your Salesforce ORG
$query = "SELECT Id, FirstName, LastName, Phone from Contact";
$response = $loginResult->query($query);
foreach ($response->records as $record)
{
echo '<tr>
<td>'.$record->Id.'</td>
<td>'.$record->fields->FirstName.'</td>
<td>'.$record->fields->LastName.'</td>
<td>'.$record->fields->Phone.'</td>
</tr>';
}
?>