Author: Sam

Step-1: Add 2 hidden fields to the contact form

[hidden your-first-name id:first-name-p]
[hidden your-last-name id:last-name-p]

Step-2: Write below jquery script in the footer

$("#name_field_id").focusout(function(){
     str = $(this).val();
     if(str){
      s = str.split(/(?<=^\S+)\s/); //split string in name field after first space found. 
      $("#last-name-p").val(s[1]); //s[1] value after the first space set to hidden field.
     }
  });

Output will be list this:-

ERROR:-
The response from the remote server was:
550 Please turn on SMTP Authentication in your mail client. mail-qk1-f172.google.com [209.85.222.172]:36503 is not permitted to relay through this server without authentication.

SOLUTION:-

Manage SMTP restrictions

Click Enable to deny users the ability to bypass your mail server to send mail. To allow users the ability to bypass your mail server, click Disable.

(WHM >> Home >> Security Center >> SMTP Restrictions)

We recently redesigned a WordPress site for a client who was migrating away from WP Engine. When we migrated the client to the new host, they still had a “WP Engine” section in their WordPress dashboard main menu.

WP Engine WordPress Menu Item

Since this feature set would no longer be utilized, it was best to get the plugins removed to keep things lean and tidy.

While cleaning up those WPE remnants, we put together a short guide on how to remove these plugins on your own. Hope it helps!

1. First things first, backup

In order to remove these WP Engine plugins and remnants, we’ll be making some changes to the file structure, and modifying a core WordPress file. That means you should create a full backup of your WordPress environment in the event that something goes wrong. Broken sites and lost data make for a bad day, so backup to stay safe!

2. Delete WP Engine Plugin Folders and Files

Once your backup is safely made, connect to your WordPress environment via FTP, or via your cPanel’s file manager. Locate the “wp-content” folder in your base WordPress directory, then delete the following files and folders.

  • wp-content/mu-plugins/mu-plugin.php
  • wp-content/mu-plugins/wpengine-common/
  • wp-content/mu-plugins/slt-force-strong-passwords.php
  • wp-content/mu-plugins/force-strong-passwords/
  • wp-content/mu-plugins/stop-long-comments.php
  • wp-content/advanced-cache.php
  • wp-content/object-cache.php
  • wp-content/mysql.sql

Once you have deleted all of these files and folders, if the “mu-plugins” folder is now empty, you can go ahead and delete it too.

3. Delete WP Engine git files from the root

Next, head back to your WordPress root directory, and look for and delete these two files.

  • .gitattributes
  • .gitignore

WP Engine .gitattributes and .gitignore files

4. Generate a fresh wp-config.php file for your installation

WP Engine modifies your site’s wp-config.php file. Now that you have removed all of their leftover elements from your installation, you will also want to make sure that your site is running on a clean wp-config file.

Firstly, locate and open the wp-config.php file in the root of your WordPress environment.

Now head to GenerateWP to grab a clean code set for the wp-config file. Copy the code from GenerateWP and paste it into a new file in your text editor.

Now jump back to your current wp-config file which you opened a moment ago. You will want to copy the values for all of these fields and paste them into the new wp-config file that you just created.

Database credentials

  • define( ‘DB_NAME’,
  • define( ‘DB_USER’,
  • define( ‘DB_PASSWORD’,
  • define( ‘DB_HOST’,
  • define( ‘DB_CHARSET’,

wp-config database values

If your table prefix begins with anything other than “wp_” (uncommon)

Be sure to update your table prefix if it begins with anything other than “wp_”

  • $table_prefix =

wp-config table prefix

WordPress Secret Keys & Salts

  • define( ‘AUTH_KEY’,
  • define( ‘SECURE_AUTH_KEY’,
  • define( ‘LOGGED_IN_KEY’,
  • define( ‘NONCE_KEY’,
  • define( ‘AUTH_SALT’,
  • define( ‘SECURE_AUTH_SALT’,
  • define( ‘LOGGED_IN_SALT’,
  • define( ‘NONCE_SALT’,

wp-config secret keys and salts

After entering all of your database values, keys, and salts, save the new file as wp-config.php, then upload it to the root of your WordPress installation, overwriting the existing file.

Once that is complete, log into your WordPress admin panel and you should now be free of all WP Engine menus and plugins.

Symptoms

Typical error message, meaning that PHP ext-zip extension is missing:

laravel/installer v2.0.1 requires ext-zip * -> the requested PHP extension zip is missing from your system.

Fix me

First, get PHP version running on your computer:

php --version

Then, on Ubuntu, just run this command:

# For php v7.0
sudo apt-get install php7.0-zip
 
# For php v7.1
sudo apt-get install php7.1-zip
 
# For php v7.2
sudo apt-get install php7.2-zip

On CentOs:

yum install php-pecl-zip

Done! Hope it helps!

Chrome and Firefox have started showing insecure warnings on sites without SSL certificates. Without SSL, your website will show insecure to the visitors. Therefore, using an SSL-encrypted connection for safety, accessibility or PCI compliance reasons is necessary. It becomes very important to redirect from HTTP to HTTPS.

What is SSL?

SSL (Secure Sockets Layer) is a standard security protocol for establishing encrypted links between a web server and a browser in an online communication.

The usage of SSL technology ensures that all data transmitted between the web server and browser remains encrypted.

An SSL certificate is necessary to create SSL connection. You would need to give all details about the identity of your website and your company as and when you choose to activate SSL on your web server. Following this, two cryptographic keys are created — a Private Key and a Public Key.

Learn More: Why SSL is Critical?

In order to force your web traffic to use HTTPS, edit the codes in the .htaccess file.

Before we move onto redirecting HTTP to HTTPS, here’s how you can edit .htaccess file. If you already know skip to Redirection steps.

Editing .htaccess File

There are instructions/directives in the .htaccess file that tell the server how to act in certain scenarios and directly affects how your website functions. Common directives in .htaccess file:

  • Redirects
  • Rewriting URLs

Ways to edit an .htaccess file:

  1. Edit the file on your computer and upload it to the server using FTP.
  2. Use “Edit” mode in FTP program that allows you to edit a file remotely.
  3. Use a text editor and SSH to edit the file.
  4. Use the File Manager in cPanel to edit the file.

Editing .htaccess in cPanel File Manager

Note: Backup your website in case something goes wrong.

  1. Login to cPanel
  2. Files > File Manager > Document Root for:
  3. Now select the domain name you want to access
  4. Check “Show Hidden Files (dotfiles)”
  5. Click “Go”
  6. After a new tab or window opens, look for the .htaccess file.
  7. Right click on the .htaccess file and click on “Code Edit” on the menu.
  8. A dialogue box may pop up asking about encoding. Click “Edit” button to continue.
  9. Edit the file
  10. “Save Changes” when done.
  11. Test your website to make sure it is done correctly. In case, there is an error, restore to the previous version and try again.
  12. Once you are done, click “Close” to close the window.

Redirecting HTTP to HTTPS

1. Redirect All Web Traffic

If you have existing code in your .htaccess, add the following:

RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.yourdomain.com/$1 [R,L]

2. Redirect Only a Specific Domain

For redirecting a specific domain to use HTTPS, add the following:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^yourdomain\.com [NC]
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.yourdomain.com/$1 [R,L]

3. Redirect Only a Specific Folder

Redirecting to HTTPS on a specific folder, add the following:

RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteCond %{REQUEST_URI} folder
RewriteRule ^(.*)$ https://www.yourdomain.com/folder/$1 [R,L]

Note: Replace “yourdomain” with your actual domain name wherever required. Also, in case of the folder, replace /folder with the actual folder name.

Think it was helpful? Share this article to help others come on HTTPS.

This article describes how to check and upgrade the Linux kernel in OpenVZ, KVM, and Dedicated Servers (including the CloudLinux platform).

Checking the Kernel Version

To check system parameters such as the kernel version and build date, OS architecture, hostname, etc., you can use the uname command, which is included in coreutils package:

  # uname -rv
  3.10.0-693.11.6.el7.x86_64 #1 SMP Thu Jan 4 01:06:37 UTC 2018

To view the current kernel version and build date, run uname -r. Depending on the platform your server is running on, you may see slightly different output, even for the same CentOS 7 operating system.

If you run a VPS (Virtual Private Server) as an OpenVZ container, you will see the “stab” in the kernel version:

  # uname -r
  2.6.32-042stab125.5

If you run CentOS 7 on a Dedicated Server or a KVM virtual server, you could see “el7” in the kernel version, which refers to Red Hat Enterprise Linux, from which CentOS is derived:

  # uname -r
  3.10.0-693.11.6.el7.x86_64

If you are running CloudLinux, you could see “lve” in the kernel version:

  # uname -r
  3.10.0-714.10.2.lve1.5.9.el7.x86_64

Another way to check would be with the following yum command:

  yum info kernel -q

This command may run noticeably longer, because yum uses a python interpreter and one or more plugins by default. However, it gives more detailed information. Here is an example of possible output from this command:

  # yum info kernel -q
  Available Packages
  Name        : kernel
  Arch        : x86_64
  Version     : 3.10.0
  Release     : 693.11.6.el7
  Size        : 43 M
  Repo        : updates/7/x86_64
  Summary     : The Linux kernel
  URL         : http://www.kernel.org/
  License     : GPLv2
  Description : The kernel package contains the Linux kernel (vmlinuz), the core of any
              : Linux operating system.  The kernel handles the basic functions
              : of the operating system: memory allocation, process allocation, device
              : input and output, etc.

Upgrading the Linux Kernel

If you have a VPS as an OpenVZ container, it is not possible to upgrade your kernel independently, because all virtual containers run the same kernel loaded on the node. Therefore, voluntary upgrade can be performed only on Dedicated Servers and KVM-based virtual servers.

To upgrade the kernel, you can run this yum command:

  yum upgrade kernel

By default, this command should ask for confirmation to install new kernel:

  Is this ok [y/d/N]:

If you want to skip the confirmation, you can use the -y switch:1)

  yum upgrade kernel -y

Once the new kernel is installed you need to load it. To do so, you need to reboot the server:

  reboot

Once the server has finished rebooting, you should check the loaded kernel version as described in previous section.

KernelCare Usage

KernelCare is a live-patching software for Linux kernels distributed by CloudLinux. When using KernelCare, the server does not require rebooting for kernel upgrades, and kernel patches are checked and applied on the fly automatically every 4 hours. It is available only for Dedicated Servers and KVM virtual servers.

You can check if KernelCare is installed as follows:

  # yum info kernelcare -q
  Installed Packages
  Name        : kernelcare
  Arch        : x86_64
  Version     : 2.14
  Release     : 2
  Size        : 217 k
  Repo        : installed
  From repo   : kernelcare
  Summary     : KernelCare tools
  URL         : http://www.cloudlinux.com
  License     : CLOUD LINUX LICENSE AGREEMENT
  Description : KernelCare userland tools

To check if patches have been applied, run:

  kcarectl --info

More details about KernelCare can be found in the following places:

Removing Old Kernels

Sometimes you may need to remove old kernels from the server manually. To check all installed kernels, this yum command could be used again:

  # yum list kernel -q
  Installed Packages
  kernel.x86_64                                       3.10.0-693.11.1.el7                                              @updates
  kernel.x86_64                                       3.10.0-693.11.6.el7                                              @updates

Using the command package-cleanup with the --oldkernels switch would remove all old kernels, leaving only ‘count‘ most recent ones (by default count=2). For example, to remove all kernels except the one most recently installed and loaded, run the following command:

  package-cleanup --oldkernels --count=1

What’s ss Command?

ss stands for socket statistics. It is used to dump socket statistics about network/socket connections.

It’s showing information similar to netstat, it works better and faster compared with netstat. It can display more TCP and state information than other tools.

Since the ss command gets all the information directly from kernel space (with single source) that’s why it’s faster than netstat.

What’s netstat Command?

netstat stands for network statistics. It displays network connections, routing tables, interface statistics, masquerade connections, multicast memberships and network protocol statistics.

The netstat command has been deprecated and replaced by the ss command in most of the Linux distributions.

It reads various /proc files to gather information. It would take more time when there are lots of connections to display.

How to Count Apache’s (Httpd) Current Connections in Linux Using ss Command?

Use the ss command with following options to count Apache current connections in Linux.

# ss -ant | grep :80 | wc -l
110

How to Count Apache’s (Httpd) Current Connections in Linux Using netstat Command?

Use the netstat command with the following options to count apache current connections in Linux.

# netstat -ant | grep :80 | wc -l
90

How to Display Apache’s (Httpd) Current Connections in Linux Using ss Command?

Use the ss command with the following options to display detailed information about apache’s current connections in Linux.

It displays an active internet connections in the server at port 80.

# ss -ant | grep :80
LISTEN     0      128          *:80                       *:*                  
TIME-WAIT  0      0      94.237.64.70:80                 172.69.44.142:16690              
TIME-WAIT  0      0      94.237.64.70:80                 172.69.68.173:60360              
TIME-WAIT  0      0      94.237.64.70:80                 172.68.146.130:25988              
TIME-WAIT  0      0      94.237.64.70:80                 162.158.231.34:52566              
TIME-WAIT  0      0      94.237.64.70:80                 162.158.231.34:54094              
TIME-WAIT  0      0      94.237.64.70:80                 108.162.229.40:21418              
TIME-WAIT  0      0      94.237.64.70:80                 162.158.231.145:33218              
TIME-WAIT  0      0      94.237.64.70:80                 162.158.50.236:63306              
TIME-WAIT  0      0      127.0.0.1:56262              127.0.0.1:80                 
ESTAB      0      0      94.237.64.70:80                 172.68.169.24:35698              
TIME-WAIT  0      0      94.237.64.70:80                 172.68.58.127:59962              
TIME-WAIT  0      0      94.237.64.70:80                 162.158.146.186:23750              
TIME-WAIT  0      0      94.237.64.70:80                 162.158.231.31:20908              
TIME-WAIT  0      0      94.237.64.70:80                 162.158.231.7:17936              
TIME-WAIT  0      0      94.237.64.70:80                 162.158.231.13:33318              
TIME-WAIT  0      0      94.237.64.70:80                 162.158.231.22:23296              
ESTAB      0      0      94.237.64.70:80                 162.158.38.72:45150          

How to Display Apache’s (Httpd) Current Connections in Linux Using netstat Command?

Use the netstat command with the following options to display detailed information about apache’s current connections in Linux.

It displays an active internet connections in the server at port 80.

# netstat -ant | grep :80
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN     
tcp        0      0 94.237.64.70:80         172.69.44.142:16690     TIME_WAIT  
tcp        0      0 94.237.64.70:80         172.69.68.173:60360     TIME_WAIT  
tcp        0      0 94.237.64.70:80         172.68.146.130:25988    TIME_WAIT  
tcp        0      0 94.237.64.70:80         162.158.231.34:52566    TIME_WAIT  
tcp        0      0 94.237.64.70:80         162.158.231.145:33218   TIME_WAIT  
tcp        0      0 94.237.64.70:80         162.158.50.236:63306    TIME_WAIT  
tcp        0      0 127.0.0.1:56262         127.0.0.1:80            TIME_WAIT  
tcp        0      0 94.237.64.70:80         172.69.68.6:15564       TIME_WAIT  
tcp        0      0 94.237.64.70:80         172.69.69.240:58040     TIME_WAIT  
tcp        0      0 94.237.64.70:80         162.158.78.150:51818    ESTABLISHED
tcp        0      0 94.237.64.70:80         162.158.231.27:56412    TIME_WAIT  
tcp        0      0 94.237.64.70:80         172.69.70.187:55842     TIME_WAIT  
tcp        0      0 94.237.64.70:80         141.101.76.126:58756    ESTABLISHED
tcp        0      0 94.237.64.70:80         172.68.50.30:16508      ESTABLISHED
tcp        0      0 94.237.64.70:80         162.158.231.7:17780     TIME_WAIT  
tcp        0      0 94.237.64.70:80         162.158.231.16:60012    TIME_WAIT  
tcp        0      0 94.237.64.70:80         162.158.231.24:13312    TIME_WAIT  
tcp        0      0 94.237.64.70:80         162.158.231.13:30752    TIME_WAIT  
tcp        0      0 94.237.64.70:80         162.158.154.93:42576    ESTABLISHED

How to Count Number of Connection Currently Active in Apache from Each IP Address Using ss Command?

Use the ss command with the following options to count number of connection currently active in Apache from each IP address.

# netstat -ant | awk '{print $5}' | cut -d":" -f1 | sort | uniq -c | sort -nr
      6 162.158.155.70
      5 127.0.0.1
      2 172.68.51.180
      2 172.68.215.98
      2 172.68.215.86
      2 172.68.215.77
      2 172.68.215.75
      2 172.68.215.113
      2 172.68.215.111
      2 172.68.215.109
      2 172.68.215.101
      2 172.68.215.100
      2 162.158.150.128
      2 162.158.150.120
      2 162.158.118.154
      2 141.101.96.253
      2 141.101.96.243
      2 141.101.76.234
      2 141.101.105.254
	  .
	  .

How to Count Number of Connection Currently Active in Apache from Each IP Address Using netstat Command?

Use the netstat command with the following options to count number of connection currently active in Apache from each IP address.

# ss -at | awk '{print $5}' | cut -d":" -f1 | sort | uniq -c | sort -nr
      6 162.158.155.70
      5 127.0.0.1
      2 172.68.51.180
      2 172.68.215.98
      2 172.68.215.86
      2 172.68.215.77
      2 172.68.215.75
      2 172.68.215.113
      2 172.68.215.111
      2 172.68.215.109
      2 172.68.215.101
      2 172.68.215.100
      2 172.68.169.36
      2 162.158.150.128
      2 162.158.150.120
      2 162.158.118.154
      2 141.101.96.253
      2 141.101.96.243
      2 141.101.76.234
      2 141.101.105.254
	  .
	  .

How to Count Number of Connection Currently Established in Apache from Each IP Address Using ss Command?

Use the ss command with the following options to count number of connection currently established in Apache from each IP address.

# ss -at | grep ESTAB | awk '{print $5}' | cut -d":" -f1 | sort | uniq -c | sort -n
      1 103.5.134.182
      1 162.158.150.84
      1 172.68.169.30
      1 172.68.206.84
      1 182.111.155.129
      1 69.10.49.214

How to Count Number of Connection Currently Established in Apache from Each IP Address Using netstat Command?

Use the netstat command with the following options to count number of connection currently established in Apache from each IP address.

# netstat -ant | grep ESTAB | awk '{print $5}' | cut -d":" -f1 | sort | uniq -c | sort -n
      1 103.5.134.182
      1 172.68.206.84
      1 182.111.155.129
      1 69.10.49.214

How to Count Apache’s (httpd) Actual Running Processes in Linux Using ps Command?

ps command is used to display all running processes in Linux system. Use the following format, if you would like to count running Apache processes in Linux.

# ps -auxw | grep httpd | grep -v grep | wc -l
12

How to Check List of Apache Processes in Linux Using ps Command?

ps command is used to display all running processes in Linux system. Use the following format, if you would like to display running httpd processes in Linux.

# ps auxw | grep httpd | grep -v grep
nobody    7988  0.0  0.5 253280 23252 ?        S    14:32   0:00 /usr/sbin/httpd -k start
nobody    8050  0.0  0.6 253412 24276 ?        S    14:33   0:00 /usr/sbin/httpd -k start
nobody    8054  0.0  0.6 253280 23288 ?        S    14:33   0:00 /usr/sbin/httpd -k start
nobody    8158  0.0  0.6 253280 23296 ?        S    14:33   0:00 /usr/sbin/httpd -k start
nobody    8159  0.0  0.5 253280 23176 ?        S    14:33   0:00 /usr/sbin/httpd -k start
daygeek   8202  0.0  0.6 253416 23304 ?        S    14:34   0:00 /usr/sbin/httpd -k start
nobody    8203  0.0  0.5 253280 23052 ?        S    14:34   0:00 /usr/sbin/httpd -k start
nobody    8207  0.0  0.5 253280 23044 ?        S    14:34   0:00 /usr/sbin/httpd -k start
nobody    8213  0.0  0.6 253280 23300 ?        S    14:34   0:00 /usr/sbin/httpd -k start
nobody    8216  0.0  0.5 253280 23052 ?        S    14:34   0:00 /usr/sbin/httpd -k start
nobody    8218  0.0  0.6 253416 23304 ?        S    14:34   0:00 /usr/sbin/httpd -k start
nobody    8266  0.0  0.5 253148 23052 ?        S    14:35   0:00 /usr/sbin/httpd -k start
nobody    8267  0.0  0.5 253144 22800 ?        S    14:35   0:00 /usr/sbin/httpd -k start
nobody    8391  0.3  0.5 253144 22800 ?        S    14:35   0:00 /usr/sbin/httpd -k start
nobody    8393  0.5  0.5 253012 21776 ?        S    14:35   0:00 /usr/sbin/httpd -k start
nobody    8394  1.0  0.5 253144 22800 ?        S    14:35   0:00 /usr/sbin/httpd -k start
root     30500  0.0  0.0 227356  3584 ?        Ss   Jul25   2:33 /usr/sbin/httpd -k start

Please Make you have Apache configured with the following information

in /path/to/apache2/installation/conf/httpd.conf

Add the following information

<Directory "path/to/laravel/project/public">
    Allowoverride All
</Directory>

.htaccess file located in public folder make sure that it has the following

<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
       Options -MultiViews
   </IfModule>
   Options +FollowSymlinks
   RewriteEngine On

   # Redirect Trailing Slashes...
   RewriteRule ^(.*)/$ /$1 [L,R=301]

   # Handle Front Controller...
   RewriteCond %{REQUEST_FILENAME} !-d
   RewriteCond %{REQUEST_FILENAME} !-f
   RewriteRule ^ index.php [L]
</IfModule>

Remember to enable mod_rewrite module

sudo a2enmod rewrite

On some occasions apache server will just fail, and become crashed, failing to restart with an error message like

# tail /var/log/httpd/error_log

[Sun Dec 22 10:05:27.006998 2013] [core:emerg] [pid 15001:tid 140145945569216] (28)No space left on device: AH00023: Couldn't create the fcgid-proctbl mutex
[Sun Dec 22 10:05:38.000403 2013] [core:emerg] [pid 15018:tid 140368783902656] (28)No space left on device: AH00023: Couldn't create the proxy mutex
[Sun Dec 22 10:05:38.000456 2013] [proxy:crit] [pid 15018:tid 140368783902656] (28)No space left on device: AH02478: failed to create proxy mutex

If you see an error similar to the bellow, it could indicate that your server has run out of semaphores. To see how many semaphores are being used, type the following command

# ipcs -s

------ Semaphore Arrays --------
key        semid      owner      perms      nsems
0x00000000 38797312   apache     600        1
0x00000000 38731777   apache     600        1
0x00000000 38830082   apache     600        1
0x00000000 38961155   apache     600        1
0x00000000 38895620   apache     600        1
0x00000000 38993925   apache     600        1
0x00000000 39026694   apache     600        1
0x00000000 39059463   apache     600        1
0x00000000 39092232   apache     600        1
0x00000000 39125001   apache     600        1
0x00000000 39157770   apache     600        1
0x00000000 39288843   apache     600        1
0x00000000 39223308   apache     600        1
0x00000000 39321613   apache     600        1
0x00000000 39354382   apache     600        1
0x00000000 39387151   apache     600        1
0x00000000 39419920   apache     600        1
0x00000000 39452689   apache     600        1
0x00000000 39485458   apache     600        1

To fix it and get Apache server started again, we must clean the semaphores. Run the following command to flush them:

for whatever in `ipcs -s | awk '{print $2}'`; do ipcrm -s $whatever; done

If that command may not work on older server then you may need to do the following

# /etc/init.d/httpd stop
# ipcs -s | grep nobody | gawk '{ print $2 }' | xargs -n 1 ipcrm sem
# /etc/init.d/httpd start

Final, you may want to increase the semaphore limits on your server. You can do that by adding the following to the /etc/sysctl.conf

kernel.msgmni = 512
kernel.sem = 250 128000 32 512

After, type the following command to update new setting for kernel

# sysctl -p