Recent Updates Toggle Comment Threads | Keyboard Shortcuts

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

    LAMP Stack for Humans – now available on Amazon 

    Lampstack-SoftcoverMy new book LAMP Stack for Humans is now available on Amazon. It 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!

     

     
  • Jay Versluis 9:33 am on June 15, 2015 Permalink | Reply
    Tags: , ,   

    Categories: Commodore ( 19 )

    How to split a long string into separate words in Commodore BASIC 

    Here’s a quick word splitter routine for CBM BASIC. It takes phrase and “explodes” all words into an array, removing spaces. Feel free to adopt it for your own needs.

    10 rem word splitter
    20 rem splits a long phrase into words at a space
    30 input "tell me something";a$
    40 rem clear current array of words
    50 for i=0 to 10: wd$(i)="": next: wd=1
    60 rem detect spaces
    70 for i=1 to len(a$)
    80 wd$(0)=mid$(a$,i,1)
    90 if wd$(0)=" " then wd=wd+1: next
    100 wd$(wd)=wd$(wd)+wd$(0): next
    110 print
    120 rem print all words
    130 for i=1 to 10
    140 if wd$(i)="" then 160
    150 print wd$(i)
    160 next
    

    Line 50 clears an array of 10 words called WD$(n). We also setup a word counter called WD. So in this example we can only detect a maximum of ten words. If you need more, you must DIM the array first.

    Lines 70 loops through all characters in our phrase. We make use of the first element in our array WD$(0) to store each single character. If it’s a space, we’ll increase the word counter and move on to the next character. If it’s not (line 80), then we’ll add this character to the current word which is stored in WD$(WD).

    The rest of the code simply prints each word on a new line to see our handy work.

     
  • Jay Versluis 8:57 am on June 2, 2015 Permalink | Reply
    Tags: ,   

    Categories: Mac OS X ( 18 )

    How to kill the “accept incoming connections” dialogue on your Mac forever 

    Screen Shot 2015-06-02 at 08.28.12Have you ever come across the above dialogue, asking if you’d like to “accept incoming network connections” on your Mac? It’s caused by the Firewall and it’s meant to be helpful. Because if you have an app that needs incoming network connections all the time, you can just add them to the Firewall rules (under System Preferences – Security – Firewall).

    But of course, it doesn’t always work. Some apps get updated and this message starts appearing out of the blue, no matter if it hasn’t happened before or if you’ve manually added said app to the Firewall rules a thousand times already. God only knows whatever is upsetting our precious operating system, but it’s driving us all nuts.

    Help is at hand: turns out these messages are caused by some certificate issue I genuinely do not care to know about – nor should I have to. Here’s a “relatively easy” way to fix it once and for all. There are other ways which involve more typing, or switching off the Firewall altogether, but the following is by far the quickest option in my opinion:

    • open a Finder window and navigate to the app in question (usually in Applications, potentially in a subfolder)
    • open a Terminal Session (under Applications – Utilities – Terminal)
    • type cd followed by a space
    • from the Finder window, drag the folder in which your app resides into the Terminal window
    • hit return (this will put you into the same directory as your app)
    • type the following scary line of code:
    sudo codesign --force --deep --sign - ./YourApp.app
    

    Replace “YourApp.app” with the actual name of the app, including the .app extension. You will be prompted for your password and in a few moments you should see a message such as “replacing existing signature”. With this code your Mac will have created a self-signed ad-hoc certificate, re-signing the app.

    Don’t worry if this doesn’t sound English, all it means is that we’re telling the operating system (or rather, Keychain Access) that “the Administrator says it’s OK to trust this app”.

    Now launch your app again. Don’t be dismayed when you see that annoying “accept incoming connections” dialogue again – it’ll be the last time. Select “allow” and you’re done with this – hopefully for good. Try it out by closing your app and restart it again. Celebrate about not seeing that message again.

    Kudos to ahall over on Stack Exchange for this tip! It’s made me a much happier person again :-)

     
  • Jay Versluis 9:33 am on May 21, 2015 Permalink | Reply
    Tags:   

    Categories: Mac OS X ( 18 )

    How to reset the PRAM (or NVRAM) on your Mac 

    On a recent chat with Apple support, the representative suggested I reset my PRAM. From what I understand this will clear BIOS like values that may cause a Mac to malfunction. It only takes a second to do – here’s how:

    Press CMD+OPTION+P+R, then start the system. You’ll need three hands or a portable keyboard to do it.

    Hold those four keys down until you hear a second startup chime (or if you’ve previously disabled in, until you hear one chime).

    That’s it!

    Note that there are technical differences between the PRAM, NVRAM and the SMC, but I really don’t know what they are. You can reset them all to make your Mac behave if it’s doing weird things though.

     
  • Jay Versluis 7:34 am on May 20, 2015 Permalink | Reply
    Tags:   

    Categories: Mac OS X ( 18 )

    How to start Mac OS X Yosemite in Safe Mode 

    Hold down SHIFT during normal boot, until the loading bar appears. It will take longer than usual to start the system. Some services are not available.

    Safe Mode will clear several caches and verify the startup disks.

    From the command line, or on remote systems, boot into Safe Mode using this:

    sudo nvram boot-args="-x"
    

    When you want to boot into “normal” mode again, change the startup parameters to nothing:

    sudo nvram boot-args=""
    

    Very handy article from the Apple Knowledge Base:

     
  • Jay Versluis 9:55 am on May 3, 2015 Permalink | Reply
    Tags:   

    Categories: Linux, Plesk ( 68 )

    How to update Plesk via the Command Line 

    Plesk-LogoYou can update Plesk via the Web Interface (under Tools and Settings – Updates and Upgrades). However sometimes the interface times out, or browsers get confused – therefore it’s good to know that you can apply updates via the command line interface as well. In this article I’ll show you how (in Linux – I don’t know much about running Plesk on Windows I’m afraid).

    We need to download the standard installer script for this. It’s a powerful little tool which can also be used to add or remove components from the current Plesk installation, or to install Plesk on a barebones server.

    As of 2015 the link can be found here:

    Screen Shot 2015-05-03 at 09.39.40

    If you click the option “Download Plesk installer for Linux”, you’ll see the actual script open in a new browser tab. Not what we want, although you could copy and paste this into a new file on your Linux system. Instead, right-click on the link and choose “Copy Link” instead.

    Screen Shot 2015-05-03 at 09.41.27

    With that link in your clipboard, connect to your server via SSH and download the file with something like wget:

    wget http://autoinstall.plesk.com/plesk-installer?long-url-here
    

    This will result in a file called “plesk-installer” with some nasty parameters at the end, several hundred characters in total. Let’s rename it to something easier and tweak the execution permissions:

    mv plesk-installer* plesk-installer
    chmod +x plesk-installer
    

    Now we can run the script like so:

    ./plesk-installer
    
    Welcome to the Parallels Installation and Upgrade Wizard!
    ===============================================================================
    
    This wizard will guide you through the installation or upgrade process. Before
    installing or upgrading Parallels products, be sure to back up your data.
    
    To start the installation or upgrade, press N and then press Enter.
    To quit the installer, press Q and then press Enter.
    

    Follow the instructions to upgrade Plesk. You can also call the script with several options, for a full list of those call it with “–help”. To see all available versions of Plesk during the installation, use “–all-versions”, which will eventually lead you to a screen similar to this:

    Select the desired products and their versions
    ===============================================================================
    
    The following product versions are available:
    
    1. [*] Parallels Plesk
      2. ( ) Parallels Plesk Panel 12.1.21 (testing)
      3. ( ) Parallels Plesk Panel 12.1.20 (testing)
      4. ( ) Parallels Plesk Panel 12.1.19 (testing)
      5. ( ) Parallels Plesk Panel 12.1.18 (testing)
      6. ( ) Parallels Plesk Panel 12.1.17 (testing)
      7. ( ) Parallels Plesk Panel 12.1.16 (testing)
      8. ( ) Parallels Plesk Panel 12.1.15 (testing)
      9. ( ) Parallels Plesk Panel 12.1.14 (testing)
      10. ( ) Parallels Plesk Panel 12.1.13 (testing)
      11. ( ) Parallels Plesk Panel 12.1.12 (testing)
      12. ( ) Parallels Plesk Panel 12.1.11 (testing)
      13. ( ) Parallels Plesk Panel 12.1.10 (testing)
      14. ( ) Parallels Plesk Panel 12.1.9 (testing)
      15. ( ) Parallels Plesk Panel 12.1.8 (testing)
      16. ( ) Parallels Plesk Panel 12.1.7 (testing)
      17. ( ) Parallels Plesk Panel 12.1.6 (testing)
      18. (*) Parallels Plesk 12.0.18 (Stable) (currently installed)
    
    N) Go to the next page; P) Go to the previous page; Q) Cancel installing
    To select a version, type the respective number;
    Select an action [N]: 
    

    If you call the script without any parameters, only micro updates and additional components are applied. Micro updates are usually applied automatically if this feature is enabled (it is by default).

     
  • Jay Versluis 11:58 am on April 27, 2015 Permalink | Reply  
    Categories: Plesk, WordPress ( 65 )

    How to fix WordPress Media upload trouble caused by open_basedir restriction 

    I’ve recently migrated a WordPress site from one server to another (running Plesk) and noticed that file uploads were no longer working. All existing files showed up fine, but new uploads were always aborted with a message such as “Is your uploads directory writable?” – which of course it was.

    Here’s what it looked like – a familiar sight for anyone with WordPress issues:

    Screen Shot 2015-04-27 at 11.29.46

    Uploads had been working fine on the pervious server, and other sites on the new server didn’t have a problem. Puzzles like that rob me of sleep and sweet dreams. I decided to poke into any error logs on the new server (which wasn’t even that new mind you).

    To my surprise I found that in /var/www/vhosts/system/domain.com/logs, there was an error log that was seemingly growing out of control very quickly. At one point it was over 500GB in size. Obviously this had a very adverse effect on the that server, which was running out of space when it shouldn’t have.

    The repeating error message was this:

    mod_fcgid: stderr: PHP Warning:  is_dir(): open_basedir restriction in effect. 
    File(/) is not within the allowed path(s): (/home/www/vhosts/domain.com/:/tmp/) 
    in /home/www/vhosts/domain.com/httpdocs/wp-includes/functions.php on line 1501

    Sure I thought, I can understand why the server had a problem with this: the path is just NOT where domain data is saved on my target server. Why was it addressing a path that may have worked on the source server? Shouldn’t WordPress adjust itself automatically?

    Why yes, usually it does – unless of course there’s an old database entry that specifies this path. Many options have been removed from the WordPress admin interface over time, but the values that could be set are still in effect. Thankfully it was an easy fix – even though it took me days to think of this: that nasty path was defined under Settings – Media:

    Screen Shot 2015-04-27 at 11.28.24

    Anything in the top field is a full server path. If it starts with a slash it’s a root path, while no slash at the beginning is a relative path. A wrong path (like mine) messed up all future uploads. All I had to do was delete anything in that field.

    Note that this option only shows up if a path is defined: as soon as I cleared the field, the option disappeared.

    Thanks to cleasterwood for this tip, who had this problem 5 years ago (goes to show how old my WordPress installation really was):

    As for that huge 500GB log file, that’s another story: simply deleting it was not enough to free up space on the server. Because Apache kept an open write connection to that file, I was still running low on space – even though the file was gone. Restarting Apache didn’t do the trick either.

    What did work here was a full server restart. It took a little longer than usual, but the massive log file was gone, and over 500GB of space was back at my disposal. And more importantly, my WordPress instance was accepting uploads again.

    Phew!

     
  • Jay Versluis 4:05 pm on April 23, 2015 Permalink | Reply
    Tags: , ,   

    Categories: Linux, Plesk ( 68 )

    How to open SMTP port 587 to send emails in Plesk 

    Plesk-LogoBy default Plesk on Linux uses Postfix for outgoing email, and by default listens on port 25 for outgoing SMTP mail. Some service providers do not allow to send emails on that port, and tragedy occurs: clients can’t send email with their Plesk servers. Not good.

    Other SMTP ports will usually work, such as the other favourite 587 – but by default, Postfix is not listening on this port for email submissions – at least not in Plesk 12.0.8 on CentOS 7.

    Here’s how to enable port 587 such such ventures:

    Open the Postfix configuration file at /etc/postfix/master.cf and find the following line. It’s commented out. All we have to do is to remove the hash in front of it, and email can be sent via port 587:

    submission inet n       -       n       -       -       smtpd
    

    Restart Postfix for the changes to take effect. In CentOS 5 and 6:

    service postfix restart
    

    This will also work in CentOS 7, but to be more precise:

    systemctl restart postfix.service
    

    Happiness!

    Note that port 587 needs to be open in your firewall. If the Plesk Firewall Extension is enabled, it’ll take care of it for you automagically.

     

     
  • Jay Versluis 9:54 am on April 23, 2015 Permalink | Reply
    Tags:   

    Categories: WordPress ( 111 )

    What is the Prove your Humanity login feature in WordPress 

    Screen Shot 2015-04-21 at 08.31.32

    Some of my clients have recently noticed a new math question on their WordPress login screen. It prompts to Prove your humanity in addition to your user name and password.

    This feature was recently introduced in Jetpack as part of the Protect Feature, which prevents hackers from trying to gain access to your WordPress site via brute-force attacks. Prove your humanity means that bots have a hard time logging in. You can even see how many times Jetpack has prevented unsuccessful login attempts.

    To remove the math question you can whitelist your own IP so that Jetpack knows you’re logging in from a legitimate address. To do this, login to your admin interface and head over to Jetpack – Settings – find the Protect Feature and hit Configure. This brings up a window similar to the one below.

    Screen_Shot_2015-04-23_at_09_38_18

    You will see your current IP address. Add it to the list and click save – and you won’t see the additional math question again, provided you login from the same IP. Repeat the process and add additional IPs if needed. If you have multiple users on your team who all contribute to the site, ask them to provide their IP via http://whatsmyip.org or similar services.

    If you’ve been accidentally logged out can cannot gain access to WordPress anymore, you can add a single IP address to your wp-config.php file by defining the following constant:

    define('JETPACK_IP_ADDRESS_OK', '12.34.56.78');

    Replace 12.34.56.78 with your actual IP address (obviously).

     
  • Jay Versluis 6:03 pm on April 22, 2015 Permalink | Reply
    Tags:   

    Categories: Linux, Plesk ( 68 )

    How to turn off all Plesk Health Monitor alert emails 

    Plesk-LogoI have previously described how to adjust the values that the Plesk Health Monitor uses to determine when an email should be sent out.

    There is also a way to switch these emails off entirely. Here’s how:

    To turn off the daemon that is responsible for sending these emails, issue this:

    /etc/init.d/psa-health-monitor-notificationd stop
    

    No more emails until you restart the server, when the daemon will be resumed. If you don’t want that, switch it off at boot time using

    chkconfig psa-health-monitor-notificationd off
    

    To remove the Health Monitor altogether, head over to Tools and Settings – Updates and Upgrades and uninstall the component.

     
  • Jay Versluis 8:24 am on April 21, 2015 Permalink | Reply
    Tags: , , NGINX   

    Categories: Plesk ( 65 )

    How to fix Apache/NGINX trouble after restarting your Plesk server 

    Plesk-LogoSome of my servers have a weird habit of throwing an Apache error after a restart: NGINX is running fine, but Apache can’t start and all websites are down. I have no idea why some servers do it and some do not. But when they do, it’s just plain annoying.

    Here are two ways to fix this problem.

    Restart Apache gracefully

    The quickest option is to shutdown NGINX, restart Apache, tell it to shutdown gracefully and then bring up NGINX again. Here are the commands that will work on CentOS 7:

    systemctl stop nginx.service
    systemctl restart httpd.service
    apachectl graceful
    systemctl restart nginx.service
    

    Likewise, on CentOS 6 we can use the service command to do the same:

    service nginx stop
    service httpd restart
    apachectl graceful
    service nginx restart
    

    Note that Apache doesn’t always like a restart – in which case, stop the service first, give it a moment and then restart it. Quirks and habits I guess.

    Thanks to Mike Yrabedra for this tip!

    If you find yourself doing this a lot, consider writing a quick script with the above commands, or restart your server less often (sometimes it’s enough to restart Plesk, or not reboot the machine at all). Alternatively, you can remove NGINX altogether and avoid such problems in the future.

    Removing NGINX from Plesk

    NGINX is not necessary – Apache will do a good job by itself. If you want to get rid of it completely, head over to Tools and Settings (or the Server Tab if you’re in Power User Mode) and select Updates and Upgrades. You’ll be taken to the Parallels Installer. Select Add/Remove Components.

    Screen Shot 2015-04-21 at 08.10.45

    Scroll down to the NGINX section under Web Hosting Features and untick both NGINX options. Now click Continue at the bottom and NGINX will be removed, leaving Apache in charge for all website connections. There’s no need to restart Plesk.

    Screen_Shot_2015-04-21_at_08_11_17

    Why would anyone want to use both NGINX and Apache together?

    Very good question indeed. Both are excellent web servers, and logic dictates that you should use one or the other. Using two web servers together is a certain sign of trouble.

    From what I understand, NGINX is not designed to be a replacement web server in Plesk (even though NGINX can be used in this way on a LAMP Stack). Instead it is implemented as an enhancement to Apache, sitting in front of it. Static files are therefore served from NGINX via Apache, and NGINX acts as a reverse proxy server.

    The benefits are faster connections and a smaller memory footprint. Read more about how NGINX and Apache are implemented in Plesk in the following articles:

     
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