How to wipe all the tables and data in MySQL? Clean whole database

SET FOREIGN_KEY_CHECKS = 0;
SET GROUP_CONCAT_MAX_LEN=32768;
SET @tables = NULL;
SELECT GROUP_CONCAT('`', table_name, '`') INTO @tables
  FROM information_schema.tables
  WHERE table_schema = (SELECT DATABASE());
SELECT IFNULL(@tables,'dummy') INTO @tables;
 
SET @tables = CONCAT('DROP TABLE IF EXISTS ', @tables);
PREPARE stmt FROM @tables;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET FOREIGN_KEY_CHECKS = 1;

Will not work via phpmyadmin or any script. this has to be run in cmd/terminal

Quick Command

wget https://gist.githubusercontent.com/harshvardhanmalpani/e670a8de7aa81673364dd48f125cb9ac/raw/ce04b319bf1594d148d3346e1474119fe1cd1b3f/flushdb.sql

mysql -hYOUR_DATABASE_HOSTNAME -uYOUR_DATABASE_USER -p YOUR_DATABASE_NAME < flushdb.sql

Source:
https://gist.github.com/harshvardhanmalpani/e670a8de7aa81673364dd48f125cb9ac

How to filter and validate pincode in Indian woocommerce?

By default, Woocommerce only validates ZIP code of few countries only. Woocommerce stores in India, are thus invalidated in case of PINCODE inputs from customers. Here is how you can enable checking of pincode for India woocommerce:

Put the following code in your custom function file or child theme functions.php

add_filter('woocommerce_validate_postcode','validate_indian_postcode',10,3);

function validate_indian_postcode($valid, $postcode, $country){
	if($country=="IN")
			$valid = (bool) preg_match( '/^([0-9]{6})$/', $postcode );
  // checks your $postcode, if valid $valid will be true because of preg_match else false
  return $valid;
}

Reference:

https://github.com/woocommerce/woocommerce/blob/ef0f527b40dba539e982efff26211fa577a24cf9/includes/class-wc-validation.php#L44

Testing Configuration for Paytm Gateway Plugin India

Paytm Payment Gateway Testing Data

Online payment solutions for all your transactions by Paytm Woocommerce Plugin

Download the plugin here: https://github.com/Paytm-Payments/Paytm_Woocommerce_Kit

Enable/Disable
Enable/Disable Enable Paytm Payments.
Title
Title
Paytm
This controls the title which the user sees during checkout.

Description
Description
The best payment gateway provider in India for e-payment through credit card, debit card & netbanking.
This controls the description which the user sees during checkout.

Merchant Identifier
Merchant Identifier
<provided link below>
Merchant Id Provided by Paytm

Secret Key
Secret Key
<provided link below>
Merchant Secret Key Provided by Paytm

Website
Website
WEBSTAGING
Website Name Provided by Paytm

Industry Type
Industry Type
Retail
Industry Type Provided by Paytm

Channel ID
Channel ID
WEB
Channel ID Provided by Paytm

Transaction URL
Transaction URL
https://securegw-stage.paytm.in/theia/processTransaction
Transaction URL Provided by Paytm

Transaction Status Url
Transaction Status Url
https://securegw-stage.paytm.in/merchant-status/getTxnStatus
Transaction Status URL Provided by Paytm

API Keys

You can get your keys here https://dashboard.paytm.com/next/apikeys

API keys are unique credentials issued to every merchant. While MID is used as an identification used for all exchange correspondence, merchant key is used to encrypt every API request to Paytm and decrypt every response from Paytm. Ensure that you keep the merchant key on server side and should not be shared with anyone. In case API keys are compromised, please reach out to our helpdesk to get new API keys.

  • MID (Merchant ID) – Unique identifier issued to every merchant.
  • Merchant Key – This is a unique secret key used for secure encryption of every request. This needs to be kept on server side and should never be shared with anyone.
  • Industry Type ID – This is part of bank and paymode configuration done wrt to an account.
  • Website – This parameter is used to support multiple callback URLs to post the transaction response. Each URL needs to be mapped to a website parameter.

Test API Details are something like this:

  • Test Merchant ID WArHEFXXXXXXXXXXXXXX <–wont work
  • Test Account Secret Key XXXXXXXXOcv1u7P2 <- wont work

Testing Resources / Testing Instruments

Source: https://developer.paytm.com/docs/testing-integration

  • Testing Debit/Credit Card
Card NumberAny Visa or Master Card
Expiration Month & YearAny Future month and Year
CVV123
OTP123123
  • Testing Paytm Wallet Details
Mobile Number77777 77777
PasswordPaytm12345
OTPDoesn’t require 2nd factor authentication489871
  • Testing Netbanking Details
Bank NameAndhra Bank
User IDtest
PasswordTest

Note:
In case you are testing on production environment, use live paymode details to complete the transaction. Once the transaction is successful, you can initiate refund from the dashboard.

Your PHP installation appears to be missing the MySQL extension, required by WordPress

The error message “Your PHP installation appears to be missing the MySQL extension which is required by WordPress” can appear when you are using a PHP version which is incompatible with your scripts version. Meaning your WordPress installation is most likely outdated.

Since the ‘MySQL’ extension is no longer supported from PHP 7.0 and beyond, changing your PHP version to 5.6 or lower will fix the issue. This can be done via your website’s control panel’s PHP Configuration section.

So, let’s do it first and then we will see some probable causes of this error.

Steps:

Step 1- Login to your Cpanel.


Step 2- Find PHP PEAR Packages and click on it. and then click on show available modules.

Step 3- Find MYSQL and install the 3 extensions shown in the image above.

Step 4- Now Go to select PHP version.

Step 5- Now find MySQL (Use Ctrl + F), select it and save it.

That’s it. The problem is fixed. Let’s get to some probable causes of this error.

Probable causes of this error.

1. PHP’s MySQL extension not installed.

The quickest way to check if your PHP has MySQL support is to put the following code into a file called info.php in your site and access it from a browser.

<?
phpinfo();
?>

A MySQL section like this will be shown.
If it’s not shown there, then you don’t have the PHP’s MySQL extension installed.

In Ubuntu servers and RedHat compatible servers, use the following commands respectivly:

# apt-get install php5-mysqlnd

# yum install php-mysql

2. Check if PHP’s MySQL extension directory is misconfigured.

Another cause of the ‘Your PHP installation appears to be missing the MySQL extension which is required by WordPress’. could be that the PHP extension directory is not configured properly.

In order to fix this, locate which PHP.ini file is being loaded and ensure that the appropriate “extension_dir” value is being used. So let’s open up the info.php file we created in Step 1 via our web browser.

Look for the line called “Loaded Configuration File”. The file path noted there is the actual location to the PHP configuration file.

Now, look for the entry called “extension_dir“. It should either be commented, or it should have the correct path to PHP extensions. It should never be left blank.

If you are not sure, just comment the line, and restart the web server.

Simply updating PHP and WordPress might also solve the problem.

In case you are running PHP 5, run the following commands:

apt-get update
apt-get install php-mysql

Restart the appropriate service for the changes to take effect.

This may have solved your problem. Feel free to comment below.

Thank You.

Fix Error Too Many Redirects on WordPress Admin page or Blog

There are several cases for the cause and multiple solutions also:

1 Add these 2 lines in wp-config.php file

if (strpos($_SERVER['HTTP_X_FORWARDED_PROTO'], 'https') !== false)
$_SERVER['HTTPS']='on';

2 Edit these settings in database directly using PhpMyAdmin in table options or wp_options in option_id, option_name (1,siteurl) and (2,home)

wp_options table

3 You can do the same by Editing wp-config.php and adding these 2 lines

define('WP_HOME','https://example.com');
define('WP_SITEURL','https://example.com');

4 Fix your .htaccess file with default one
Check here for default .htaccess for wordpress

5 WP plugins every developer must have.

Hello everyone!

If you’re a web developer working with WordPress, read on to get five great plug-ins that can help in every aspect of the development process.

WordPress plugins for developers are rated highly by developers since they help make their work easier. I have researched and found these 5 WordPress plugins that stand out as the most useful plugins for developers.

While there is no scarcity of WordPress plugins in the world, I want to showcase some of the plugins that I think you code junkies out there may get some use out of and up your game.

So, let’s begin.

5 WP plugins for developers:

  • User Switching10 Best WordPress Plugins for DevelopersUser switching can be described as a developer’s best time saver. Ever wondered how to quickly login and log out from your WordPress site in order to view how other viewers see your website? You don’t have to keep logging in and out of your site, you can now use this plugin to switch between different users, saving you a great deal of time. This plugin allows you to switch between registered users without having to login in and out. With a click on a button, you can easily and quickly switch WordPress users.
  • Query Monitor query monster plugin for wordpress developers
    Query Monitor lets you view all the ongoing database queries, as well as the rows being affected. You can also view rewrite rules, hooks fired on the current request, PHP errors and warning and even template filenames and parts. Furthermore, Query Monitor is one of the very few WordPress plugins for developers that let you keep track of AJAX calls, REST API requests and redirects. So if you are working with the WP REST API plugin, Query Monitor can prove to be very useful.

     

  • Debug BarBest WordPress Plugins for Developers

    Put simply, Debug Bar helps you debug your WordPress site in the most efficient way. You can check for PHP errors, database errors, and requests, various cache options, too. Plus, the plugin description mentions a lot of add-ons that give you “more insight into, for instance, the registered Post Types, Shortcodes, WP Cron, Language file loading, Actions and Filters and so on.”

  • Developerplugins for developer_9This is the ultimate plugin for testing your WordPress development environment. This plugin checks and ensures that your development environment is configured correctly including the plugins, constants and other settings. This plugin helps developer develop by optimizing their environment and ensuring essential tools and plugins are installed.
  • WordFenceImage titleWeb security is very critical in the tech world nowadays. Cyber breaches may cause harm to the whole organization. As a developer, you need to take care of your website. WordFence will help you shield your web pages by building a firewall and malware scanner. The malware scanner checks core files, themes, and plugins for malware, bad URLs, backdoors, SEO spam, malicious redirects, and code injections.

For more helpful WP plugins, with their detailed review please visit: List of really good and important plugins for WordPress.

I Hope that it was helpful to you. If you want us to touch any topic regarding web development than please let us know in the comments below.

Thank you for reading this far.

How to install WordPress manually through Cpanel?

Hello Everyone.

This article is a step by step guide to install WordPress manually on your site through Cpanel.

Now you might ask, Why would you install it manually? when I can use the auto installer. Offcourse auto-installer is a great feature which reduces our effort.

These installers work great in many cases, but often stuff your site full of unwanted plugins and themes. In addition, these automated tools have a reputation for timing out or being completely unavailable at times, which can be frustrating if you’re on a deadline.

Also by doing manual work you get a better understanding of the system.

So, let’s start.

Wp manual installation: Steps.

Step 1: Download WordPress.

To be able to use WordPress CMS, you would need to download it from the official WordPress site. (WordPress.org)

Step 2: Upload WordPress.

Upload the downloaded package to your hosting account. This can be done in the following three ways:

  • Uploading via File manager. Within the File Manager, locate and navigate to that directory. From the toolbar of the cPanel, select “Upload” and browse for the file you downloaded from WordPress.org.
  • Uploading via FTP (file transfer protocol).
  • Uploading SSH (secure socket shell).
Step 3: MySQL DataBase. 

Create a MySQL database and user. For storing the data you will need to create a database which can be done using the below procedure.

  • Login to your Cpanel.
  • Under the database section, select the MySQL database wizard.
  • Create a Database and enter the database name. Click Next Step.
  • Create Database Users and enter the username and password. Click Create User
Step 4: Connect WP to DataBase. 

Now is the time to connect the database with WordPress. In order to do that fill up the details form step 3 in WordPress too.

  • On starting WordPress it will ask for important details to connect the database.
  • Enter the database username.
  • Enter the database password.
  • Choose the Database Host. You can get this info from your web host.

Submitting all this will connect your database to WordPress account.

Step 5: Script installation.

The last job is to execute the installation script from the installation page. You can find the script using either of the below URLs:

  • http://yourdomain.com/wp-admin/install.php
  • http://yourdomain.com/blog/wp-admin/install.php

That’s it. You have successfully installed WordPress to your site. Enjoy the best wp themes and plugins now.

I hope that this article may have helped you. We may talk about Softaculous in the near future so stay tuned.

Thank You.

Top CMS out there in 2018.

CMS:

A content management system is a software that helps us to manage our content and site.

You can literally manage everything from a blog to an e-commerce site, using CMS. You can manage an article if you have a blog, or manage your product if it is an e-commerce business.

It has made our life so easier that we just can’t imagine having a site without CMS. You can operate most CMS out there even if you have no prior technical knowledge.

Today we are going to talk about the top CMS in 2018, there features, flexibility and specifications because that’s what they are known for.

So, without any further delay let’s begin.

Top CMS:

  1. WordPress: This one goes without saying. Probably the best one out there. WordPress can make almost any kind of site either it is a blog, a real state site or an e-commerce. It can make anything under the sun. WordPress is the framework behind many of the websites and blogs you visit every day, including this one. .org Few of the key features are responsive design, social sharing features, multiple page styles, auto upgrade, and standard compliant coding. The one thing that makes it a CMS beast is plugins.
  2. Joomla: Joomla is a popular Content Management System. It is much more than just a powerful content management system. Besides, hundreds of extensions to enhance the functionality of any Joomla website, Joomla itself includes some powerful built-in features (or core features). Many times ranked as the 2nd best CMS after WP. zoomla Few key features are Rss, media manager, web links, search, banner management and, user management.
  3. Drupal: Drupal 8 takes an already terrific content management framework to ever greater heights for users, administrators, and developers. There’s a seriously sharp focus on user-friendliness, but the content presentation, new ways to create data structures, build APIs, multilingual capabilities, and the delivery of mobile accessibility out of the box? Drupal 8 brings those to the table too.  Few of the features are mobile first, multilingual ready, loading speed, javascript automated testing.
  4. Magento: Specific to make an e-commerce site. The large array of features is one of the main benefits of Magento. Through them, you can easily develop and manage a successful online store. Magento features like different payment engines and shipping options along with the international support and high security using an  SSL certificate will make your shop an attractive place for e-commerce.  The core features are checkout payment and shipping, analytics and reporting, marketing and promotional tools, and order management.
  5. OpenCart: OpenCart is an open-source shopping cart built on PHP/MySQL code. Distributed as a free eCommerce solution, OpenCart is a very user-friendly and effective platform that comes with a very intuitive and well-designed user-interface as well as a higher selection of extensions. Perfect for small businesses and medium-sized e-commerce stores, OpenCart is loaded with all the basic functions a user would need from an e-commerce solution.  Main features are, Product Reviews, Product Ratings, open source, multi-currency, automated image resize, 20+ payment gateways, and 8+ shipping methods.

One honorable mention is WIX. Very user-friendly having drag and drop interface.

SO, these were the top of 2018 CMS. You should choose one according to your needs.  Keep visiting for such more articles.

Thank You.

WordPress.com v/s WordPress.org : The difference.

WordPress:

The most popular CMS, yet there is one thing that keeps on confusing the newbies. And that is the difference between wordpress.com and wordpress.org.

I myself have been confused about the difference, which once made me choose the wrong one. (as per my needs.)

But I don’t want this to happen with you, hence here is an article to clear this thing out.

What’s the difference:

The very first difference is in the domain extension.

.org – organization (free for everyone)

.com – commercial.

This isn’t a hard and fixed rule, but you got the context.

The major difference:

The major difference is “who is hosting your site?” In wordpress.com your site is hosted by WordPress, whereas in wordpress.org you are hosting your site via a hosting provider.

WordPress.org

The WordPress software, located at WordPress.org, is a free, open source content management system. To use the WordPress.org software, you need to install it on a web server. And that’s the key difference between WordPress.com vs WordPress.org.

If you download WordPress from WordPress.org, YOU host it. You set it up with your own hosting provider and use it on your own website, which gives you a ton of flexibility. This is why WordPress.org is often also called self-hosted WordPress.

.org

WordPress.org has much better customization options. You’re able to install plugins, use custom website themes, and do just about anything you want with your site. You can also monetize your website however you want, which is great if you’re planning to make it a business.

WordPress.com

WordPress software located at wordpress.com is a blog website platform. This doesn’t need to be downloaded. You can have your site running right away just by signing up on the wordpress.com.

This is limited but free as long as you are ok with their branding. And if you want to the domain of your choice, pay for it. No plugin is allowed with a free version.

.com

With .com you won’t be able to install your own “plugins” or “themes” unless you pay for the expensive business plan. Plugins and themes are one of the most helpful things about the WordPress software because they make it easy to customize your site, so that’s a pretty big loss.

The final note:

Go with wordpress.org, if you want the best options and full control over your site.

I hope this was helpful to you. Thanks for reading.

Thank You

Deploying a live site with free Domain and Hosting.

Hello everyone!

In this article, we are about to create an entirely new site from scratch with free domain and free hosting.

I am going to create one for the sake of this tutorial, which you can visit to check at the end of this article.

Before we start, let me clear this for one last time: for the domain, we are using freenom.com and for hosting we are using 000webhost.com.

Let’s do it:

Domain registration:

At freenom.com you will get free domain name extensions like “.tk, .ml, .ga, .cf, and e.t.c”.

  1. Go to freenom.com and search for your free domain. We are going to use mytrialsite.tk for our tutorial. freenom
  2. Choose your preferred extension, checkout and continue.
  3. Sign in with your E-mail id, verify your account and set up your account details and click on complete order. freenom
  4. Go to service in the navigation bar and select My Domains from the drop-down menu. freenom
  5. There you have your registered domain. freenom

Getting the free Hosting:

Now we have our domain, so let’s get the hosting from 000webhost.com.

  1. Go to 000webhost.com and click on sign up for free. freenom
  2. Now you will be shown 3 hosting plans. Choose Free web hosting and continue. freenom
  3. Sign up with e-mail and enter your website name and verify your account. freenom
  4. Select Manage Website.  freenom
  5. Here you are in your dashboard. Now select “set web address“. Then it will ask you to upgrade but don’t. click on “It’s OK, I don’t mind 000webhost branding“. freenomwebhost
  6. Next, you will have two options – Own Domain and Buy-Domain. Select “Own Domain“. webhost
  7. At this point, it will ask you to park your domain. BE CAREFUL AT THIS POINT DON’T ENTER YOUR DOMAIN AND CONTINUE RIGHT NOW. I personally have troubled a lot here. Please mark my words don’t hurry here.

Pointing domain to your hosting:

First park domain to your hosting and then complete step 7 above.

  1. Go back to freenom, where you left it in step 5. click on “manage DNS”. freenom
  2. Under the drop-down menu of “management tools” choose “Nameserver”. freenom
  3. In Nameserver choose “use custom nameserver”. And enter these two nameservers: (ns01.000webhost.com ns02.000webhost.com). Continue by clicking on change nameserver. freenom
  4. Now is the time to enter the domain name in 000webhost at step 7 in the previous section. Back to 000webhost, enter your domain and click “park domain“. In most cases, it will be parked immediately or it may take up to an hour. webhost

Hurray:

The site is now live on the internet. To make it attractive and add some content you can install WordPress.

So, let’s see how to do it.

  1. Click on “Build Website”. webhost
  2. Select WordPress and install. Also, change admin username from admin to whatever you want. wpwp

That is it you are done. Now customize your site in WordPress. We are not gonna talk about WP settings here, but maybe in some other article.

Well you can check the site I used for this tutorial, it is live on the internet with some WP customization. Here is the link.

www.mytrialsite.tk

IT takes just 5 minutes to make your site live. There are other free hosting providers as well you can check the list here.

Tutes.club – 10 free web hosting service providers.

So, I hope that your free site will also be live on the internet very soon. If you liked this article then you can check out our other articles as well.

Thank You.