Creating modifications in isolated files instead of hacking Plesk core files also assures that upgrades won’t overwrite any changes you’ve made (much like the Child Theme philosophy in WordPress).
Here’s a quick how-to guide on writing your first extension.
Uploading an existing Extension
Extensions come into Plesk as a ZIP file which you upload under Server Management – Extensions (in the left hand sidebar):
You can get pre-built Extensions in three different ways:
from within Plesk, click on “Products from Parallels Partners”
from the Extensions Repository at http://ext.plesk.com
or create your own
Let’s see how to do this next.
Creating an Extension
The structure for an Extension is a bit complex, but thankfully the extension tool provides a skeleton for us – much like the zf tool does in ZEND Framework.
The tool is located in /usr/local/psa/bin/extension
Here’s how to setup a basic skeleton:
Theextension was successfully created.
Thepath to extension'sentrypoints:/usr/local/psa/admin/htdocs/modules/myextension/
Thepath to PHPclasses:/usr/local/psa/admin/plib/modules/myextension/
Thepath to installationscripts:/usr/local/psa/admin/plib/modules/ext1/myextension/
Thepath to the directory with run-timedata:/usr/local/psa/var/modules/myextension/
This will create the files and folder structure on the machine running Plesk, but will not activate the extension. To do this issue
Once registered your Extension will show up in Plesk:
Note that you do not need to register extensions uploaded as ZIP files – they will automatically be activated.
To change the title and description of your Extension, edit your meta.xml file here:
To package your extension for installation in Plesk you can use the –pack option. This will create a handy ZIP file in the folder you’re currently in. Alternatively specify a path using the –destination option:
Now you can distribute your file. Install it via the web interface under Extensions – Add Extension.
Example: Here’s a quick CSS tweak
Just to show you how powerful extensions can be, let’s add some CSS to the default Plesk styling. I’m going to make the big notifications box disappear that we see on the Admin Home Page:
With a quick inspection we can see the CSS class applied to the entire blue box. To suppress its output we can do this:
/* CSS Document */
To add our own “child style sheet” we need to create a file called global.css in this directory:
An index.php file should already be present here whose content will be displayed if a user clicks on your extension link (under Server Management – Extensions). With the additional CSS our big blue box is gone as long as our Extension stays active. The box comes back when our Extension is removed.
If you’d like to change the values of your Extension, such as title and description, edit the .xml file in /usr/local/psa/admin/plib/modules/myextension/meta.xml.
More Information and Live Demo
Andy Kugaevskiy and I will do a demonstration on the best practices of working with the SDK at Parallels Summit in New Orleans this year. We’ll show you in detail how extensions can work for you. Join us if you can!
In the meantime checkout the marvellous documentation the team have put together at http://ext.plesk.com. And please keep in mind that these are very new features that will be expanded over the next few months.
One of my clients wanted to run a web application that required MySQL 5.5 instead of the default MySQL 5.1 that ships with Plesk at the time of writing. He needed it due to the better handling of UTF8 characters.
I struggled to find clear instructions on how to do this – so here they are 😉
In CentOS 5 you can switch to MySQL 5.5 under Tools and Settings – Updates and Upgrades. The installer shows something like this:
Simply switch to MySQL 5.5 (packaged by Parallels) and hit install.
Sadly the above convenience doesn’t exist in CentOS 6, so we’ll have to make use of the excellent Atomic repository again. In the past I’ve experienced instabilities in the way Plesk may react to non-standard repo packages – but it appears this is no longer an issue (or so I was told). Suffice to say proceed at your own risk and test, test and test again before using this in a production environment.
Install access to the Atomic repo with this command:
wget-q-O-http://www.atomicorp.com/installers/atomic | sh
You’ll have to agree to some terms and conditions, after which you can simply use yum update to include some additional functionality that is not provided by CentOS or Parallels. Doing so will automatically update both MySQL and PHP for you.
Restart the server when you’re finished for good measure.
If you have MAMP installed and working on your Mac, it’s easy to get started with ZEND Framework development. I’ll show you how in this article.
Download the framework from here:
Choose the full version without ZEND Server (not necessary as we’re using MAMP). Unpack the download and put it somewhere safe. I’m adding mine to my Documents directory. I’ll also rename my folder to something like “ZendFramework” without the version number.
To access it from anywhere on our machine we’ll create an alias named “zf”. zf is a shell script provided by the framework that we’ll need throughout our development journey with ZEND. Let’s to this in a Terminal session:
Replace the path with your own. Notice the call to /bin/zf.sh which is the “real” shell script. Our alias has just made this universal and accessible without having to mess with our shell path.
Whether you’re running Plesk on a dedicated machine on your network or in a virtual environment, you’ll want to setup test domains and work with them as if they were live – just like it was running in a data centre. It’s not as easy as I thought, which is why I took some notes on how to do it.
In this example I’ve got a dedicated CentOS instance on my local network. This can be my trusty old NC10 netbook, or a virtual machine running on Parallels Desktop on your Mac (I’ve explained how to set this up here: https://wpguru.co.uk/2014/02/how-to-ssh-into-a-virtual-machine-in-parallels-desktop/).
Plesk is already installed and ready to rock – all I need is a way to gain web access and setup domains that need to resolve properly. Out of the box all I get is a blank screen when I access the Plesk GUI using https://188.8.131.52:8443 or http://184.108.40.206. Let’s fix this.
Preparing CentOS to accept web requests
Thanks to Ivan from Parallels and Jamie from Urtechs for this tip: All we need to do here is to switch off iptables. Those are on and will filter many requests that look fishy and should be left running on a production server. Since I’m on my local network without evildoers attached, let’s switch it off:
service iptables stop
chkconfig iptables off
The second line will make it stick on subsequent boots we can use. You can easily switch it back on with the same command.
Tweaking your Mac’s hosts file
By default your Mac will reach out to its default DNS server to resolve domains. That’s how it finds which IP to connect with so that it can display websites. Plesk in turn would receive such a request and return the relevant website data.
To override your own local server’s IP address we can tweak /etc/hosts and define anything we like. For our example, I’d like example.com resolve to my own IP address (say 220.127.116.11). Here’s how I’d do that in a local Terminal session:
This will request your Mac’s root password and show you a default configuration. Make sure you leave what you have in place and add the following lines to the bottom of this file:
# Host Database
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
Obviously replace 18.104.22.168 with the IP of your actual server. If you’re not familiar with vi: hit “a” to enter edit mode, hit “esc” to stop editing and enter “SHIFT Z Z” to save the file.
Now make your Mac reload this configuration with the following command:
Now when you try to visit http://example.com it will resolve to your local server and display the Plesk default page. Test this by pinging the domain in the terminal session – it should return your server’s IP. You can add as many of your own domains as you like to the bottom of this file, including other IP addresses for other servers on your network.
There’s a handy tool called Hostbuddy which makes editing and flushing the file a breeze – check it out:
Setup a domain in Plesk and enjoy
All that remains is to setup example.com as a domain in Plesk and install some content – as if it was a real server on the real internet. You can now test websites with the power of Plesk without having to buy real server resources.
If a domain exists in the real world (like example.com) your tweaked configuration will override this and display your server instead. However, if your server isn’t running, or the IP has changed then you’ll receive a blank page instead. Check with ifconfig what your IP address is and tweak /etc/hosts accordingly.
If you only see the Plesk default page make sure your subscription is setup to point at the correct IP address.
Make sure that your URL is correct: since NGINX automatic redirects are no longer working. You must specify exactly what you’d like to access (such as “http://test.test” rather than “test.test”)
When you deploy Plesk to various instances on your local network you can save the world (and yourself) from a lot of internet traffic by creating a local mirror.
This is a duplicate of the original installer files needed to deploy Plesk which are downloaded once and can then be used from a machine on your network – which makes the installation much faster. This used to be a bit of a pain, but thanks to a new knowledge base article – and Ivan Butorin for telling me about this – it’s become so much easier to do.
In this example I’ll set the mirror up on my NC10 netbook running CentOS 6.5.
I was pulling my hair out the other day trying to connect to a VM in Parallels Desktop. It’s fairly straightforward, yet rather complex at the same time. Here’s how to do it step by step.
In this example I’m running Parallels Desktop 8 under Mac OS X 10.9 Mavericks, and my Guest OS CentOS 6.5.
Configuring your VM
Before starting the VM, start Parallels Desktop and head over to
You’ll get to a screen like this:
Make sure the tick box is “Connected”. Under Type you get a drop-down menu with three options:
Shared Network: gives your VM access to your internet/network connection, much like a “split”
Bridged Network (with several options): creates a new IP address for your VM and attaches it to whichever device you choose. Stick to the “Default Adapter” here unless you know what you’re doing. This will let other devices on your network connect to the VM.
Host-Only Network: also creates a new IP address for your VM, but only lets your Mac connect to the instance. Other devices on the network won’t be able to connect (more secure).
Pick Bridged (Default Adapter) or Host-Only, then start your VM.
There is a lot of help available for Plesk which comes to you straight from the developers. A few years ago all we had was the Parallels Forums – that’s changed dramatically and if anything will only increase in the future.
Here’s a list of sources I know to check for free support and updates on the latest Plesk developments:
I’ve just snazzed up the blockquotes styling on a couple of my P2 sites and thought I’d share the code that did it. Here’s an example of the final result in P2:
This is a block quote. You can create one by adding blockquote tags to the beginning and end of a block of text you’d like to look a little different. It doesn’t always have to be a quote, just something you’d like to give a little emphasis to.
This is a little plain in the original P2 and I thought it deserved a bit of styling. Here’s what creates the above:
The first line creates the background colour for the block. Any f/e variations work well as they give only a slight highlight. Try the following:
#eee for grey
#eef for yellow
#ffe for blue
you get the picture…
Next we add a bit of breathing space all around the block of text by adding some padding, and we’ll increase the font size to something more readable.
The border-style property adds the dotted outline to the blocks. Feel free to remove it if that’s too much emphasis, or try any of the following values as variations:
And finally we’ll add some rounded corners to those blocks with the last three lines (courtesy of that marvellous http://border-radius.com generator)
Fell free to experiment with those values, and let me know if you find anything else that may look interesting. Add the above code to your child theme’s style.css file, or add it to a custom CSS field in your WordPress installation.
Note that the effect of this styling will only be visible upon a browser refresh, as this is overriding styles provided by P2. So when you write a post, you’ll see the old (plain) version being inserted. Visitors will see the new styling right away.