Saturday 27 April 2013

Cannot Set SmarterMail as Default MailServer in Plesk

Some times when you try to integrate latest versions SmarterMail in your plesk. You will get the error :

Error: Set default component failed: defpackagemng failed: Loaded Postoffice Configuration Provider (MEAIPO.DLL)
Unable to assign port to IP address.
Reason:
Unknown IP Address: 169.254.16.152


Kindly follow the below given steps to solve this issue :

1. Go to Regedit.

2. Go to the path : 
     Local_Machhine >> Software >> Wow6432Node >> Plesk >> Psa config >> config 

3.  Locate the record MAIL_PROVIDERW_DLL 
and change it to :
C:\Program Files (x86)\Parallels\Plesk\admin\bin\smartermailprovider.dll

4. Next, locate the path : 

Local_Machhine >> Software >> Wow6432Node >> Plesk >> Psa config >> config >> Packages >> Mailserver and set Default regisrty entry to smartermail

5. Save the registry. No need to reboot.

6. Open Plesk using admin login, go to  Tool and setting >> Server components >> and click on refresh.

Now you will see SmarterMail as default mail server in plesk server components :)
Enjoy!!!

Wednesday 24 April 2013

HOW TO: FIX ERROR - The microsoft.ace.oledb.12.0 provider is not registered on the local machine


Basically, if you're on a 64-bit machine, IIS 7 is not (by default) serving 32-bit apps, which the database engine operates on. So here is exactly what you do:

1) ensure that the 2007 database engine is installed, this can be downloaded at: http://www.microsoft.com/en-us/download/details.aspx?id=23734

2) open IIS7 manager, and open the Application Pools area. On the right sidebar, you will see an option that says "Set application pool defaults". Click it, and a window will pop up with the options.

3) the second field down, which says 'Enable 32-bit applications' is probably set to FALSE by default. Simply click where it says 'false' to change it to 'true'.

4) Restart your app pool (you can do this by hitting RECYCLE instead of STOP then START, which will also work).

5) Done, and your error message will go away.

Thursday 4 April 2013

How to configure IIS 7 to redirect non-www domain to www domain?

One of few legacy leftovers that was never dropped over the years is the common use of www domain prefix. It is not a problem per se for us humans, but SE bots have mind of their own. When traversing a non-www and a www version of a web site, apparently, google and other bots are treating them as two separate web entities, even if content is identical.

This causes confusion in SE databases and in a worst case a drop from the index.
To avoid this confusion, web site operators should redirect their non-www traffic to www version of the website, or redirect the www version to the non-www version of the site.

This should be done using 301 redirect, i.e. when request for http://example.com is made, the web server would return

HTTP/1.1 301 Moved Permanently
Location: http://www.example.com/


response with the location of the new site.


So how can I do this in IIS 7? Well, you have to edit web.config file, modify or add
the following section to its rewrite section.


<rewrite>
   <rules>
      <rule name="non www to www" enabled="true">
         <match url="(.*)" />
         <conditions>
            <add input="{HTTP_HOST}" negate="true" pattern="^www\.([.a-zA-Z0-9]+)$" />
         </conditions>
         <action type="Redirect" url="<a href="http://www.{HTTP_HOST}/{R:0"
>http://www.{HTTP_HOST}/{R:0</a>}" appendQueryString="true" redirectType="Permanent" />
      </rule>
   </rules>
</rewrite>
 
This should be your first rule.

The rewite section should be placed in system.webServer section.

Then just refresh your site and voila you have all trafic to http://example.com/* redirected to http://www.example.com/*

Wednesday 3 April 2013

How to Fix the Error Establishing a Database Connection in WordPress

In this article, we will show you how to fix the error establishing a database connection in WordPress by compiling a list of solutions all in one place.

Note: Before you make any database changes, make sure you have sufficient backups.  

You are getting this error because WordPress is unable to establish a database connection. Now the reason why WordPress is unable to establish a database connection can vary. It could be that your database login credentials are wrong or have been changed. It could be that your database server is unresponsive. It could be that your database has been corrupted. In my experience, majority of the times this error happens because of some sort of server error however there could be other factors as well. Lets take a look at how to go about troubleshooting this problem. 

First thing you should do is to make sure that you are getting the same error on both the front-end of the site, and the back-end of the site (wp-admin). If the error message is the same on both pages “Error establishing a database connection”, then proceed onto the next step. If you are getting a different error on the wp-admin for instance something like “One or more database tables are unavailable. The database may need to be repaired”, then you need to repair your database. 

You can do this by adding the following line in your wp-config.php file:


define('WP_ALLOW_REPAIR', true);

Once you have done that, you can see the settings by visiting this page:

http://www.yoursite.com/wp-admin/maint/repair.php

 
 
Remember, the user does not need to be logged in to access this functionality when this define is set. This is because its main intent is to repair a corrupted database, Users can often not login when the database is corrupt. So once you are done repairing and optimizing your database, make sure to remove this from your wp-config.php.
If this repair did not fix the problem, or you are having trouble running the repair then continue reading this article as you might find another solution to work.

Checking the WP-Config file

 

 wp-config.php is probably the single most important file in your entire WordPress installation. This is where you specify the details for WordPress to connect your database. If you changed your root password, or the database user password, then you will need to change this file as well. First thing you should always check is if everything in your wp-config.php file is the same.

  define('DB_NAME', 'database-name');


define('DB_USER', 'database-username');

define('DB_PASSWORD', 'database-password');

define('DB_HOST', 'localhost');
 Remember your DB_Host value might not always be localhost. Depending on the host, it will be different.

If everything in this file is correct (make sure you check for typos), then it is fair to say that there is something wrong on the server end. 


Check your Web Host (MySQL Server)

 

Often you will notice this Error establishing database connection when your site gets swarmed with a lot of traffic. Basically, your host server just cannot handle the load (specially when you are on shared hosting). Your site will get really slow and for some users even output the error. So the best thing you should do is get on the phone or livechat with your hosting provider and ask them if your MySQL server is responsive. 

For those users who want to test if MySQL server is running yourself, you can do a few things. Test other sites on the same server to see if they are having the issue. If they are also getting the same error, then most definitely there is something wrong with your MySQL server. If you do not have any other site on this same hosting account simply go to your cPanel and try to access phpMyAdmin and connect the database. If you can connect, then we need to verify if your database user has sufficient permission. Create a new file called testconnection.php and paste the following code in it:

 <?php

$link = mysql_connect('localhost', 'root', 'password');

if (!$link) {

die('Could not connect: ' . mysql_error());

}

echo 'Connected successfully';

mysql_close($link);

?>

Make sure to replace the username and password. If the connected successfully, then it means that your user has sufficient permission, and there is something else that is wrong. Go back to your wp-config file to make sure that everything there is correct (re-scan for typos).
If you cannot connect to the database by going to phpMyAdmin, then you know it is something with your server. It does not necessarily means that your MySQL server is down. It could mean that your user does not have sufficient permission. 

In one scenario, MySQL server was running. All other sites on the servers were working fine except for wordpress website. When we tried going to our phpMyAdmin, we ended up getting the error: 

#1045 – Access denied for user ‘foo’@'%’ (using password: YES)

if you get this access denied error in either connecting to your phpMyAdmin or through testconnection.php results, then you should contact your host right away to get them to fix it or just try to delete the mysql database username and recreate it.

How to Fix WordPress Posts Returning 404 Error

WordPress is a powerful CMS. Sometimes a slight tweak can make your website inaccessible. However, finding a solution for any WordPress problem is extremely easy. Common problem that most WordPress users face at some point is WordPress posts returning a 404 Error. In this article we will show you how to fix WordPress posts returning 404 error.

Usually in this scenario a user can access their WordPress admin area, their blog’s main page, but when accessing a single posts they get a 404 Not found error. First of all, don’t panic most of the time your posts are still there and completely safe. This usually happens if your .htaccess file got deleted or something went wrong with the rewrite rules. What you need to do is fix your permalinks settings.

Go to Settings » Permalinks, and simply click on Save Changes button. 


 This will update your permalinks settings and flush rewrite rules. In most cases this solution fixes the WordPress posts 404 error. However, if it does not work for you, then you probably need to update your .htaccess file manually.

Login to your server using FTP, and modify the .htaccess file which is located in the same location where folders like /wp-content/ and /wp-includes/ are located. The easiest thing you can do is to temporarily make the file writeable by changing the permissions to 666. Then repeat the original solution. Don’t forget to change the permissions back to 660. You can also manually add this code in your .htaccess file:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
 

We hope this article helped you resolve posts returning 404 error in WordPress.

How to Grant Remote Access to a MySQL Database

So you’ve just created a user in MySQL, but the user cannot log in, even when using the correct password. What’s the problem?
Generally MySQL users can access the server from the server itself, or from the same network subnet. Remote access to MySQL (through the Internet, or from another private network) must be granted as through a special process.


Granting Remote Access to MySQL:
The database administrator grants permission for the user to access the server from all of the remote locations where the user is authorized.

A detailed discussion of remote access is found in the MySQL 5.1 Reference Manual, however, some simplified steps are here:


1. Log in to MySQL as an administrator. This must be done by command line. Enter the following command from a shell prompt:


mysql -u admin –p

Enter the admin password when prompted.

2. From the MySQL prompt, grant the user access to a specific database schema. The general format of the command to use is:

GRANT ALL PRIVILEGES ON database.* to ‘user’@'yourremotehost' IDENTIFIED BY 'newpassword';

Where:

‘user’ is the user name of an existing MySQL account. The username is enclosed in single quotes, as shown.

database is the name of the database schema where access will be granted. Either the name of the schema can be used, or an asterisk (*) can be used to specify all databases.

‘yourremotehost’ contains either an IP address where the user will access from, or a domain name. The IP address or host name must appear in single quotes, as shown.

‘newpassword’ contains the password the user must use to access the server. The password must appear in single quotes as well.


3. To force the changes to take effect immediately, enter the following command:

FLUSH PRIVILEGES;

Specific Examples:

Example A: Granting access for the user jsmith from an IP address:
GRANT ALL PRIVILEGES ON mydatabase.* to jsmith@'69.234.27.102' IDENTIFIED BY 'jimspassword';

Example B: Granting access from a domain:
GRANT ALL PRIVILEGES ON mydatabase.* to jsmith@'%.mycompany.com' IDENTIFIED BY 'jimspassword';

Example C: Granting access to all schemas:
GRANT ALL PRIVILEGES ON *.* to jsmith@'69.234.27.102' IDENTIFIED BY 'jimspassword';

Example D: Granting access from a specific host name on a domain:
GRANT ALL PRIVILEGES ON *.* to jsmith@'jimspc.mycompany.com' IDENTIFIED BY 'jimspassword';

Monday 1 April 2013

How to add a new Theme to WordPress installation

To add a new Theme to your WordPress installation, follow these basic steps:

1. Download the Theme archive and extract the files it contains. You may need to preserve the directory structure in the archive when extracting these files. Follow the guidelines provided by your Theme author.


2. Using an FTP client to access your host web server, create a directory to save your Theme in the wp-content/themes directory provided by WordPress. For example, a Theme named Test should be in wp-content/themes/test. Your Theme may provide this directory as part of the archive.


3. Upload the Theme files to the new directory on your host server.


4. Follow the instructions below for selecting the new Theme.

Adding New Themes by using cPanel

If your host offers the cPanel control panel, and the Theme files are in a .zip or .gz archive follow these instructions. Note: This assumes the Theme you download is a compressed (zip) file and the files in the zip file are in their 'named' folder.

1. Download the Theme zip file to your local machine.


2. In cPanel File Manager, navigate to your Themes folder. If you have WordPress installed in it's own folder called wordpress, you would navigate to "public_html/wordpress/wp-content/themes" and if WordPress is installed in your web-root folder you would navigate to "public_html/wp-content/themes".


3. Once you've navigated to the Themes folder in cPanel File Manager, click on Upload file(s) and upload that zip file you saved in Step 1.


4. Once the zip file is uploaded, click on the zip file name in cPanel, then in the panel to the right, click on Extract File Contents, and that zip file will be uncompressed.


5. Follow the instructions below for selecting the new Theme.

Adding New Themes using the Administration Panel

You can download Themes directly to your blog by using the Add New Themes option in the Appearance sub-menu.

1. Log in to the WordPress Administration Panel.
2. Select the Appearance panel, then Themes.
3. Select Install Themes
4. Use the sub-menu or the Search or Filter options to locate a Theme you would like to use.
5. Click on the Preview link to preview the Theme or the Install link to upload the Theme to your blog.
6. Use the Upload link in the top sub-menu to upload a zipped copy of a Theme that you have previously downloaded to your machine.

Selecting the Active Theme

To select a Theme for your site:

1. Log in to the WordPress Administration Panel.
2. Select the Appearance panel, then Themes.
3. From the Available Themes section, click on the Theme title (or Theme screenshot) for the Theme you wish to activate.
4. A preview of the Theme will be shown.
5. To activate the Theme click the Activate "Theme Name" link in the top right.

Your selection should immediately become active.

Note: If the Theme preview is blank, do not activate the new Theme without investigating further. Your site may not be displayed correctly, otherwise.

Block IP from accessing website using .htaccess

Block IP from accessing website using .htaccess

To block certain ip address from accessing your website, just create a file with name .htaccess at your root directory with the content below:-

order allow,deny
deny from 192.168.0.1
allow from all

If you want to block multiple ip address using .htaccess simply add one ip address per line as below:-

order allow,deny
deny from 192.168.0.2
deny from 192.168.0.3
deny from 192.168.0.4
allow from all

You can even block a network range ip using .htaccess:-

order allow,deny
deny from 129.0.0
allow from all

Note: .htaccess only works in apache webserver, if you do not know what web server you are on, your can consult with your server administrator for more details.

Sending mail using telnet

The first thing to do is to open a connection from your computer to your mail server.

telnet mail.domain.ext 25

You will then need to declare where you are sending the email from:

HELO local.domain.name

Now give your email address:

MAIL FROM: mail@domain.ext

Now give the recipients address:

RCPT TO: mail@otherdomain.ext

To start composing the message issue the command DATA

If you want a subject for your email type Subjectype subject here- then press enter twice

You may now proceed to type the body of your message (e.g. hello mail@otherdomain.ext from mail@domain.ext)

To tell the mail server that you have completed the message enter a single "." on a line on it's own.

You can close the connection by issuing the QUIT command.

Unable to connect to pipe \\.\pipe\PSA_pipe

1. Identify which database provider is used to store Parallels Plesk Panel by looking up the value of the HKLM\SOFTWARE\Wow6432Node\Plesk\PSA Config\Config\PLESK_DATABASE_PROVIDER_NAME hive in the system registry:

2. Identify the status of the corresponding service:
C:\>sc query PleskSQLServer

SERVICE_NAME: PleskSQLServer
        TYPE               : 10  WIN32_OWN_PROCESS
        STATE              : 1  STOPPED
        WIN32_EXIT_CODE    : 0  (0x0)
        SERVICE_EXIT_CODE  : 0  (0x0)
        CHECKPOINT         : 0x0
        WAIT_HINT          : 0x0


3. Start it up:
sc start PleskSQLServer

ASP.NET Ajax client-side framework failed to load And\Or 'Sys' is undefined

There may be various reason behind this issue. Below are the couple of solutions which is worth trying :

Solution 1: A quick solution is to update your web.config and add following section

<handlers>
    <remove name="WebServiceHandlerFactory-Integrated"/>
    <remove name="ScriptHandlerFactory"/>
    <remove name="ScriptHandlerFactoryAppServices"/>
    <remove name="ScriptResource"/>
    <add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" 
 type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions,
 Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
    <add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd"  
preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory,
System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
    <add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD"  
path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, 
System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
</handlers>
 
Solution 2: Add the below code in <httpHandlers>
 
<add verb="GET"
  path="ScriptResource.axd"
  type="Microsoft.Web.Handlers.ScriptResourceHandler"
  validate="false"/>
 
Solution 3 : If you don't have this, add this too under <assemblies>
 
<add assembly="Microsoft.Web.Extensions, Version=1.0.61025.0, Culture=neutral,
 PublicKeyToken=31bf3856ad364e35"/>
 
Solution 4 : f that doesn't work too, try deleting files from your "bin" folder
 and rebuild the solution and clear the cache of your browser.
 
Solution 5 : Add this to your web.config
 
<location path="ScriptResource.axd">
   <system.web>
      <authorization>
         <allow users="*"/>
      </authorization>
   </system.web>
</location>
 
Solution 6 : Repair .Net 3.5 SP1 installation from Control Panel - Add/Remove Programs,
as it may be possible an update to 3.5 SP1 can stop web-server delivering Ajax.
 
Final Solution 7 : this could be a caching/compression issue and by putting in the 
following into Web.Config, may resolves the issue. 
 
  <system.web.extensions>
    <scripting>
      <scriptResourceHandler enableCaching="false" enableCompression="false" />
    </scripting>
  </system.web.extensions>