Updates from February, 2014 Toggle Comment Threads | Keyboard Shortcuts

  • Jay Versluis 5:54 pm on February 21, 2014 Permalink | Reply
    Tags: ,   

    Categories: PHP ( 28 )   

    Getting Started with ZEND Server 6 on Mac OS X 

    ZEND_logo

    I’ve just installed ZEND Server 6.3 on my MacBook running Mavericks 10.9.1. Needless to say I’m sill a little shaken up from the huge amount of brain pain this adventure has caused.

    Because once downloaded and installed on your system, you may ask yourself a vital question: Now What?

    Let’s find out. This article is Work in Progress – bear with me while I flesh it out.

    The Basics

    ZEND Server on Mac is located here:

    • /usr/local/zend/

    Your web files live here:

    • /usr/local/zend/apache2/htdocs

    To open this directory in Finder you can navigate there with a Terminal session and open it, like so:

    cd /usr/local/zend/apache2/htdocs
    open .

    Now you can create a shortcut on your sidebar for easy access.

    To access the ZEND Server Admin interface, navigate to the following URL in your browser:

    If you’re done with it, you can uninstall ZEND Server with the following command:

    sudo /usr/local/zend/bin/uninstall.sh

    (More …)





     
    • Yonni 10:28 am on February 26, 2014 Permalink | Reply

      Mysql access – you can deploy phpmyadmin from within the Zend Server UI’s Guide Page. After launching Zend Server, this is the first page that opens up and is the homepage for Zend Server’s UI.

      Right at the top, in Getting Started you have a scrolling gallery of applications, one of which is phpmyadmin.

      Deploy, configure, rejoice

      • Jay Versluis 9:17 am on February 27, 2014 Permalink | Reply

        Hi Yonni,

        Thank you so much for the tip – how could I have missed that 🙂 I hadn’t spotted there was a second page for applications!

        My first attempt to deploy phpMyAdmin manually didn’t work, but auto deploy via ZEND Server was indeed a breeze. Thanks for sharing!

  • Jay Versluis 12:32 pm on February 20, 2014 Permalink | Reply
    Tags: , shell   

    Categories: Bookmarks ( 18 )   

    Crash Course in BASH Script Programming (a classic):





     
  • Jay Versluis 5:51 pm on February 17, 2014 Permalink | Reply
    Tags: extensions   

    Categories: Plesk ( 75 )   

    How to create an Extension in Plesk 

    Extensions are to Plesk what Plugins are to WordPress. They allow developers to add functionality to the Plesk Panel via PHP, make CSS and JavaScript tweaks and allow a very fine grained amount of customisations.

    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):

    Screen Shot 2014-02-17 at 16.39.27

    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:

    extension --create myextension
    
    The extension was successfully created.
    The path to extension's entry points: /usr/local/psa/admin/htdocs/modules/myextension/
    The path to PHP classes: /usr/local/psa/admin/plib/modules/myextension/
    The path to installation scripts:  /usr/local/psa/admin/plib/modules/ext1/myextension/
    The path to the directory with run-time data: /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

    extension --register myextension

    Once registered your Extension will show up in Plesk:

    Screen Shot 2014-02-17 at 09.07.21

    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:

    • /usr/local/psa/admin/plib/modules/myextension/meta.xml

    To change any of the settings and add some behaviour to your extension refer to the handy documentation guide:

    Packaging an extension

    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:

    extension --pack myextension --destination /your/folder/here

    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:

    Sometimes you just don't want to see another Parallels advert...

    Sometimes you just don’t want to see another Parallels advert…

    With a quick inspection we can see the CSS class applied to the entire blue box. To suppress its output we can do this:

    @charset "UTF-8";
    /* CSS Document */
    
    .p-box.home-promo-block {
     display:none;
    }

    To add our own “child style sheet” we need to create a file called global.css in this directory:

    • /usr/local/psa/admin/htdocs/modules/myextension/

    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.

    Screen Shot 2014-02-17 at 17.41.55

    Box be gone. Zen at large.

    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.

    Screen Shot 2014-02-17 at 17.44.19





     
  • Jay Versluis 2:36 pm on February 16, 2014 Permalink | Reply
    Tags: , ,   

    Categories: Plesk ( 75 )   

    How to upgrade to MySQL 5.5 and PHP 5.4 in Plesk 11.5 (CentOS) 

    Plesk-LogoOne 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 😉

    CentOS 5.x

    In CentOS 5 you can switch to MySQL 5.5 under Tools and Settings – Updates and Upgrades. The installer shows something like this:

    Screen Shot 2014-02-16 at 11.46.19

    Simply switch to MySQL 5.5 (packaged by Parallels) and hit install.

    CentOS 6.x

    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.

    Check out the full article





     
    • Mihai 3:53 pm on February 25, 2016 Permalink | Reply

      Not worked here dunno why … other commands for centos 6 ? best regards

    • wblondel 9:07 pm on March 12, 2016 Permalink | Reply

      Thanks a lot for this guide ! It worked on CentOS 6.7 🙂

    • Gerard Dy 12:13 am on November 25, 2016 Permalink | Reply

      Hi Jay,

      If I want to upgrade to PHP 5.4+ only is that possible on CentOS 5.6 and Plesk 11.5.30? Do you have tutorials for that? Thanks.

      • Jay Versluis 7:55 am on November 25, 2016 Permalink | Reply

        Hi Gerard, yes it should be. It’s been a while since I’ve used CentOS 5 with Plesk 11.5, but from what I remember it’s as simple as installing the Atomic repo as described above, then issue “yum update php” and hopefully see a new version appear. Good luck!

  • Jay Versluis 6:35 pm on February 15, 2014 Permalink | Reply
    Tags: , ,   

    Categories: PHP ( 28 )   

    How to install ZEND Framework for use with MAMP 

    ZEND_logoIf 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:

    alias zf="/Users/you/Documents/ZendFramework/bin/zf.sh'

    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.

    Verify that it’s working with this:

    zf show version
    
    Zend Framework Version: 1.12.3

    Read the full article





     
  • Jay Versluis 10:24 pm on February 14, 2014 Permalink | Reply
    Tags: , , , ParallelsCloud   

    Categories: Plesk ( 75 )   

    How to run Plesk on your local network and access virtual domains on your Mac 

    Plesk-LogoWhether 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://11.22.33.44:8443 or http://11.22.33.44. 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 11.22.33.44). Here’s how I’d do that in a local Terminal session:

    sudo vi /etc/hosts
    

    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.
    ##
    127.0.0.1       localhost
    255.255.255.255 broadcasthost
    ::1             localhost
    fe80::1%lo0     localhost
    
    11.22.33.44       example.com
    11.22.33.44       anotherdomain.com
    

    Obviously replace 11.22.33.44 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:

    dscacheutil -flushcache
    

    Thanks to Manski for this tip – read his detailed article here.

    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.

    Troubleshooting

    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”)

    Have fun 😉





     
  • Jay Versluis 10:12 pm on February 13, 2014 Permalink | Reply
    Tags:   

    Categories: Plesk ( 75 )   

    How to create a Plesk Mirror 

    Plesk-Logo

    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.

    Let’s do this thing!





     
  • Jay Versluis 5:40 pm on February 12, 2014 Permalink | Reply
    Tags: ,   

    Categories: Linux ( 100 ), Screencast ( 87 )   

    How to SSH into a Virtual Machine in Parallels Desktop 

    Parallels-DesktopI 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

    • Virtual Machine
    • Configure
    • Hardware
    • Network

    You’ll get to a screen like this:

    Screen Shot 2014-02-12 at 17.21.16

    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.

    Read the full article





     
  • Jay Versluis 8:20 am on February 9, 2014 Permalink | Reply  
    Categories: Plesk ( 75 )   

    List of Plesk Resources 

    Plesk-LogoThere 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:

    Plesk in Social Media Networks:

    There’s also professional paid support available from Parallels here:

    Know any others? Add them in a comment below.





     
  • Jay Versluis 9:11 am on February 8, 2014 Permalink | Reply
    Tags: ,   

    Categories: Themes ( 28 )   

    How to style block quotes in P2 

    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:

    blockquote {
    	background: #fef;
    	padding: 20px;
    	font-size: 1.1em;
            border-style:dashed;
    	border-radius: 10px;
    	-webkit-border-radius: 10px;
    	-moz-border-radius: 10px;
    }
    

    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:

    • groove
    • double
    • ridge
    • dashed
    • dotted
    • inset
    • outset
    • solid
    • thin

    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.





     
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