KMP http://www.net24.co.nz/kb/ en-us KnowlageBase RSS Generator How to perform a MySQL dump with PHP http://www.net24.co.nz/kb/article/AA-00241 Issue

Generally you would use phpMyAdmin within the Plesk Control Panel to perform a backup of your MySQL database ( Exporting and importing a MySQL database ) but sometimes this process can fail or time out if you have a reasonably large database. The work around for this is to use a simple PHP script to invoke a mysql dump command and place the resulting backup file into your private directory within your FTP area for download.

Solution

Create the following PHP file either directly from the Plesk File Manager or on your local computer and then upload it to the httpdocs directory. You could call it mysqldump.php

Copy the following line into your PHP file:

<?php 
set_time_limit(600);
system("mysqldump -h localhost -u YOURUSERNAME -pYOURPASSWORD YOURDATABSENAME > /usr/local/www/vhosts/YOURDOMAIN.CO.NZ/private/BACKUPFILENAME.sql");
?>

Replace YOURUSERNAME with your database username, YOURPASSWORD with your database password (note that you do NOT put a space between -p and YOURPASSWORD) and YOURDATABASENAME with your database name and specify a custom backup filename if you wish.

Now run the command by visiting the mysqldump.php URL in your browser. e.g. http://www.domain.co.nz/mysqldump.php - Be aware that it may take a moment to backup the database, so please ensure you only visit the URL once and allow it to complete. 

You should now have the resulting backup file ready for download via FTP in your private directory. Note that any files within your private directory contribute to  your overall disk quota so remember to remove the file once you have downloaded the backup. Best practice would be to also delete the mysqldump.php file from your hosting account because it contains your database login credentials and also to avoid any accidental execution in future.

]]>
Thu, 16 Dec 2010 23:08:27 +1300
Error "530 Valid Hostname is expected" using FTP to IIS7 http://www.net24.co.nz/kb/article/AA-00201 Issue

When connecting to IIS7 using FTP you get the following error.

530 Valid Hostname is expected

Reason

When you set up name-based FTP services IIS7 wants the sitename defined with the username so that IIS7 can associate the username with the site they wish to log in to.

Solution A

If you want more than one FTP site on your VPS you will need to :

Configure all FTP clients such that :
Host: Mysite.com
User: Mysite.com|Username

Note the "|" that seperates the Sitename and the Username.

Solution B

If you only have one FTP site remove the "Host Name" defined in the "Bindings" property of the FTP site.


]]>
Tue, 03 Aug 2010 04:22:43 +1200
How to rebuild Geom mirror in FreeBSD http://www.net24.co.nz/kb/article/AA-00102 This article discusses how to rebuild a Geom mirror after a faulty drive has been replaced.

Root Privileges Required

All commands listed in this article need to be executed with root privileges.

Step 1 - Identify Replaced Drive

  1. Log in to your server and as root run the following command:
    # gmirror list
  2. This will produce output similar to the following
    Geom name: gm0
    State: DEGRADED
    Components: 2
    Balance: round-robin
    Slice: 4096
    Flags: NONE
    GenID: 0
    SyncID: 3
    ID: 3594034660
    Providers:
    1. Name: mirror/gm0
       Mediasize: 159999999488 (149G)
       Sectorsize: 512
       Mode: r2w2e5
    Consumers:
    1. Name: ad4
       Mediasize: 160000000000 (149G)
       Sectorsize: 512
       Mode: r1w1e1
       State: ACTIVE
       Priority: 0
       Flags: DIRTY
       GenID: 0
       SyncID: 3
       ID: 4064102945

    In this example we can see the status of the mirror is degraded and the only active drive is 'ad4'.

  3. To find out which drives are available and the corresponding device name run the atacontrol list command.
    # atacontrol list

    This will produce a list of drives with device names which are connected to your server.

    ATA channel 2:
        Master:  ad4 <WDC WD1602ABKS-18N8A0/02.03B04> SATA revision 2.x
        Slave:       no device present
    ATA channel 3:
        Master:  ad6 <WDC WD2502ABYS-02B7A0/02.03B03> SATA revision 2.x
        Slave:       no device present

    From this we can see that device '*ad6*' is the device name of the new drive we can use to rebuild the mirror. You should already be aware of the device name from alerts generated by your server when the drive failed; the replacement drive will show up with the same device name.

Step 2 - Rebuild Mirror

  1. Now that we have verified device name of the new drive we can easily rebuild the array using the following commands:
    # gmirror forget gm0
    # gmirror insert gm0 <device>

    Where <device> is the device name of the new drive we determined above. In the example above <device> would be 'ad6'.

  2. To verify the drive has been added to the mirror and the mirror is being rebuild run the '*gmirror list'* command.
    # gmirror list
    Geom name: gm0
    State: DEGRADED
    Components: 2
    Balance: round-robin
    Slice: 4096
    Flags: NONE
    GenID: 0
    SyncID: 3
    ID: 3594034660
    Providers:
    1. Name: mirror/gm0
       Mediasize: 159999999488 (149G)
       Sectorsize: 512
       Mode: r3w2e5
    Consumers:
    1. Name: ad4
       Mediasize: 160000000000 (149G)
       Sectorsize: 512
       Mode: r1w1e1
       State: ACTIVE
       Priority: 0
       Flags: NONE
       GenID: 0
       SyncID: 3
       ID: 4064102945
    2. Name: ad6
       Mediasize: 251059544064 (234G)
       Sectorsize: 512
       Mode: r1w1e1
       State: SYNCHRONIZING
       Priority: 0
       Flags: DIRTY, SYNCHRONIZING
       GenID: 0
       SyncID: 3
       Synchronized: 3%
       ID: 2247886846

    We can see here the new drive has been added and the mirror is being rebuilt (3% complete). Rebuild times can take anywhere from 20 minutes to a few hours depending on the size of the drives and the amount of application I/O on your system.

    The first few lines show that overall state of the mirror, once the state changes from 'DEGRADED' to 'COMPLETE' the rebuild is complete.

]]>
Fri, 30 Jul 2010 01:45:38 +1200
Unable to login to RDP - certificate error http://www.net24.co.nz/kb/article/AA-00346

Issue

RDP into Windows VPS fails with the following error:
 

Remote Desktop cannot connect to the remote computer because the authentication certificate received from the remote computer is expired or invalid.
In some cases, this error might also be caused by large time discrepancy between the client and server computers.


Solution

One of the certificates installed inside the VPS is likely to be expired, preventing the connection.

It is necessary to delete the expired certificate using the command line.

1. Get a list of certificates from Remote Desktop store with this command:

C:\Windows\system32> certutil -store "Remote Desktop" | findstr "Serial Before After"

It will output something like this, look for the certificate with the NotAfter date which has passed:

certutil -store | findstr "Serial Before After"
Serial Number: 06376c00aa00648a11cfb8d4aa5c35f4
 NotBefore: 5/29/1996 4:02 AM
 NotAfter: 1/1/2040 5:59 AM
Serial Number: 46fcebbab4d02f0f926098233f93078f
 NotBefore: 4/17/1997 6:00 AM
 NotAfter: 10/25/2016 5:59 AM
Serial Number: 1e02240d
 NotBefore: 12/14/2001 8:03 AM
 NotAfter: 12/14/2002 8:03 AM
Serial Number: 198b11d13f9a8ffe69a0
 NotBefore: 10/1/1997 1:00 PM
 NotAfter: 12/31/2002 1:00 PM

2. Delete the expired certificate with this command (replacing the bold serial number with your own of course):

C:\Windows\system32> certutil -delstore "Remote Desktop" 198b11d13f9a8ffe69a0

It will output something like this:

certutil -delstore Remote Desktop 198b11d13f9a8ffe69a0
Remote Desktop
Deleting Certificate 3
CertUtil: -delstore command completed successfully.

The next time you connect via RDP a new self signed certificate should be created allowing you to login.


Article from:
http://kb.parallels.com/en/112975




]]>
Wed, 14 Dec 2011 00:10:23 +1300
Plesk Panel Documentation http://www.net24.co.nz/kb/article/AA-00313 Parallels offers helpful documentation for Users and Administrators of Plesk Panel 10 at their website.

Parallels Plesk Panel 10 Documentation

]]>
Wed, 03 Aug 2011 23:31:38 +1200
Plesk Panel Video Tutorials http://www.net24.co.nz/kb/article/AA-00312 Parallels have a collection of video tutorials available on their website to help you with basic tasks such as adding web sites, creating databases, adding email address and more.

Parallels Plesk Panel Video Tutorials

]]>
Wed, 03 Aug 2011 23:28:14 +1200
Using a robots.txt file to prevent search engines from spidering dynamic variables and pages http://www.net24.co.nz/kb/article/AA-00289 Issue

By default, when a search engine spider visits your web site it follows all variable links, queries, search boxes and dynamic pages on your web site This can end up in an endless loop causing excessive load on your web site and generating high traffic.

Solution

The problem can be solved by uploading a robots.txt file to your web site which will prevent the search engines from following any URLs that begin with /? (these are the common dynamic page references).

Insert this text into your robots.txt file:

User-agent: *
Allow: /*?$
Disallow: /*?



]]>
Wed, 29 Jun 2011 02:43:09 +1200
Upgrading to Ironstor software from older legacy OBS software http://www.net24.co.nz/kb/article/AA-00255 If you already have the legacy OBS Online Backup Manager software installed on your computer and you wish to upgrade to the new Ironstor system then you will need to follow the steps below to uninstall the old software and settings before installing the new Ironstor Cloud Backup Manager.

Windows

1. Install the new Ironstor CBM
2. Next uninstall the new version to remove all legacy settings: 

    Open [Start] -> [Control Panel] -> [Add/Remove Programs]
    Select [Ironstor Cloud Backup Manager] from the list and press the [Remove] button

3. Repeat the installation of Ironstor CBM

MacOS

1. Remove all program files by opening a terminal session and typing the following commands. (You can open Terminal by typing 'Terminal' into Spotlight)

# cd $OBM_HOME/bin # sudo ./uninstall.sh

2. Remove all backup setting by removing ~/.obm

# rm –rf ~/.obm

3. Restart your computer

4. Install the new Ironstore CBM

]]>
Fri, 18 Feb 2011 02:55:21 +1300
CentOS: Install Yum http://www.net24.co.nz/kb/article/AA-00253

Issue

Yum is not installed..


Cause

Parallels do not include it in the default packages for a CentOS container/VPS.


Solution

**NOTE** Content inside the grey boxes in the following sections can be copied and pasted to your command line.

1. Login to your container/VPS via ssh as the root user.

2. Determine which version of CentOS you are running.

cat /etc/redhat-release


The output will be either:

CentOS release 6.2 (Final)

or:

CentOS release 5.7 (Final)

or:

CentOS release 5.6 (Final)

or:

CentOS release 5.5 (Final)


3. Paste the commands for your CentOS version to your command line.

CentOS 6.2:

rpm -Uvh --nodeps http://mirror.ihug.co.nz/centos/6/os/$(uname -i)/Packages/yum-metadata-parser-1.1.2-16.el6.$(uname -i).rpm http://mirror.ihug.co.nz/centos/6/os/$(uname -i)/Packages/yum-plugin-fastestmirror-1.1.30-10.el6.noarch.rpm

rpm -Uvh http://mirror.ihug.co.nz/centos/6/os/$(uname -i)/Packages/gpgme-1.1.8-3.el6.$(uname -i).rpm http://mirror.ihug.co.nz/centos/6/os/$(uname -i)/Packages/pygpgme-0.1-18.20090824bzr68.el6.$(uname -i).rpm http://mirror.ihug.co.nz/centos/6/os/$(uname -i)/Packages/python-iniparse-0.3.1-2.1.el6.noarch.rpm http://mirror.ihug.co.nz/centos/6/os/$(uname -i)/Packages/python-urlgrabber-3.9.1-8.el6.noarch.rpm http://mirror.ihug.co.nz/centos/6/os/$(uname -i)/Packages/python-pycurl-7.19.0-8.el6.$(uname -i).rpm http://mirror.ihug.co.nz/centos/6/os/$(uname -i)/Packages/rpm-python-4.8.0-19.el6.$(uname -i).rpm http://mirror.ihug.co.nz/centos/6/os/$(uname -i)/Packages/yum-3.2.29-22.el6.centos.noarch.rpm

CentOS 5.7:

rpm -Uvh --nodeps http://mirror.ihug.co.nz/centos/5.7/os/$(uname -i)/CentOS/yum-fastestmirror-1.1.16-16.el5.centos.noarch.rpm http://mirror.ihug.co.nz/centos/5.7/os/$(uname -i)/CentOS/yum-metadata-parser-1.1.2-3.el5.centos.$(uname -i).rpm

rpm -Uvh http://mirror.ihug.co.nz/centos/5.7/os/$(uname -i)/CentOS/libxml2-2.6.26-2.1.12.$(uname -i).rpm http://mirror.ihug.co.nz/centos/5.7/os/$(uname -i)/CentOS/m2crypto-0.16-8.el5.$(uname -i).rpm http://mirror.ihug.co.nz/centos/5.7/os/$(uname -i)/CentOS/python-elementtree-1.2.6-5.$(uname -i).rpm http://mirror.ihug.co.nz/centos/5.7/os/$(uname -i)/CentOS/python-iniparse-0.2.3-4.el5.noarch.rpm http://mirror.ihug.co.nz/centos/5.7/os/$(uname -i)/CentOS/python-sqlite-1.1.7-1.2.1.$(uname -i).rpm http://mirror.ihug.co.nz/centos/5.7/os/$(uname -i)/CentOS/python-urlgrabber-3.1.0-6.el5.noarch.rpm http://mirror.ihug.co.nz/centos/5.7/updates/$(uname -i)/RPMS/rpm-python-4.4.2.3-22.el5_7.2.$(uname -i).rpm http://mirror.ihug.co.nz/centos/5.7/os/$(uname -i)/CentOS/yum-3.2.22-37.el5.centos.noarch.rpm

CentOS 5.6:

rpm -Uvh --nodeps http://vault.centos.org/5.6/os/$(uname -i)/CentOS/yum-fastestmirror-1.1.16-14.el5.centos.1.noarch.rpm http://vault.centos.org/5.6/os/$(uname -i)/CentOS/yum-metadata-parser-1.1.2-3.el5.centos.$(uname -i).rpm

rpm -Uvh http://vault.centos.org/5.6/os/$(uname -i)/CentOS/libxml2-2.6.26-2.1.2.8.el5_5.1.$(uname -i).rpm http://vault.centos.org/5.6/os/$(uname -i)/CentOS/python-elementtree-1.2.6-5.$(uname -i).rpm http://vault.centos.org/5.6/os/$(uname -i)/CentOS/python-iniparse-0.2.3-4.el5.noarch.rpm http://vault.centos.org/5.6/os/$(uname -i)/CentOS/python-sqlite-1.1.7-1.2.1.$(uname -i).rpm http://vault.centos.org/5.6/os/$(uname -i)/CentOS/rpm-python-4.4.2.3-22.el5.$(uname -i).rpm http://vault.centos.org/5.6/os/$(uname -i)/CentOS/m2crypto-0.16-6.el5.8.$(uname -i).rpm http://vault.centos.org/5.6/os/$(uname -i)/CentOS/python-urlgrabber-3.1.0-6.el5.noarch.rpm http://vault.centos.org/5.6/os/$(uname -i)/CentOS/yum-3.2.22-33.el5.centos.noarch.rpm

CentOS 5.5:

rpm -Uvh --nodeps http://vault.centos.org/5.5/os/$(uname -i)/CentOS/yum-fastestmirror-1.1.16-14.el5.centos.1.noarch.rpm http://vault.centos.org/5.5/os/$(uname -i)/CentOS/yum-metadata-parser-1.1.2-3.el5.centos.$(uname -i).rpm

rpm -Uvh http://vault.centos.org/5.5/updates/$(uname -i)/RPMS/libxml2-2.6.26-2.1.2.8.el5_5.1.$(uname -i).rpm http://vault.centos.org/5.5/os/$(uname -i)/CentOS/m2crypto-0.16-6.el5.6.$(uname -i).rpm http://vault.centos.org/5.5/os/$(uname -i)/CentOS/python-elementtree-1.2.6-5.$(uname -i).rpm http://vault.centos.org/5.5/os/$(uname -i)/CentOS/python-iniparse-0.2.3-4.el5.noarch.rpm http://vault.centos.org/5.5/os/$(uname -i)/CentOS/python-sqlite-1.1.7-1.2.1.$(uname -i).rpm http://vault.centos.org/5.5/os/$(uname -i)/CentOS/python-urlgrabber-3.1.0-5.el5.noarch.rpm http://vault.centos.org/5.5/updates/$(uname -i)/RPMS/rpm-python-4.4.2.3-20.el5_5.1.$(uname -i).rpm http://vault.centos.org/5.5/os/$(uname -i)/CentOS/yum-3.2.22-26.el5.centos.noarch.rpm
]]>
Tue, 21 Jun 2011 02:49:56 +1200
How to use CURL with PHP to get content from SSL-enabled sites http://www.net24.co.nz/kb/article/AA-00246 Issue

You wish to use CURL to get information from secure https:// sites but get validation errors. 

Cause

The CURL libraries no longer include a list of certificates to validate against.

As such, these need to be obtained and then referenced in your code.

An example is given below.

Resolution

Obtain CA Certificate bundle in PEM format from http://curl.haxx.se/ca/cacert.pem and save this to a location within the httpdocs directory structure.

Within your code reference this.

An example :

<?php
...

// Set the URL to visit
$url = "https:<somesite/page";

// In this example we are referring to a page that handles xml
$headers = array( "Content-Type: text/xml",);

// Initialise Curl
$curl = curl_init();
if ($curl === false)
{
    throw new Exception(' cURL init failed');
}

// Configure curl for website
curl_setopt($curl, CURLOPT_URL, "https://<somesite>");

// Set up to view correct page type
curl_setopt(#curl, CURLOPT_HTTPHEADER, &$headers);

// Turn on SSL certificate verfication

curl_setopt($curl, CURLOPT_CAPATH, "/usr/local/www/vhosts/<yourdomainname>/httpdocs/cacert.pem");
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 1);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, TRUE);

// Tell the curl instance to talk to the server using HTTP POST
curl_setopt($curl, CURLOPT_POST, 1);

// 1 second for a connection timeout with curl
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 5);

// Try using this instead of the php set_time_limit function call
curl_setopt($curl, CURLOPT_TIMEOUT, 60);

// Causes curl to return the result on success which should help us avoid using the writeback option
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);

$result = curl_exec($curl);

...
?>



]]>
Thu, 27 Jan 2011 21:57:00 +1300