Skip to main content

WordPress – How to perform Search and Replace on whole Database (post, pages, wp_options) using WP plugins or MySQL tools

Those who are frequently working with Worpress often find themselves operating mass-replace tasks throughout the whole WP Database. Such situation most likely arises in the following scenarios:

  • WebSite URL change (from  www.url-a.com to www.url-b.com), meaning we have to replace the old one in all of our posts/pages.
  • Invalid character issues (mostly due to charset)
  • Having to rename one or more keywords, tags, categories or more (for standard URL & links consistency).
  • Presence of a typo within multiple posts, which you would like to fix without performing thousands of edits.

When we need something like that, we can choose between two possible routes: going for a WordPress plugin to handle such issue in a managed way or work at database level with the help of some free and/or open MySQL management tools.

Read More

WordPress – How to retrieve all posts from one or more given categories with a SQL query

Today a client asked me to remove all the posts from a given category to the auto-generated XML Sitemap of his WordPress blog and also redirect these posts to a new website (same slug, different host): here’s a quick report of how I managed to do that, hoping that it would also help other System Administration that will be given these same tasks.

Read More

Protect CentOS from unwanted SSH failed login attempts with Fail2Ban

SSH is most likely the most secure way to remotely connect to a LINUX-based server machine. However, the fact that the SSH daemon service needs to be reached from the Internet and is usually configured to listen to a well-known TCP port has always been a major security flaw: it allows attackers to relentlessly spam it with a huge number login attempts, hoping to find a hole in your UAC setup.

To better understand what we’re talking about, let’s take a look at the following screenshot:

Those 150 failed login attempts have been attempted on one of our CentOS7 servers in a fifteen-minute range: we’re easily talking about thousands of them every single day, which would eventually break any non-strong password, other than flooding our beloved port 22.

It would be a good thing if we could do something about this nasty problem, for example issuing some throttling rules that could force these login attempts to respect a time limit each time they issue a wrong password. Luckily enough, there’s more than something we can do about that.

UPDATE: if you have the same problem with the Windows Server RDP service, read here to fix it.

Read More

How to increase the 2GB memory limit of a 32-bit (x86) EXE in 64-bit (x64) Windows

If you’re reading this, you are most likely dealing with an issue regarding a 64-bit Windows machine (such as Windows 2008 Server, Windows 2012 Server, Windows 7, Windows 10 and so on) and a rather old, 32-bit (x86) executable file with some memory issues.

If you already did some research, you might also be already aware of the fact that any single 32-bit application can use a maximum amount of 2GB of RAM, regardless of what your system actually has. This basically means that you cannot fix your issue with an hardware upgrade.

This leaves you with two alternatives, both software-based:

Read More

How to check if a binary file is 32 bit (x86) or 64 bit (x64) on Windows

Yesterday we had the urgent need to check if a rather old executable file that we still use on one of our x64 Win2012 production servers to do some automation tasks was built for an  x86 or x64 machine type. Normally you know that in advance, but the guy who originally built the file was no longer with us and both the file name and the folder wasn’t clear about that.

The tool we did use to solve our issue was the great Sigcheck by SysInternals, which is available here for free.

Once downloaded and unpacked, using it is as simple as type the following in the command-prompt:

Read More

Close