cPanel / WHM upgrade failure !

When trying to upgrade cPanel /WHM version, do you face the following error :

Switching to 11.46.2.4 to determine if we can reach that version without failure.

FATAL: Could not figure out RPM distribution version
The Administrator will be notified to review this output when this script completes

FATAL: Failed to download updatenow.static from server: HASH(0x1dcb0108)

You might need to check the file /var/cpanel/sysinfo.config and ensure that the variable ‘rpm_dist_ver‘ points to a valid number and not unknown. If you are on CentOS 5.xx, rpm_dist_ver will be 5.

Once you save this file with the valid setting, re-run the upgrade,       # /scripts/upcp

 

Hiding PHP extension in IIS using URL rewrite module

We have some situations in which we need to hide the extension of a webpage to the end users. Mostly this is concerned with the server security. Here we discuss about hiding the PHP extension of a wepage deployed in an IIS server .

We can easily implement this in Linux using codes passed via .htaccess file. In the case of Windows we will use URL-rewrite module to achieve the same. By default, this module is not installed alongside IIS, so we need to install it via Microsoft Web Platform Installer (WPI).

After the installation of URL-rewrite module, we need to edit the web.conf file in the root directory.

Say for example, we have a php website ‘www.abc.com’ and its root folder is C:/inetpub/wwwroot/www.abc.com. We need to hide the php extension of the page, www.abc.com/test.php. That is, we need to rewrite this url into www.abc.com/test. Lets now edit the web.conf file located at the root folder of the site (C:/inetpub/wwwroot/www.abc.com).

Attaching a sample web.conf file to make it clear :

<?xml version=”1.0″ encoding=”utf-8″ ?>

<configuration>

<system.webServer>

   <rewrite>

     <rules>

         <rule name=”test rule” enabled=”false” stopProcessing=”true”>

              <match url=”^gif” />

               <action type=”Rewrite” url=”{R:0}.aspx” />

         </rule>  

     </rules>

     </rewrite>

</system.webServer>

</configuration>

In our case look for the <rewrite> option in the web.conf file. After finding <rewrite> tag, copy the below mentioned configuration and paste it under the <rewrite> tag.

<rule name=”PHP Hiding”>

     <match url=”(.*)” />

         <conditions logicalGrouping=”MatchAll”>

             <add input=”{REQUEST_FILENAME}” matchType=”IsFile” negate=”true” />

             <add input=”{REQUEST_FILENAME}” matchType=”IsDirectory” negate=”true” />

         </conditions>

     <action type=”Rewrite” url=”{R:1}.php” />

</rule>

After this, the webpage will always be displayed as www.abc.com/test instead of www.abc.com/test.php

Installing a Perl module using CPAN

In this short post, we will discuss on how to install a perl module using CPAN.

First, login to the CPAN interactive shell using the command:

# cpan

Once, you are in, install a module using the syntax,

cpan> install package:function

eg, to install the module JSON::Parse, hit the following in the shell :

cpan> install JSON::Parse

The installation will check for certain test cases. If any of those tests fail, you wont be able to install the module. Analyse the result of the tests and if you feel you are good to go, even with the failed result, force install the module using :

cpan> force install JSON::Parse

Thats it !

 

No backupset selected to be restored – error in SQL 2012/14 !

Sometimes we get a message like “No backupset selected to be restored” while trying to restore a Database into SQL server 2012 or SQL Server 2014 using SQL Management Studio. There are various reasons for this to happen, such as :

  • If we are trying to restore the backup from a different version of SQL Server. For example consider we have SQL Server 2008 Express and if we try to restore a backup of any other version such as SQL Server 2012 or 2014, this error should pop up.
  • Another main reason is related to the permission of ‘.bak’ file. If the .bak file is having any special permissions or it is located in a folder with special permissions, then Management studio will not read the file and this may lead to this error. So we make sure that .bak file have the appropriate permission  before proceeding with the restoration.

If you are facing this issue and you want more information about this error, try to restore the DB using the following T-SQL:

RESTORE DATABASE <Your Database > FROM DISK=’<Path to your backup file>\<Your Database>.bak’

This should do it 🙂




mod_ruid2 – Issues in mutual exclusion ?

The mod_ruid2 Apache module changes the permissions of all of the HTTP requests for a domain to the permissions of the owner of that domain. This is just like suexec or the module mod_suphp !

If you have enabled mod_ruid2 in your server and if there are any scripts which require mutual exclusion to take place, there might be some issues being reported by Apache.

You might find something like this in the Apache error logs :

Date [emerg] (13)Permission denied: couldn't grab the accept mutex
Date [alert] Child xxx returned a Fatal error... Apache is exiting!
Date [emerg] (43)Identifier removed: couldn't grab the accept mutex

To fix this issue, edit  ‘/usr/local/apache/conf/mod_ruid2.conf‘ and add the following line :

AcceptMutex posixsem

Restart httpd service and see how things are moving !