Wednesday 5 March 2014

Replace old domain name or URL with new URL in WordPress

To replace the old domain name or the URL with the new URL in the wordpress blog site, refer the following steps :

Login to the cPanel >> go to phpMyAdmin >> Select the database you want to modify >> click on the SQL

Then type the following query to execute :
To update WordPress options with the new blog location, use the following SQL command:
UPDATE wp_options SET option_value = replace(option_value, 'http://www.old-domain.com', 'http://www.new-domain.com') WHERE option_name = 'home' OR option_name = 'siteurl';

After that to fix URLs of the WordPress posts and pages stored in database wp_posts table as guid field use the following SQL command:
UPDATE wp_posts SET guid = replace(guid, 'http://www.old-domain.com','http://www.new-domain.com');

Finally Use the following SQL commands to fix all internal links:

UPDATE wp_posts SET post_content = replace(post_content, 'http://www.old-domain.com', 'http://www.new-domain.com');

Tuesday 4 March 2014

Manually remove the cPanel account from the server

Inorder to manually remove the cPanel account from the server , please follow the below steps : 
(Note: For example consider the domain name as abc.com and username of the cPanel as abc)

  • rm /var/cpanel/users/abc
  • Remove the Virtual host entry for the domain abc.com from httpd.conf
    vi /etc/httpd/conf/httpd.conf remove the site VirtualHost entry
  • rm /var/named/[domain_name].db (If you used DNS Only cPanel, you may remove zone through WHM).
  • vi /etc/userdomains (remove only the abc.com: abc entry)
  • vi /etc/trueuserdomains (remove only the abc.com: abc entry)
  • vi /etc/trueuserowners ( remove only the abc: root entry)
  • vi /etc/named.conf ( remove the following entry:
                           zone "abc.c" {
                           type master;
                           file "/var/named/abc.com.db";
                             }; )
  • vi /etc/localdomains (remove only the abc.com: abc entry)
  • /etc/valiases (remove only the abc.com: abc entry)
Please login into the mysql and follow the steps
  • #mysql
  • mysql > use mysql;
  • mysql > drop user dbuser@localhost;
                     OR
          mysql> delete from mysql.user where user=dbuser;
  • vi /var/cpanel/databases/users.db ( remove only the entry of the domain )
  • rm /var/cpanel/databases/abc.cache
  • rm /var/cpanel/databases/abc.yaml
  • vi /etc/dbowners ( remove only the abc.com: abc entry)
This will manually remove the cPanel account from the server. 

Sunday 16 February 2014

Password Protect the Directory

To password protect the wp-admin page only and to avoid authentication pop-up window on the other website pages
Follow the following steps :
  • First password protect the directory using the "Password Protect Directories" in the cPanel.
  • After that add the following code in the htaccess of the domain.
                    <IfModule mod_rewrite.c>
                     RewriteEngine On
                     RewriteCond %{QUERY_STRING} !=""
                     RewriteCond %{QUERY_STRING} !^p=.*
                     RewriteCond %{QUERY_STRING} !^s=.*
                     RewriteCond %{REQUEST_URI} !^/wp-admin.*
                     RewriteRule ^(.*)$ /$1? [R=301,L]
                    </IfModule>

  • It will show the authnetication request only for the wp-admin page

Sunday 12 January 2014

Fatal error: Class 'PDO' not found

Drupal Website showing the following error
Fatal error: Class 'PDO' not found in /public_html/drupal/includes/database/
database.inc on line 184

If your server is using the php 5.2 , upgrade the php version to php 5.3 or higher

Or you will have to enable the PDO using the easyapache

Saturday 11 January 2014

How to open the port in the server

 If you want to open an incoming TCP port, type the following in the SSH as root user:
# iptables -I INPUT -p tcp --dport 12345 --syn -j ACCEPT
# service iptables save

 If you want to open an incoming UDP port, type the following in the SSH as root user:
# iptables -I INPUT -p udp --dport 12345 -j ACCEPT
# service iptables save

wp_localize_script was called incorrectly

Website showing the following error: 
Notice: wp_localize_script was called incorrectly. Scripts and styles should not be registered or enqueued until the wp_enqueue_scripts, admin_enqueue_scripts, or login_enqueue_scripts hooks. Please see Debugging in WordPress for more information. (This message was added in version 3.3.) in /public_html/wp-includes/functions.php on line 3049

Go to wp-config.php and make the following changes and check if it will work

define('WP_DEBUG', true); to define('WP_DEBUG', false);

It is not recommended to use WP_DEBUG or the other debug tools on live sites; they are meant for local testing and staging installs.

Friday 10 January 2014

Can't locate Error.pm in @INC error

Can't locate Error.pm in @INC error in the Quickinstall

In the Quickinstall it shows the following error : 
A fatal error or timeout occurred while processing this directive
 A box should expand giving an error message followed by a traceback. If the error message gives something as following 
Can't locate Error.pm in @INC error ...

Then try executing the following command in the SSH 
# cpan Error.pm

ERR_CONTENT_DECODING_FAILED

If you are getting the error as ERR_CONTENT_DECODING_FAILED while accessing the domain then add the below extension in php.ini  ++++++++...