Recent Updates Toggle Comment Threads | Keyboard Shortcuts

  • Jay Versluis 10:01 am on April 13, 2015 Permalink | Reply  
    Categories: Announcements ( 7 ), Linux ( 100 )   

    LAMP Stack for Humans – now available on Amazon 

    Lampstack-SoftcoverMy book LAMP Stack for Humans is now available on Amazon. In this 284 page guide I’ll walk you through the process of turning an old laptop into an always-on server. You can use it to run web applications in the comfort of your own home or office – no “cloud” required.

    Together we will configure the entire server: you will learn how to install CentOS, Apache, PHP and MySQL (or MariaDB) and WordPress. I will show you how you can reach your server from other computers on the network and how to create regular backups.

    Perfect for the Linux newbie and those who want to get started with web applications without spending money “in the cloud” (in my opinion THE WORST expression for describing remote computers).

    If you’re an avid reader of this site and have always wished that some instructions would be presented in a more cohesive form rather than in snippets, then LAMP Stack for Humans is perfect for you.

     

    Grab your free sample today, or read the entire book for free via Kindle Unlimited!

     

     
    • Falkon 2:28 am on October 21, 2015 Permalink | Reply

      Hi Jay
      I have a question regarding WP adding a Landing page for an existing site, meaning to add a new page which only displays a big logo in the start and be able to make that logo a roleover logo, and then the click would navigate a user to the main ( index page) if you will. i am new to WP and PHP wise I am still learning so I would not know how to add an extra page as the index page and the first index page turns say into a home.html. How would you do that? I trying to learn PHP and WP to what I work with in HTML & CSS and front end designs.
      Beforehand allow me to thank you for you time, help and assistance,

      Best Regards
      Falkon

      • Jay Versluis 2:55 pm on October 21, 2015 Permalink | Reply

        Hi Falkon, that’s a VERY off-topic question for this post…

        WordPress does have a way to display a static page as front page, instead of the default blog posts. You can change it like this:

        • for the blog, create a new page with a title (no content is necessary)
        • head over to Settings – Reading
        • under Front Page Displays, select your pages
        • hit Save and refresh the front page

        As for the roll-over image: insert an image into your static front page, then link that image to wherever you want (you can do that with Add Media from the page creation dialogue).

        Hope this helps!

  • Jay Versluis 9:45 am on May 22, 2018 Permalink | Reply
    Tags: ,   

    Categories: Linux ( 100 )   

    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. (More …)

     
  • Jay Versluis 8:51 am on May 20, 2018 Permalink | Reply
    Tags:   

    Categories: Themes ( 28 ), WordPress ( 144 )   

    How to increase the font size in Automattic’s P2 Post Box 

    Front page posting is what the P2 theme is all about – but I personally find the default font size on the front page a bit too small. Perhaps it’s my raging tired eyes. In every child theme I write for P2, I usually increase this – both for immediate posting, as well as for text editing (which also happens inline on the front page).

    To do that, add the following to your style.css file:

    /* larger text for post box and editing */
      #postbox textarea #posttext, textarea.posttext {
      font-size: 1.3em !important;
    }
    This will address the font size for both inline editing as well as posting. I’ve chosen 1.3em because it integrates well into my other settings, but feel free to choose something larger or smaller (1.2em or 1.4em respectively). You can also choose a defined point size like 16px if you like.
    Happy hacking!
     
  • Jay Versluis 9:44 am on May 19, 2018 Permalink | Reply
    Tags:   

    Categories: PHP ( 28 )   

    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 way to do things. Back then such methods were used as constructors, or in other words, methods that would be run automatically when the class is instantiated.

    Let’s take an example from the P2 theme. Here’s the beginning of the P2 class as of version 1.5.8:

    class P2 {
    	// ...
    	function P2() {
                // ...
    

    This will work just fine in PHP 5, but will generate a warning in PHP 7 (even though the code will execute). To update this, all we need to do is change our function name to __construct (notice the two underscores at the beginning of the name):

    class P2 {
    	// ...
    	function __construct() {
                // ...
    

    Anything inside the __construct() function is executed as soon as an instance of the class is created.

    When updating legacy code, there is the risk that the previous function name is called during instantiation. Consider this:

    class P2_Post_List_Creator extends P2_List_Creator {
    	var $form_action_name = 'p2-post-task-list';
    
    	function P2_Post_List_Creator() {
    		parent::P2_List_Creator();
                    // ...
    

    Here a class extends another class and calls a constructor method of the parent class by name. If we had just patched the parent class with _construct(), the child class would throw an “undefined function” error.

    To avoid this we’ll also have to update any calls made to the original constructor method, like so:

    class P2_Post_List_Creator extends P2_List_Creator {
    	var $form_action_name = 'p2-post-task-list';
    
    	function P2_Post_List_Creator() {
    		parent::__construct();
                    // ...
    

    And that’s really all there’s to it.

     
  • Jay Versluis 9:52 am on May 18, 2018 Permalink | Reply
    Tags: , Releases   

    Categories: Themes ( 28 ), WordPress ( 144 )   

    P2 Categories – Version 1.6 released 

     

    Last week I found some time to update my fork of Automattic’s P2 theme, aptly titled P2 Categories. In addition to all the greatness of P2, it’s been adding front-page category posting since 2013 (and hasn’t seen an update since then either).

    Here’s what’s new in the latest version:

    • fixed the drop down menu, which was no longer working since Safari 10
    • rewrote the whole theme from scratch, based on P2 v1.5.8 (2016)
    • fixed a bug that would not show the correct number of posts in a category
    • added new p2-categories-functions.php file
    • updated a call to a deprecated WordPress function with wp_get_current_user()
    • fixed several PHP 7 deprecation warnings
    • updated class constructors to use __construct() methods
    • hunted down undocumented features and documented them
    • added a changelog file

    P2 is no longer maintained by Automattic, except for dire security patches. I’ve noticed several deprecation notices, both for WordPesss 4.9 as well as PHP 7.2.1 and fixed those as well.

    Get the latest version on GitHub

    You can download the latest version of the theme over on the official GitHub Repository. Feel free to examine the code, tinker with amendmends and share with everyone who wants to use P2 with categories:

    Why is this version not on WordPress?

    I had submitted previous versions of P2 Categories to the WordPress repos too, and you can still download version 1.5 there. However, since 2013 web standards have become more strict, and there’s no way my theme would pass modern tests the theme team are using for new submissions. Sadly I’m not a web developer and it’ll be very difficult for me to update aspects of the theme I don’t fully understand.

    Having said that, if you know how to pass modern web standard tests, feel free to send me a pull request on GitHub.

     
  • Jay Versluis 10:04 am on May 17, 2018 Permalink | Reply
    Tags:   

    Categories: Themes ( 28 ), WordPress ( 144 )   

    How to display categories in Automattic’s P2 Theme 

    By default, Automattic’s phenomenal P2 theme does not support posting into categories from the front page, it only supports tags. My fork of the theme called P2 Categories does that though and lets you conveniently select a category from a drop down menu right there on the front page.

    I wrote an update to it last week, and in so doing my article from 2013 came in handy that explains how to add this functionality to P2. Nothing much has changed in the source code, so it’s still relevant and accurate.

    What the above article did not explain however was how to show which category a post belongs to. And because it’s still fresh in my  memory how to do this, I thought I’d better write it down for next time (and anyone who’s interested in how to do it).

    (More …)

     
  • Jay Versluis 9:56 am on May 16, 2018 Permalink | Reply  
    Categories: Plesk ( 75 )   

    How to hide the Promo Box in Plesk Customer View 

    There’s a small Promo Box on the right hand side in Plesk’s Customer View. This box can be a little confusion for users – especially when it shows products and extensions with highly cryptic names. Here’s an example:

    Lucky for us, there’s an easy way to remove it. All we need to do is create a vile called /usr/local/psa/admin/conf/panel.ini and add the following content to it:

    [promos]
    ; Disable other products promotions
    
    enabled = off

     

    This file is read by Plesk every time the panel loads, telling Plesk what to display in the admin interface. With the above command, the Promo Box is suppressed.

    There’s no need to restart anything, simply reload the page in your web browser and the box will be gone.

     
  • Jay Versluis 9:24 am on May 15, 2018 Permalink | Reply
    Tags:   

    Categories: Linux ( 100 ), PHP ( 28 )   

    How to install PHP 7.x on a CentOS LAMP Stack 

    By default, CentOS 7 comes with support for PHP 5.4. Sadly that version has reached the end of its life in 2015and is no longer updated by the developers. If we want to stay up to date with the latest software, we may want to upgrade (if our applications are working with newer versions of PHP).

    For CentOS users this either means to compile cutting edge versions from source and tweaking lots of scary system configurations – or dipping into the power of Software Collections. These are official pre-compiled packages by the software vendor, designed to run newer versions of software alongside those that are provided by default.

    At the time of writing, PHP 7.2 is available but it’s not part of the software collections yet, so we’ll use  PHP 7.1 with FPM support under Apache (as it’s the recommended way to do so).

    Let’s begin! (More …)

     
  • Jay Versluis 9:53 am on May 14, 2018 Permalink | Reply
    Tags: ,   

    Categories: Linux ( 100 )   

    Finding your current MAC address in CentOS 

    I had an issue with one of my servers the other day: its power supply died unexpectedly during a scheduled restart. The poor thing never cam back up again.

    Lucky for me, the data centre could simply swap out my hard disks and put them into another server. Although my data was save, the server wouldn’t connect to the network anymore – because it had a new MAC address. CentOS stores this value in two of its files, and when it changes (which is hardly ever the case), those files need to be updated.

    Here’s how I fixed the problem. I did this on a CentOS 6 server, but it looks like the procedure is the same for CentOS 7. (More …)

     
  • Jay Versluis 9:54 am on May 13, 2018 Permalink | Reply
    Tags: ,   

    Categories: Plesk ( 75 )   

    How to hide the social links at the bottom of Plesk 

    By default, Plesk displays several links in its footer. Two of them are links to Plesk’s Facebook and Twitter pages.

    Sometimes less is more, and thankfully there’s an easy way to suppress those links if we don’t want to see them anymore.

    Simply create a file called /usr/local/psa/admin/conf/panel.ini and add the following content to it:

    ; Hide Like link
    
    showLikeLink = off
    
    [twitter]
    ; Hide the Follow Us link
    
    showFollowLink = off

    Plesk reads this file every time the admin interface is displayed, and if it finds the above instructions, those links won’t be printed.

    There’s no need to restart anything, simply refresh your Plesk page in the browser and those links are gone.

    For more configuration options, take a look at the included /usr/local/psa/admin/conf/panel.ini.sample file.

     
  • Jay Versluis 9:14 am on May 12, 2018 Permalink | Reply  
    Categories: Plesk ( 75 )   

    Testing Incremental Backups in Plesk Onyx 

    From time to time I get crazy ideas, and last week that crazy ideas was to test how well incremental backups can be restored in the latest version of Plesk. Specifically I wanted to know how Plesk would react in times of a crisis, which usually happens at the worst of times.

    Up until recently I’ve always done full backups – but incremental backups are a lot more space saving on the target device, plus it reduces the load on the server and data traffic significantly. Let’s see what these incremental backups are all about.

    Wikipedia suggests that after a full backup, each increment needs to be available to make a restore.  This would indicate that deleting one backup in the middle (simulating a failed backup) would mean the restore would fail.

    But how does Plesk work, and how would it react if we’d take away an increment in the middle? Would it indeed need all incremental parts to rebuild a backup? Or would it always refer to the full backup and write its increments accordingly? Let’s find out!

    I’m using a test system on a CentOS 7.5 server, with Plesk Onyx 17.8 installed. I have a test domain with a default WordPress instance, but it’s not doing much at the moment and could probably do with a quick facelift if anything.  (More …)

     
c
Compose new post
j
Next post/Next comment
k
Previous post/Previous comment
r
Reply
e
Edit
o
Show/Hide comments
t
Go to top
l
Go to login
h
Show/Hide help
shift + esc
Cancel