Hire me for your Wordpress Fixing Jobs

Author: themecopsadmin (Page 1 of 2)

How to replace character with new line using Notepad++

Scala Hosting

The following steps show how to convert a character (for example a tab or comma) with a new line using Notepad++.

For this example we’ll be converting

The,Quick,Brown,Fox,Jumped,Over,The,Lazy,Dog

to

The
Quick
Brown
Fox
Jumped
Over
The
Lazy
Dog
  1. Open the file using Notepad++ (or paste the text into a new file)
  2. Open the Search -> Replace menu
  3. In the ‘Find what’ box enter the character to convert to a new line
  4. In the ‘Replace with box enter \n
  5. Under ‘Search Mode’ select ‘Extended’
  6. Click ‘Replace All 
  7. All the characters will now be converted to new lines.

TIP: use \t for a tab character

How To Migrate WordPress Website

Scala Hosting

Its architecture is a front controller, routing all requests for non-static URIs to a single PHP file which parses the URI and identifies the target page. This allows support for more human-readable permalinks.

1. Existing Web Hosting Account:

SSH (Secure Shell) is a network protocol that enables you to securely enter your server across an encrypted connection. Login to your current web hosting account. The essential command to do this is:

# ssh [email protected] or ssh [email protected]

If the port is different than the default, append the port number by using the option ‘-p’.

2. Backup your Files

It’s normal method to always backup your website before doing any modifications. To build the backup you can compress your whole folder using the following command:

# tar -cvzf wpback.tar.gz public_html

3. Transfer your Files

Once you are logged into your existing web hosting account, you can begin the transfer process. Before you can start the transfer, you need to know where your content is located on the existing server, and where you require to put the content on the new server. In most of the cases, everything will be found in the public_html folder. You will be performing the transfer using the SCP command, which stands for Secure Copy.

Type: pwd to figure out where you’re at on the server:

# pwd
# /home/admin

Type: cd public_html to “change directory” to public_html:

# cd public_html

# /home/admin/public_html

The address location will be required when you begin the command to start the transfer. Check the location you want to transfer your content to on your fresh server. In most cases, the location will be the similar, public_html. To commence the transfer use this command, but be sure to change it to match your username, addresses, and locations for both servers:

# scp –P 2200 -r source_folder/location/ [email protected]: /destination_folder/

The username and server IP would be of your destination server.

You can also use sftp to transfer files.

4. Backup the Database

WordPress stores data in a MySQL database. You’ll need to move this database to move the site. You’ll need to back up the database from the old site first.

You can export the database with the following command.

# mysqldump -u [username] -p [database_name] > [name_your_backup_file].sql

The username isn’t the same here as your SSH login, it’s your MySQL access username. The database name you can get from the ‘wp_config.php’ file if you’ve disremembered. It will also ask you for a password after this command, which is the database password, which you can also get from the ‘wp- config.php’ file.

This will generate a file (which you mentioned in the last part of that command) which is a whole backup of your database.

Now, to transfer your database, use scp command:

# scp –P 2200 [backup_file].sql [username]@[server-ip]:[backup_file].sql

The usename and server IP would be of your destination server.

5. Extract your Files

To extract your files at the destination server. For the purpose, login to your destination server via ssh. Now, you can extract the compressed file ( here; wpback.tar.gz) to the document root of your new website, using the following command:

# tar -xzvf wpback.tar.gz public_html

Also, change the ownership of the public_html as newusername.nobody and all the files and folders within the public_html folder as newusername.newusername and using the following command

# chown admin.nobody pubic_html

# chown -R admin.betsy public_html

As of now ensure that the default permissions of files and folder as 644 and 755 are correctly updated.

6. Import the database

To import the database first you need to login to MYSQL as root user using the following command.

# mysql -u root -p

Now you need to create new database and user. (Refer the screenshot attached mysql3.png)

Once you created new user and database, log in to the mysql as the new user and follow the steps to import the database.

(Refer the screenshot attached mysql5.png

7.Edit the wp-config file

WordPress stores your database information in the wp-config.php file. Without this information, your WordPress website will not work, and you will get the ‘error establishing database connection‘ error. So you will need to edit the

wp-config file with the new user, database, and the password.

Change the database name:

define(‘DB_NAME’, ‘db_name’);

Change the Database Username:

define(‘DB_USER’, ‘db_user’);

Change The Database User Password

define(‘DB_PASSWORD’, ‘db_pass’);

8. Changing the Site URL and Home URL

If you are moving to a new/different domain be sure to replace <old_url> with

<new_url> .If not, then you can skip this because you don’t have to update your site to point to a different domain.

The following steps will help you to find and replace all the old URLs with the new URLs.

# mysql -u wp_user1 -p Enter password:

Use the database named “store-db”

# mysql> use store-db;

Database changed, Show the tables

# mysql> show tables;

 

Tables_in_store-db

| wp_commentmeta|
| wp_comments|
| wp_customcontactforms_field_options |
| wp_customcontactforms_fields |
| wp_customcontactforms_forms |
| wp_customcontactforms_styles |
| wp_customcontactforms_user_data |
| wp_links |
| wp_options |
| wp_postmeta |
| wp_posts |
| wp_term_relationships |
| wp_term_taxonomy |
| wp_terms |
| wp_usermeta |
| wp_users |

16 rows in set (0.00 sec)

mysql> select * from wp_options where option_value = ‘http://www.domain1.com/wordpress’;

mysql> update wp_options set option_value = ‘http://www.domain2.com’ where option_id = 1;

Query OK, 1 row affected (0.00 sec)

Rows matched: 1 Changed: 1 Warnings:

mysql> select * from wp_options where option_value = ‘http://www.domain1.com/wordpress’;

Empty set (0.00 sec)

mysql> select * from wp_options where option_value = ‘http://www.domain2.com.com’;
| option_id | blog_id | option_name | option_value | autoload |
| 1 | 0 | siteurl | http://www.domain2.com | yes |
1 row in set (0.00 sec)“

9. Changing the DNS Records

Before you can use the site on your new host you will need to check whether all the contents and databases are correctly updated on the new website. You need to forcefully load your website from your local machine, for this you need to add host entry in your local machine.

To add hosts entry :

1) In a Windows machine, Add an entry in this file: %SystemRoot%\system32\drivers\etc\hosts

(where %SystemRoot% is C:\Windows in a Normal case, change it accordingly)

2) In a Linux machine, Add an entry in this file: /etc/hosts

3) In Mac OS, Add entry in this file : /private/etc/hosts

The entry is:

domain.com www.domain.com

Please keep in mind to remove this entry once testing is done.

7 Ways To Secure WordPress Website From SQL Injection

Scala Hosting

Here are the 7 ways to secure WordPress website from SQL Injection:

1. Use SQL injection vulnerability testing tool to scan the WordPress website

There are different tool and plugins available to scan the SQL injection vulnerabilities. You can use those tools to scan and detect malware and vulnerabilities. All you need to do is download any of these and do the scan.

2. Always follow security procedures and update website

It’s very normal for some WordPress sites to ignore security techniques as well as ignore to update websites with new security updates. This is because there are many non-professionals, especially in the case of websites belonging to small businesses or individual users, who don’t know such things and end up being easy targets for hackers. SQL injection attacks are the commonest of such attacks that affect such websites. So, it’s always best to keep your website up-to-date and follow all security procedures.

3. Be careful while installing plugins

Mostly plugins are seen vulnerable in WordPress and also reason to get hack. Use minimum plugins and uninstall unused and unnecessary plugins.   It’s always best to avoid plugins and themes that go on with the same version for a long period; it’s better to move on to a more active and trusted plugin or theme.

4. Hide your WordPress version

It’s in every case best to keep your WordPress version hidden. If not, it would be simple for hackers to identify the vulnerabilities and exploit it. So, it’s recommended to keep the version hidden.

5. Monitoring SQL server

Keep the SQL server under monitoring and check if something unusual activities are going on because if any programming error that you might miss detecting, it could give chance to hackers to exploit the website. Hence, keep monitoring your SQL server closely, detect errors as they happen and repair them immediately.

6. Disable unnecessary functionalities and also change default change database prefix

While installing the WordPress, always change database prefix ‘wp’, it will prevent injecting SQL malware. If there is any unnecessary functionalities, it is recommended to disable it. Such unnecessary, irrelevant and unused functionalities could pave the way for SQL injection attacks.

7. If possible, store website database separately

This tip is not for preventing SQL injection attacks, but for bouncing back into action at the earliest after an attack if at all it happens. Use third-party tools and plugins and store the database of your website separately. This would serve as an easy backup. It’s advisable not to rely on the hosting company alone for website backup; some of them may not provide effective backup service.

WordPress is a common CMS to target for injecting the malware. So, always follow security procedures and host your website on verified and secure hosting provider.

Fix WordPress High I/O Usage

Scala Hosting
What is the reason behind I/O high usages

Mainly the I/O is induced by higher data output and input, or you might claim higher read speed and write speed in the disc. If you are the owner of a VPS or Dedicated server and when you create a ZIP file from the 20 files, and each file has 10 GB, it will take a lot of time and therefore increase the use of I/O.

1. Malware

If malware affects your WordPress site, make sure to clean it up because hackers may try to slow down your website by can your website’s load. You can separately take a backup of your plugins and theme folder and search them at Virus Complete website. If you search, you will find the result which plugin causes this issue so that it is cleaned one by one, or else we would recommend that you avoid using that plugin or theme. DoS attacks, spam attacks, poorly built PHP scripts often consume large amounts of memory and this makes sense for high I / O use within your control panel.

2. Backup Plugins

Some backup plugins produce the backup for you but who knows that in the meantime you are doing the input/output of your data to read and write the data on your hard drive or HDD. If the total data size of your website is too high then you will note that the backup plugin takes too much time to render the backup and that your I/O use is too high and you will find I/O once it is complete.

3. Crawler

If your I/O usage limit is 400 KBPS and you receive more than 400 visitors or if Crawler accesses your pages at a speed of 400 KBPS, your website will display high I/O usage, so either your website will serve the pages or your website will write the data, both will include in the I/O usage. As web spiders that crawl sites too aggressively so there is the chance of increasing the I/O usage of your Cpanel account and results in website slow down.

4. PHP Script

Most Linux servers run Apache web servers in today’s shared hosting environment. Most of those supporting CGI and FastCGI scripts and the most popular one is SuPhp – written in a variety of languages, including Perl, Python, and the most popular, PHP. All CPU, IO, memory resources or Apache processes can theoretically be consumed by a single site and this will bring the server to a complete grinding halt.

5. wp-cron.php File

If you look inside your file manager you can find the file wp-cron.php that is involved in running your automatic task, make sure the file is not infected. Since the plugin’s task is scheduled to run, there is a chance to run the short PHP file to execute the task and increase memory use and I/O use. So you can use a plugin named WP Control to monitor and manage cron actions. If your WordPress does not run on any automated task then it is best to disable access to cron file by changing the file permission to 0000

To fix the high I/O usages, follow these steps

There were several ways you can minimize the high I/O usage and make your website run faster so I will go straight to the solution by highlighting the detailed steps by which you can completely reduce the high I/O usage issue for your WordPress website.

1.  Install caching plugin

As our WordPress website runs over PHP and it takes high memory and CPU usage as it serves the PHP files so if we cache the files and convert it to HTML files and serve it to the users then the load of the website will be minimized hence it will reduce the load. You can use several WordPress plugins like W3 Total Cache and Wp Super Cache, Comet Cache, WP Fastest Cache also WP Rocket plugin as a premium one.

2. Use a CDN

Sometimes huge crawler and BOT wants your website to be down hence they increase the crawl rate and continuously surf the pages of your website, this creates your website unreachable or HTTP 508 error so to block these bots or crawler I will suggest you use CDN like CloudFlare as one of my best choices.

3. Use trusted WordPress plugins and WordPress themes

Always remember that not paying for something which should be paid will lead you to pay more than what you have not paid. In short, if you have taken any premium plugin or theme from someone else who has nulled it or cracked it then remember that person also expecting something from you i.e either damage to your website or some kind of malfunctioning of your website. Nothing is free in this world so if you have taken any paid plugin or theme be sure to check it on Virus Total site so that the item is clean.

4. Use less plugin

Using too much plugin means too much load on your website as each visitors will be served by the plugin to perform the action so there will be a load on your server too. So better use the only required plugins and remove the rest also make sure do not use any automatic plugin like social poster or auto-schedule posts plugin. Use the Query Monitor plugin to see which plugin is creating the high load on your website and fix the load time by analyzing the result generated by the plugin.

In this article, we have seen how to fix WordPress high I/O usage.

« Older posts

© 2021 Fix WP with Ashik

Theme by Anders NorenUp ↑