How to share ebooks with WordPress (EPUB and MOBI files)

If you’ve ever tried to upload an ebook in .MOBI or .EPUB format with the WordPress Media Uploader, you will have noticed an error message appear. Something along the lines of “Sorry, this file type is not permitted for security reasons”.

The only way then appears to be to ZIP the file and share it. That’s not a great experience for mobile users, who would simply like to click on a file and open it in an application such as iBooks or Kindle.

The solution to this puzzle lies in adding the required mime types to WordPress, so that these file types are allowed.

Let me show you how to do it in this article.

Read more

How to declare Classes in PHP

Since PHP 5 we can use object oriented features in PHP. This allows us to not only use functions and variables, but also write classes and create instances of them in our code. Here’s quick rundown on how to do it. Writing and instantiating a Class Creating classes is very similar to writing functions. Here’s … Read more

How to switch off emails from Anacron in Plesk Onyx

In 2011 I wrote an article about how to avoid emails from Dr. Web. In it I was discussing how to switch off these notifications, which are generated when the Dr. Web service updates itself. Here’s an example: /etc/cron.daily/drweb-update: Dr.Web update details: Update server: http://update.msk5.drweb.com/plesk/700/unix Update has begun at Fri May 18 03:53:47 2018 Update … Read more

Fan Maintenance on my Samsung NC10

My Samsung NC10 Netbook has been in constant operation since 2013, for 24 hours a day, 7 days a week. It’s doing a great job as our internal office server, purring along quietly running CentOS 6.

When I put it in operation 5 years ago, I made sure no mechanical parts we being used anymore to avoid wear and tear: I’ve added an SSD, and once a day valuable data is backed up on a permanently mounted SD card.

The only mechanical thing still in use is the internal fan. I knew the day would come on which the poor thing would either give up and need replacing, or at least require some maintenance to make it go a few extra miles. Well, that day has come at the beginning on this month, when I noticed a bit of rattling noise that started happening behind my big monitor. That’s where I keep the little guy.

Turns out that the fan can be easily whipped back into shape with a drop of bicycle oil. It’s really easy to disassemble too – let me show you how I did it.

Read more

How to host multiple websites with Apache

The Apache web server has a convenient feature called Name-based Virtual Hosting. This function allows us to have a single LAMP Stack server configured on one IP address, but serve a different set of files depending on which domain is being requested.

This sounds more complicated than it is. Say we had example1.com and example2.com, both of which are to be separate websites, but both domains point to the same IP address. Apache’s Name-based Virtual hosting makes this possible. In fact, this feature forms the basis of 90% of this planet’s shared hosting business.

Let’s see how to do this in CentOS 6 and 7.

Read more

How to update legacy constructor methods in PHP 7

When I was fiddling with my P2 Categories theme last week, debug mode generated several warnings when run in PHP 7.2.1. That’s because class methods are no longer allowed to have the same name as the class itself. This was allowed in PHP 5 and earlier, but from what I gather it’s no longer the … Read more