wordpress cron slowing site issue fixed

Many webmasters are facing wordpress cron slowing site issue. WordPress made in PHP, it has so provision for run the background job on certain time. WordPress made provision in CMS for task scheduler. For doing this for every request wp-cron.php is executing.

wp-cron.php is a virtual cron job executing file. This file may be checking for WordPress updates, sending email notifications, etc. WordPress will continue execute the wp-cron.php on each and every page load or request.

Due to execution on every request. Due to this, extra resource usage on your server. This cron job can take a minute or so to run, depending, on the size of the website. If your website doesn’t have a lot of visitors, it may not be an issue.

I have blogs which has huge traffic. Site slowness will impact your search engine ranking and site visitors.

What can be done to maximize the efficiency of the WordPress cron jobs? You can tell the WordPress installation that you’re going to handle the execution of the wp-cron.php file. We need to just use the following steps:

Open the wp-config.php file for editing and add the following line:

define('DISABLE_WP_CRON',
true);

I am using Linux VPS which has centos 6 version. So I started cron service using following command.

/etc/init.d/crond start

After that use following command to installation of cron

crontab -e

Cron has a specific syntax which is very easy to understand:

  • Minute
  • Hour
  • Day of month
  • Month
  • Day of week
  • Command to execute

Just copy and paste following code in your cron file. Following code will executing after every 1 hour instead of executing on every request of wordpress. Wp-corn.php will be executed after every 1 hour.

5 * * * * /usr/bin/wget https://purabtech.in/wp-cron.php?doing_wp_cron > /dev/null 2>&1

There are more samples which we can use in your cron file. Some samples as follows:

# hit this url to run the wordpress cron process every hour of every day

# this command will run at 12:05, 1:05, etc.

#curl https://purabtech.in/wp-cron.php > /dev/null 2>&1

#wget https://purabtech.in/wp-cron.php?doing_wp_cron > /dev/null 2>&1

above simple trick will solve the wordpress cron issue. I applied above changes to my site and this wordpress cron slowing site issue fixed.

Shared Hosting

If you are using shared hosting than using FTP program, you can change and replace wp-config.php file first. Use following steps:

1) Login to our control panel, manage your service and in the service controls area, click the Cron Jobs link.
2) Click the add new cron job button at the top right.
3) In the “Add New Cron Job” area, click the “Common Settings” drop-down menu select the option for “Once an hour”.
4) In the “Hour” drop-down menu, select “Every 6 hours”.
5) In the “URL” field, type in the following:

https://purabtech.in/wp-cron.php?doing_wp_cron

Note: do not forget to change domain instead of purabtech.in.

upgrade to mysql 5.7 in linux from old mysql version

In this tutorial we will show steps to upgrade to mysql 5.7 in linux. We have many server which are running on old mysql versions. What we want to do is, without loosing any data we want to upgrade mysql version.

We are using centos 6 as linux system for our servers. Following commands can be used for any linux os like fedora, debian, centos and redhat.

upgrade to mysql 5.7 in linux

First execute following command.
rpm -qa | grep mysql
Make a note of result. It will show you list of mysql programs which are installed on your system. In case of any issue this list will be with you.

Note: Before upgrading mysql version don’t forget to take mysql database backup of all databases.

Now download latest repository from mysql community server.
Go here and download repo https://dev.mysql.com/downloads/repo/yum/

Look for Red Hat Enterprise Linux 6 / Oracle Linux 6 (Architecture Independent), RPM Package
(mysql57-community-release-el6-7.noarch.rpm) You need to download this rpm.

Using following command you can install mysql 5.7 community repository.
rpm -Uvh mysql57-community-release-el6-7.noarch.rpm

After that stop mysql server using following command.
/etc/init.d/mysqld stop

After that update mysql community server on linux box. use following command.
yum update mysql-community-server

After that install or update following mysql 5.7 dependencies using following command
yum install gcc-c++ gperf uuid-devel libuuid libuuid-devel uuid boost-devel libevent libevent-devel

Install one another dependency of mysql server.
yum install mysql-community-libs-compat

Now your mysql server is updated to 5.7 version. First thing you need to do is check my.cnf file which is mysql configuration file. If my.cnf file is got replaced than put your old file and start mysql server using following command.
/etc/init.d/mysqld start

if mysql server is not starting than you need to start mysql server in safe mode using bellow command.

I faced many issues while mysql upgrade following is one of them. you can check mysql errrors in /var/log/mysqld.log file. I found following error.

InnoDB: pthread_create returned 11

I solved above issue by changing increase the stack size. I executed following command. which solved my issue.

ulimit -s 8192

mysqld_safe --skip-grant-tables &

Now it is time to upgrade your database to mysql 5.7 version. login to your mysql using root password.
mysql -u root -p

For upgrading your database use bellow command.
mysql_upgrade -u root -p --force

Congratulations! you successfully upgraded mysql version to 5.7 version.

How to manage job and blog together

Those who say that blogging is like cakewalk are actually lying. To be honest, How to manage job and blog together, same question is for me also. for a blog to grow, the blogger needs to put in hours of hard-work. Blogging is not just about putting together a list of articles and publishing them. There is more to it. Researching, Typing, Proofreading, Promoting, Networking etc are just parts of the big picture- Blogging! In short, the entire process is time-consuming!

How to manage job and blog together

Now, I’m not saying that blogging is rocket science! But it takes some effort, and more than that, time, to succeed in blogging. There are people, who make a living out of it! We call them pro-bloggers. They are free to devote 24 hours towards maintaining and enhancing their blogs.

But wait, you have a day job, haven’t you? Or you could be a student, who needs to attend classes every day. I know many part-time bloggers, who always complain about lack of time. They have day jobs/ schools/ colleges to attend. They blame the mediocrity of their blog on this very lack of time.

I’ve been through this scenario. I must say I’m still a student, but still manage to juggle my blogging activities and my student life! This is possible only due to some time management tips, scheduling and some other preparations. I’m just about to reveal my techniques to you all.

How to schedule your blogging activities

Since I’m a student, day times are devoted to attending classes (usually boring). I take on my blogging responsibilities during night/early in the morning. Here are some tips that’ll help you make a schedule :

Keep a Note Book and Pencil Handy

You might be thinking what a pencil and note-book has to do with blogging schedule. Wait, it is not for making a schedule! For blogging, you need articles related to your niche. Articles don’t appear magically out of thin air.

Quality articles are produced after various stages like typing, proofreading etc. But the first step involved in creating an article is finding the right topic to write about. Yes, you can write an article only if you have a topic/idea to write about, in your mind!

Such ideas can strike your mind literally anytime. It could be when- you are attending classes/at job/in bathroom etc. When ideas strike, take out the book and pencil and note them down, however silly they might be. I use the ‘Papyrus’ app on my mobile to scribble down topics and ideas that come to my mind. Always be ready to note down ideas related to topic. Work on only those topics, which you think can write well about.

1. Limit the frequency of updating your blog. Choose 2-3 specific days of a week for publishing new posts

It is necessary to update a blog regularly. But there is no written rule to do it daily. For the busy ones, I recommend to choose 2-3 days a week, for publishing new posts. Limit the frequency of updating your blog. Our aim is to slow down this process for the benefit of the blog!

Let us take an example. If I choose Monday, Thursday and Saturday as the days for publishing new articles, I’ve got ample amount of time to work on those articles.

On Tuesday, after arriving from work/college, you may take out your note-book and work on the article for couple of hours. This work can be done early in the morning too.

Thus you have Tuesday and Wednesday to research on the topic, develop an article and proof read it! On Thursday, as per our schedule publish it.

By following such a schedule, the frequency of new posts getting published will decrease. But it will definitely increase the quality of the content. In the long run, it is quality, not quantity, that matters!

2. Automate the task of Social sharing and bookmarking

With a clever schedule like the one I mentioned above, creating quality content is no more a problem. The problem that remains is- sharing and promoting content.

Promoting and sharing the blog posts on Social networking sites is very important. These sites create a ‘ripple effect’. When one visitor likes/shares a post, 10 others will take notice of it. This ‘ripple’ effect can drive in valuable traffic.

But sharing blog posts on all such sites is time consuming. But why bother when this process can be automated? WordPress bloggers can use Jetpack to auto-publish the posts on Social networking sites. Also check out this list of automatic and semi-automatic social sharing and bookmarking tools:

Jetpack by WordPress can be used to share blog posts on social sites automatically.

Hootsuite

SocialOomph.com for automatic Tweets, Facebook status updates

Try out socialmarker.com for easily submitting blog content to popular bookmarking sites

3. Creative and Productive ways to use remaining time

If you follow the scheduling tips and automated social sharing tips, I bet you’ll save a decent amount of time. Here is a list of very productive activities you must do utilizing this ‘saved’ time. Note that these activities also play a major role in making blogging a successful venture.

# Read useful blogs related to your niche and comment

This activity brings with it many advantages. First of all, you gain lots of useful information by reading such blogs. By commenting, your blog will get more exposure than before. The most important advantage is that commenting can be used for ‘networking’ with fellow bloggers! Through commenting, beneficial relations can be built.

# Re-share your old posts on social networking sites

Now that you have some time to spare, why not re-share your old, evergreen posts on social networking sites? It is a brilliant idea to re-share old posts on Facebook, Twitter and Google+.

# Make your presence felt on groups and forums

If you still have time to spare, try spending it wisely on various Facebook and G+ groups related to your blog’s niche. Be an active member, share content, ask questions and solve problems. Besides the groups on Social networking sites, become member of forums that are related to your niche.

That’s it guys. These are the basics of scheduling and time management you should address. I’m not saying to go for the exact same routine. Make changes and improve. Don’t let your busy schedule ruin your blog. If you have suggestions, feel free to make use of the comment section.

best wordpress responsive themes by mojo in 2016

In this article we collected best wordpress responsive themes by mojo. Now responsive wordpress themes are became so popular these days which is right also for website owners. There are free and premium wordpress themes are available for download. People mostly prefer to buy premium wordpress themes due to their support after purchase.

Here are some great resources of responsive wordpress themes.

101+ free magazine responsive wordpress themes

101+ Free wordpress responsive themes

100+ creative free portfolio wordPress themes

best wordpress responsive themes

we collected some premium responsive wordpress themes from mojo theme market. All are premium wordpress themes. Theme firm will give you the support and installation help and guide.

Newlyn – A Beautifully Feminine WordPress Theme

Newlyn - A Beautifully Feminine WordPress Theme

Newlyn is a beautiful, fully responsive WordPress theme, with a classy, feminine, and modern design, perfect for bloggers of fashion, photography, lifestyle and more! Newlyn is simple and understated, allowing your content to really speak for itself, and with stunning alternative header and blog layouts, you can change the look of Newlyn to suit you and your audience.

DEMO

Claire – Elegant & Personal Blog WordPress Theme

Claire - Elegant-Personal Blog WordPress Theme

Claire is a stylish and beautiful responsive WordPress blog theme perfect for any types of blog such as travel blog, photography blog, personal blog, news, fashion blog, food blog, tech blog. This theme has great styling options, 15 blog layouts, 4 top sliders, 4 header variations and more. Combine them to create a unique visual experience for your visitors.

Claire includes standard, image, gallery, audio and video post formats. It comes with 2 header variations for the single article page. Theme colors, fonts, logo and other features are easy to change via the WordPress theme customizer. Checkout the live preview to see it in action!

DEMO

GORKHA – Beautiful, Seo-Friendly WordPress Blog Theme

GORKHA - Beautiful-Seo-Friendly WordPress Blog Theme

A stunning theme that combines both aesthetics and functionality to provide great user experience. Gorkha is a beautiful blog theme with highly attractive color scheme, professional typography and well-balanced layout backed by a powerful customzation options available for the users to make changes easily to many aspects of the theme.

DEMO

Monstera – WordPress Blog + Ecommerce Theme

Monstera - WordPress Blog - Ecommerce Theme

Monstera is a minimalist WordPress theme with bold details and unique styling in all the right places. Whether you’re an established creative or are just launching your new biz, Monstera will highlight your content beautifully and grab the attention of your visitors!

DEMO

Sweet – WordPress Blogging Theme

Sweet - WordPress Blogging Theme

Responsive WordPress photography and blogging theme with a focus on content and readability that combines clean design and excellent user experience.
This theme can be used from the box or easily customized with native WordPress customizer. Features Three different blog layouts for your selection from theme customizer.

DEMO

Joyfully – Lifestyle & Fashion WordPress Blog Theme

Joyfully - Lifestyle - Fashion WordPress Blog Theme

Joyfully is all purpose wordpress blog theme which can be used for all your blogs like travel, food, life, programming, everyday, fashion and everything you want to blog about. With its powerful options you are able to chose among different layouts, page widths, pagination, colors and more. It has different header styles, different blog listings. blog listing and blog single widths. Theme is completely ready for multiple users usage as well.

DEMO

Dreamer – WordPress Theme

Dreamer - WordPress Theme

Responsive WordPress photography and blogging theme with a focus on content and readability that combines clean design and excellent user experience.
This theme can be used from the box or easily customized with native WordPress customizer.

DEMO

Forester – A Stylish WordPress Theme

Forester - A Stylish WordPress Theme

Forester – is a minimal and stylish WordPress theme. It is suitable for any kind of blog, personal, food, travel, photography, publishing or tutorial blog sites. Using Theme. Options you can customize your blog the way you want very easy!

DEMO

Lodestone – Premium Construction and Builder WordPress Theme

Lodestone - Premium Construction and Builder WordPress Theme

DEMO

Mooza – A WordPress Blog Theme

Mooza - A WordPress Blog Theme

Mooza is a clean and minimal WordPress blog theme for personal style blogs. Its Very user friendly WordPress theme. If you like Mooza Blog.

DEMO

Forte – Multipurpose WordPress Theme

Forte - Multipurpose WordPress Theme

Forte is a clean and professional site template, perfect for all types of companies and personal web sites. Advanced theme admin panel, drag-and-drop page builder, lots of options and configurations will help you to customize almost any part of your website as easy and comfortably as you could ever imagine.

DEMO

WildRide – Creative Startup WordPress Theme

WildRide - Creative Startup WordPress Theme

WildRide is the first ever 100% GPL WordPress theme for innovative ideas and startups. The theme is made for bloggers and optimized for content publishing and readability. It’s extremely easy to install, run and update. Most of the theme settings can be modified on the fly with WordPress customizer. The theme comes with Mailchimp newsletter feature, premium custom slider, carousel and taxonomy tiles widgets. Share your innovative ideas, get extra publicity for your startups, raise funds with and keep your readers up to date with WildRide WordPress theme!

DEMO

Blogetti – Delicious Blog WordPress Theme

Blogetti - Delicious Blog WordPress Theme

Blogetti is a premium WordPress blog for food receipts website. The theme is designed with readability and best user experience in mind. We did our best to pack the theme with all necessary features making the life of the blogger easier. Intuitive and features rich widgets, live customizer (allowing to make changes and see how the changes take effect on the fly) and valid HTML5/CSS3 code makes using our template easy and even fun!

DEMO

Superblog –WordPress Blog Theme

Superblog –WordPress Blog Theme

Superblog is a responsive WordPress Blog Theme. Superblog is a clean template for WordPress. It is perfect for any personal blog. It follows the trendy design with a combination of pure elegance.  It was designed by our small team of talented designers with passion, with desire to make the best possible wordpress blog for you.

DEMO

Tonka – An Elegant WordPress Blog Theme

Tonka - An Elegant WordPress Blog Theme

TONKA has been designed to be contemporary and sophisticated, focusing particularly on elegant design and typography, because after all, you want your readers to enjoy what they see while browsing your website!

DEMO

Timber – WordPress Theme

Timber - WordPress Theme

Responsive WordPress photography and blogging theme with a focus on content and readability that combines clean design and excellent user experience. This theme can be used from the box or easily customized with native WordPress customizer.

DEMO

Above all listed responsive wordpress themes are best themes from mojo market. Corporate companies and private firms always try to keep their website fresh and new. Their first preference will be premium wordpress themes so in this article, we kept only premium responsive wordpress themes in this post.

Permission denied /home/.htaccess pcfg_openfile unable to check htaccess file

While migrating my server data to anther server, Permission denied /home/.htaccess pcfg_openfile unable, I got this error. while restarting apache server I got following error.

[Mon Apr 25 12:15:41 2016] [crit] [client 115.117.45.10] (13)Permission denied: /home/purab/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable

Background, I am using centos (Linux) for hosting my sites and I am using user defined directory and apache 2.4 version for server.

I was not using .htaccess file in that location, still I was getting this error. Easy solution will be disable .htaccess setting httpd.conf file If we are planning not to use the htaccess file in our project. I found many solutions but that didn’t solved my issue. above issue is specific to file permission.

Permission denied /home/.htaccess pcfg_openfile unable

If it isn’t obvious that .htaccess cannot be read by the server (either 0755 or .htacess and the rest of the tree is in www-data group), search for a higher directory root only onwer:group which does *not* have world execute access.
In order for apache to find a file, it has to search down the tree. It cannot do this if a directory which is root:root does not have global execute access.

I executed following command to change ownership of public_html folder.

chown apache -R /home/purab
usermod -a -G /home/purab apache

After this I restarted my apache server using following command.

/etc/init.d/httpd restart

Using above command, it solved my issue. But purab user cannot edit the files in purab folder. So I used setfacl command.

What is setfacl command?

This utility sets Access Control Lists (ACLs) of files and directories. On the command line, a sequence of commands is followed by a sequence of files (which in turn can be followed by another sequence of commands, …).

The options -m, and -x expect an ACL on the command line. Multiple ACL entries are separated by comma characters (‘,’). The options -M, and -X read an ACL from a file or from standard input. The ACL entry format is described in Section ACL ENTRIES.

Finally I executed following command which solved my issue.

chown purab: /home/purab -R
setfacl -R -m apache:rwx /home/purab

Using above command I kept purab directory permission to purab user again so purab user has all permission of directory. Using setfacl command I given permission to apache user for read, write and execute permission. It worked for me and solved my issue.

Install skpye 4.3 on Lunix

Skepe is Open source application for calling over internet. In this article we will guide you to Install skpye 4.3 on Lunix.

Skype calls & messages are completely FREE. Skype to Landlines and mobile phones low calling rate compare with mobile phones due to this skype is really popular among the internet user and corporate offices.

Skype announced new release of Skype 4.3 for Linux on June 18th 2014. It can be installed on any windows, linux, mac OS. Skype is acquired by Microsoft Corporation now and they are doing new development for skype application.

New 4.3 skype has following features:

  • An updated UI
  • Our new cloud-based Group Chat experience
  • More reliable file transfer support when using multiple devices at once
  • Greater accessibility by blind and visually impaired users
  • PulseAudio 3.0 and 4.0 support
  • Lot of bug fixes

Install skpye 4.3 on Lunix

Install Required Repositories

# For CentOS, RHEL, SL & Fedora 21 & other linux Systems #
# yum install qtwebkit

Following list of packages should be install on your OS.

# Install the necessary packages #
# yum install alsa-lib libXv libXScrnSaver gtk2-engines PackageKit-gtk-module libcanberra libcanberra-gtk2

# Install the necessary audio packages #
# yum install pulseaudio-libs alsa-plugins-pulseaudio<

# Install the necessary video package #
# yum install libv4l

Download skype ZIP file

Use the below command to download the skype 4.3 archive file.

# wget http://download.skype.com/linux/skype-4.3.0.37.tar.bz2
# tar -jxvf skype-4.3.0.37.tar.bz2

Create Launcher

For accessing the installed software on your system globally, you need to create the launcher file to /usr/bin/skyp and give executable permission then add the below script in that file. Save + Exit.

# touch /usr/bin/skype
# chmod 755 /usr/bin/skype

# Add Launcher script #
# nano /usr/bin/skype

#!/bin/sh
export SKYPE_HOME="/opt/skype-4.3.0.37"
$SKYPE_HOME/skype --resources=$SKYPE_HOME $*

We need to create below list of Symbolic Links.

# ln -s /opt/skype-4.3.0.37/icons/SkypeBlue_48x48.png /usr/share/icons/skype.png
# ln -s /opt/skype-4.3.0.37/icons/SkypeBlue_48x48.png /usr/share/pixmaps/skype.png
# ln -s /opt/skype-4.3.0.37/skype.desktop /usr/share/applications/skype.desktop
# ln -s /opt/skype-4.3.0.37/sounds/ /usr/share/sounds/
# ln -s /opt/skype-4.3.0.37/lang/ /usr/share/lang/

Use the below command to launch the skype from command line.

# skype

Congratulations, you installed skype 4.3 version to your linux OS. Now we can start using skype on our linux systems.

allow wordpress contributors to upload files

There are some pre-installed user roles in wordpress. I am trying to allow wordpress contributors to upload files. I have many requests for guest author writers. I give the contributors role to them. But I faced one issue. which is I cannot allow wordpress contributors users to upload image files.

allow wordpress contributors to upload files

I want to achieve following two things:

  1. I want to allow wordpress contributor users to allow images for their posts and preferably they shouldn’t be able to delete existing ones before submitting it for review.
  2. I want to article should be in draft state but it cannot be edited by contributor users.

For image upload option to contributors

Add this code in your current theme’s functions.php

if ( current_user_can('contributor') && !current_user_can('upload_files') )
add_action('admin_init', 'allow_contributor_uploads');
function allow_contributor_uploads() {
$contributor = get_role('contributor');
$contributor->add_cap('upload_files');
}

This is easy trick but their is more advanced solution. You can use Members wordpress plugin. This plugin solve our issue more easily.

Members is a plugin that extends your control over your blog. It’s a user, role, and capability management plugin that was created to make WordPress a more powerful CMS.

It puts you in control over permissions on your site by providing a user interface (UI) for WordPress’ powerful role and cap system, which is traditionally only available to developers who know how to code this by hand.

I personally used this plugin for some of my wordpress projects. It is my favorite wordpress plugin which will open new doors to wordpress. I think this plugin should be wordpress core.

take mysqldump and send email

Taking backups is like day-to-day task for every system admins. In this turotials we will tell you to take mysqldump and send email through linux system.
We can take mysql database backup using cron job and mysqldump command.

We created shell script called db-backup-email.sh. Which can be used on any linux based system. We tested this script on Red Hat,CentOS, Fedora, Debian and Ubuntu systems. It is working fine.

You can download this mysql backup shell script from here..

take mysqldump and send email

How to use this script?

use following command to take mysql backup.

/bin/sh /path-to-sh-script/db-backup-email.sh mysqlusername mysqlpassword database_name your_email@email.com

With Cron
You can put this script on cron job file on linux. following command will execute at night at 2.00 am.

0 2 * * * /bin/sh /path-to-sh-script/db-backup-email.sh mysqlusername mysqlpassword database_name your_email@email.com

In shell script I written following code.

#!/bin/sh

MYSQLUSER=$1; #mysqluser
MYSQLPASS=$2; #mysqlpass
DBNAME=$3; #DBname
EMAIL=$4; #email to send

mysqldump -u $MYSQLUSER -p $MYSQLPASS $DBNAME | gzip > /tmp/$DBNAME.`date +%Y-%m-%d-%H`.sql.gz && echo "the mysqldump has been completed- status received at `date +%Y-%m-%d-%H`"|mail -s mysqldump-status -a "/tmp/$DBNAME.`date +%Y-%m-%d-%H`.sql.gz" $EMAIL

What is mysqldump?
The mysqldump client utility performs logical backups, producing a set of SQL statements that can be executed to reproduce the original database object definitions and table data. It dumps one or more MySQL databases for backup or transfer to another SQL server. The mysqldump command can also generate output in CSV, other delimited text, or XML format.

If you want to execute take dump only once than you can execute following mysqldump command.

mysqldump -u root -p sharetale | gzip > /tmp/serverDB.`date +%Y-%m-%d-%H`.sql.gz && echo "the mysqldump has been completed- status received at `date +%Y-%m-%d-%H`"|mail -s mysqldump-status -a "/tmp/serverDB.`date +%Y-%m-%d-%H`.sql.gz" purabdk@gmail.com

Many times E-mailing a database is a pretty bad idea, especially as it gets bigger and bigger, or security info is involved. But if your database is less than 5MB than you can send Database through email.

This script is for very small database. We just want to back it up every now and again in such a way that none technical members of the project can back up and restore.

There are some php scripts which can do same stuff but this script is much faster than other php script.

install apache 2.4, php 5.5 and mysql on centos 6/7

In the article we will tell you to install apache 2.4, php 5.5 and mysql on centos 6/7 with this we will guide you about installing phpmyadmin and related php and mysql modules.

LMAP is becoming more and more popular these days. People are using more vps and dedicated servers for their sites and applications. PHP backend is became more popular so here in this post we will tell you about installation on linux system’s.

Here I am using centos 6 for installation. From sept 2015 php 5.4 is no longer supported by PHP team so people are trying to install PHP 5.5+ version for good security and performance purpose on their linux servers.

install apache 2.4, php 5.5 and mysql on centos 6/7

Install Remi Repository

Remi is a repository where you can find the latest versions of the PHP  in this repository we can find latest programs and dependencies.

# yum update && yum install epel-release
# rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm

Enable Remi Repository

Open following remi.repo file and change enabled=0 to 1 for php55 tag. Here we want to install PHP 5.5 version on centos machine.

# vim /etc/yum.repos.d/remi.repo

After opening this file just edit this file and change enabled flag to 1 for php55 section
[remi]
name=Remi's RPM repository for Enterprise Linux 6 - $basearch
#baseurl=http://rpms.remirepo.net/enterprise/6/remi/$basearch/
mirrorlist=http://rpms.remirepo.net/enterprise/6/remi/mirror
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi

[remi-php55]
name=Remi's PHP 5.5 RPM repository for Enterprise Linux 6 - $basearch
#baseurl=http://rpms.remirepo.net/enterprise/6/php55/$basearch/
mirrorlist=http://rpms.remirepo.net/enterprise/6/php55/mirror
# NOTICE: common dependencies are in "remi-safe"
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi
 

Afer enabling remi repository. Now it is time to install PHP and apche and mysql

# yum --enablerepo=remi install httpd mysql mysql-server php php-common mod_php phpmyadmin

Step 4: Installing PHP Modules

Do not forget to accept installation and type Y when you asked while installation.     After installation run following command which will be useful while rebooting server(linux). After rebooting server following service will automatically started.   —— Enable Apache and MySQL on Boot ——

# chkconfig --levels 235 httpd on
# chkconfig --levels 235 mysqld on

—— Start Apache and MySQL ——

# /etc/init.d/httpd start
# /etc/init.d/mysqld start

Verify PHP 5.5

Go to /var/www/html directoy and create file called phpinfo.php using following command.

#vi phpinfo.php

put following code in that file.

<?php echo phpinfo(); ?>

Execute php.info file on your web browser

You can check your installation on command prompt also. For checking php modules use following command.

#Php -m

above command will list all php modules which are installed on your centos machine

Congratulations! Just now you completed your php 5.5, apache and mysql installation on your linux box.

 

speed up MySQL restore and backup solve slowness

I am taking daily mysqldump on my servers. I am always tring to speed up MySQL restore and backup using some tricks. Many times restoring mysql backup is like big pain. There will be many types of issues with restoring mysql dump to mysql server.

How can I speed up MySQL restore and backup?

Here is my trick to restore database dump fast.

You need to put following sql statement at the top of the dump SQL file.

SET @OLD_AUTOCOMMIT=@@AUTOCOMMIT, AUTOCOMMIT = 0;
SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS = 0;
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS = 0;
You need to put following sql statement at the end of the SQL file

SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
SET AUTOCOMMIT = @OLD_AUTOCOMMIT;
COMMIT;

Using above trick, I am able to restore any database much faster than earlier.
For more information you can look following URL:
http://dev.mysql.com/doc/refman/5.5/en/optimizing-innodb-bulk-data-loading.html

Lets talk about taking mysqldump faster.

There is utility called “MYDUMPER” which will take mysqldump much faster than mysqldump command. which is native command of mysql.

“Mydumper” and its companion “myloader”, are relatively new open
source database utilities written by Domas Mituzas and colleagues, providing
built-from-scratch implementations of mysqldump and mysql load
functionality. They clean up a bunch of command line inconsistencies
found in the mysql utilities, making them easier to script. They also fix
some errors and omissions. But their main feature is speed. By
paralleling the operation of dumping and loading database tables, quite dramatic
speed-up can be obtained.

The new Mydumper 0.9.1 version, which includes many new features and bug fixes, is now available. You can download the code from here.
https://launchpad.net/mydumper