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.
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.
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.
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.
In this tutorial we are going to tell you how to install php mysql apache on centos 7 with very easy and simple steps and guide.
LAMP is becoming more popular these day. Many people are using LAMP for server solutions.
Add EPEL-7 to your linux os with latest phpMyadmin.
Now time to test php and apache version.
The document root of the default website is /var/www/html. We can create info.php file and put in document root folder
vi /var/www/html/info.php
put following code in that file
<?php echo phpinfo(); ?>
Now we call that file in a browser (e.g. http://192.168.0.109/info.php):
Now we can install some useful PHP moduels which can be required for CMS Systems like WordPress, Joomla and Drupal:
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.
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
There are many caching solution available in open source. But Varnish is best in among. In this article, We given full steps to use and install varnish with wordpress and apache server . varnish setup with your wordpress site. Many website webmasters installed Varnish on their production servers to handle millions of requests without delay in response. There are many caching plugin like W3 Total Cache, WP Super Cache, Hyper Cache and so many..
Varnish is free open source software licensed under a two-clause BSD licence aimed to really super boost server performance. In short, it will work as web accelerator between any server that speaks with HTTP (Apache or any other).
Why Apache or Nginx is Enough to Handle Huge Traffic
Many system administrator do many tricks with Apache because it performs really bad when the server is getting very high requests. Some people started using other servers like Ngnix and LiteSpeed. WordPress itself are using Ngnix server for many years for production environment. But still performance and response time of website is not that much fast with these plugins. So Best solution is Varnich Cache.
Varnish Explained Here
Vanish server started working on top of Apache server. When HTTP request comes to server first it will go the varnish server, If Vanish server has the response in memory cache then it will give response immediately, If Varnish server does not has cache for that request then it will go to apache server and get the response and keep in cache. Next request will delivered by Varinish cache, which will be so fast. Using varnish cache you can increase your server performance and response time by 300 to 900x. I personally checked response time difference. Before installing varnish cache my server response time was 3.46 second. After installing Varnish Cache, my server response time was 0.3, Means My server response increased by 1000x.
In following diagram, we explained, how varnish server process request.
Why install varnish with wordpress
It will reduce server load , by reducing CPU work
It will load your load your WordPress website very fast, because vanish cache stored in RAM.
Your wordpress site SEO will increase, Because your site will load so fast
Response time will reduce by 1000x
Google page speed response score improves by at-least 20%
how to install varnish with wordpress and apache
Note: You can use this tutorial for setup varnish with any apache website. If you used HTML, ROR, JAVA, PHP for your website than you can set up varinish as we shown in this article. Here, we are assuming you already installed wordpress with apache server on linux server.
We are using dedicated Linux (centos) server for hosting our sites. So here we given steps can be applicable for Red Hat, Centos, Fedora, ubuntu server. But for ubuntu server you need use “apt-get install” instead of yum install.
So now Just follow my steps to install the varnish server. For latest version of Linux, you don’t need to install repository. But for older linux version you need to install the Varnish server repository. For that use following command to install varnish repository.
Than you will be ready for install varnish server. Use following command for installing varnish server. You need to run following command as root. So first became root.
yum install varnish
Configure Varnish to work on port 80
usually Apache run on port 80 and your all sites will run on port 80. So as I told you earlier in this article. (check Varnish Explained section) Varnish work on top of apache server So you need to set up varnish on port 80. In CentOS, RedHat, Fedora, and Ubuntu server, Varnish configuration file located in “/etc/sysconfig/varnish”. You can edit file using vim or vi editor or you can download file to your PC and edit it then upload to server.
I am using vim here.
vim /etc/sysconfig/varnish
Please change files first part code as per I shown in image. OR you can download setting file from here:
[viral-lock message=”Download Link is Hidden! It’s Visible for Users who Liked/Shared This article on Facebook or Twitter or Google+. Like or Tweet this article to reveal the content.”]
Got to “Alternative 2” section and change setting as I shown in image. Un-comment all the lines after “Alternative 2” as I shown.
By default -s setting will be pointed to filesystem, change that to memory. This is important, because we want, varnish give response from memory.
you need to change “-a : 6081 \” to “-a : 80 \” as we shown here in image. You can change “256m” to higher number, which is depends on your server configuration. If you have higher memory server then you can 512mb or 1GB for Varnish server. Many websites are using 4gb for varinsh servers. But they have a huge amount of traffic.
Second Part of configuration – go to end of file, using “shit+g” key. Change configuration as per I shown.
Got to “Alternative 3” section and change setting as I shown in image. Comment all the lines after “Alternative 3”
Change server config of Varnish
Like Apache server, Varnish server VCL file found in “/etc/varnish/default.vcl” location. Varnish VCL file is configuration for looking for apache(server) response data(content). You can edit this file using vim editor as per shown in following image OR you can download file from following location.
[viral-lock message=”Download Link is Hidden! It’s Visible for Users who Liked/Shared This article on Facebook or Twitter or Google+. Like or Tweet this article to reveal the content.”]
Change the port 80 to 8080 port as We shown in image. Means Varnish server will generate cache from port 8080 so you need configure your apache server on port 8080.
Now Varnish configuration is complete. Now we need to configure apache server to send apache in back of varnish server.
You need to change following setting of your apache server. By default apache config file is htttpd.conf or apache.conf file. You will find this file in “/etc/httpd/conf/httpd.conf” location. For ubuntu that will be other location. Open your apache config file.
You can download apache configuration file from here. You can refer only “custom.conf” file. it has all changed configuration.
We created custom.conf file and added under “/etc/httpd/conf.d/” folder. So that file will be automatically loaded in apache config.
You can add following code in your apache configuration file as we shown in following image. You need to change the NameVirtualHost 80 to 8080. So your apache server will run on port 8080.
You need to change VirtualHost entries for each of your domain. This is very important, If you do not change this properly then your apache server will through error while restarting.
Now your Varnish and Apache configuration are done. So time to restart both servers.
First Stop the Apache server and start the Varnish server. After starting Varnish server. Again start the apache server. You can use following commands step by step. Use commands in following order.
service httpd stop
service varnish start
service httpd start
Note: If you try to start varnish server without stopping apache server then it will never start because it will try to start using port 80.
Test Website performance and response time
How can you test your site pages speed and response time. Go to following “Google pagespeed” URL to test the website response time.
Check Varnish service is running for your site. go to following URL and add your website URL in inputbox and select “service scan” checkbox and click on go button.
You will get response as shown in following image.
As per explained in this article. After varnish configuration, your website will perform much faster then earlier and server CPU will not be consumed by apache server. We are using small dedicated server so we used only 256mb memory. If you have 1gb RAM of our server then use 256mb means one-fourth of memory for varnish server. When you have all code and database of same server.
Varnish Useful commands
# varnishlog : Provides detailed information on requests.
# varnishtop : It reads varnishd shared memory logs and presents a most commonly occurring log entries.
# varnishadm : Command-line varnish administration used to reload vcl and purge urls.
# varnishstat : Provides all the info you need to spot cache misses and errors.
# varnishhist : Provides a histogram view of cache hits/misses.
By “varnishstat” command you can check real-time statistics of varnish server. You can see following items
Client connection
Hit rate ration
Hit rate average
Number of client connections accepted
Following is screenshot of my production site. There are a lot of useful data provided by varnish stats
Create Varnish Log File
Using following command you can create varnish request log file as per apache log file. In this file you will get similar information like apache access log.
varnishncsa -c -a -d -w /var/log/varnish/varnish.log
For more varnish commands you can go to varnish site using following URL.
Now you are set with varnish server and wordpress site. Above article can be used for any linux distribution like, Fedora, Ubuntu, Centos, RedHat and Suse. Commands will be same and configuration will be same.
In wordpress configuration you do not need to change anything. With Varnish server .htaccess file will not break because still main webserver is apache.
If you still need assistance to install Varnish server and configure production server then contact to me.
One day I faced issue with mysql.sock file. I found Can’t connect to local MySQL error. I solved the issue with following commands.
[root@localhost ~]# mysqladmin -u root shutdown
mysqladmin: connect to server at ‘localhost’ failed
error: ‘Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’ (2)’
Check that mysqld is running and that the socket: ‘/var/lib/mysql/mysql.sock’ exists!
Using following command I checked the mysql directory.
[root@localhost ~]# ll /var/lib/mysql/
I did not find the mysql.sock file there.
[root@localhost ~]# cd /var/lib/mysql/
Created file in that location.
[root@localhost mysql]# touch mysql.sock
Gave the executabe permission the sock file.
[root@localhost mysql]# chmod +x mysql.sock
Changed the permission to mysql user
[root@localhost mysql]# chown mysql:mysql -R *
After that restarted the machine
[root@localhost mysql]# /etc/init.d/mysqld start
Starting mysqld: [ OK ]
[root@localhost mysql]# mysql -uroot
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.1.52 MySQL Community Server (GPL) by Remi
Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license
Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.
For putting the web authentication we always use the .htaccess or apache configuration file. For removing the web auth from folder you need put following code in .htaccess file.
How to remove the AuthType Basic
<Directory /var/www/html/>
#AuthType Basic
#AuthName "By Invitation Only"
#AuthUserFile /etc/httpd/passwd/passwords
#Require user wpapi
#Require valid-user
</Directory>
<Directory /var/www/html/>
AuthType None
Require all granted
Satisfy Any
</Directory>
[root@localhost ~]# mysqladmin -u root shutdown
mysqladmin: connect to server at ‘localhost’ failed
error: ‘Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’ (2)’
Check that mysqld is running and that the socket: ‘/var/lib/mysql/mysql.sock’ exists!
Solved issue: Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock
Using following command I checked the mysql directory.
[root@localhost ~]# ll /var/lib/mysql/
I did not found the mysql.sock file there.
[viral-lock message=”Solution is Hidden! It’s Visible for Users who Liked/Shared This article on Facebook or Twitter or Google+. Like or Tweet this article to reveal the content.”]
[root@localhost ~]# cd /var/lib/mysql/
Created file in that location.
[root@localhost mysql]# touch mysql.sock
Gave the executabe permission the sock file.
[root@localhost mysql]# chmod +x mysql.sock
Changed the permission to mysql user
[root@localhost mysql]# chown mysql:mysql -R *
[/viral-lock]
After that restarted the machine
[root@localhost mysql]# /etc/init.d/mysqld start
Starting mysqld: [ OK ]
[root@localhost mysql]# mysql -uroot
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.1.52 MySQL Community Server (GPL) by Remi
Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license
Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.
tutorial for PHP, domain search through Linux command and PHP. Searching the domain information through command line. You can search the domain using the Linux command.
domain search through Linux command and PHP
#whois google.com
using the following command you can find the all domain information.
If you want check when domain created then use following command.
#whois google.com | grep “Created | Creation”
If you want to create PHP script for domain search then use following code
If you want to find the old files from your system or server then you can use the following code. I used the following code for deleting the old files from system.
deleting all one day old files from folder through php
/*****************Get the path to Extension ****************/
$array_path = explode("/",$_SERVER['SCRIPT_FILENAME']);
<div id=":2e">$dynamic_path = "";
for ($i=0;$i
if($array_path[$i]!="")
$dynamic_path =$dynamic_path."/".$array_path[$i];
// This linux command will delete the one day older from specific folder.
exec("find ".$dynamic_path."* -mtime +1 -exec rm {} \;");</pre>
<div>
For deleting the old files from system I used the Linux command. You can execute the command using the exec function.
If you want to use the Linux command then use the following command