Friday, 17 February 2012

Joomla 1.5.25 : URLs get redirected to home page


We had a problem with a Joomla 1.5.25 site. whenever we clicked on any of the links in the Main Menu, the site shows only the Home Page.

We turned off SEF URLs from the Administrator Module. That did not work.

Then when we checked the apache log the problem was identified.


The log showed the following error :

warning: preg_match() [function.preg-match]: Compilation failed: this version of PCRE is not compiled with PCRE_UTF8 support at offset 0 in 

The pcre status was checked using

pcretest  -C

The Output was :

Compiled with
UTF-8 support
Unicode properties support
Newline sequence is LF
Internal link size = 2
POSIX malloc threshold = 10
Default match limit = 10000000
Default recursion depth limit = 10000000

Match recursion uses stack

Even though pcre was compiled with UTF-8 support, Apache was using the pcre which came with the PHP library (which is an older version).

So Apache was recompiled with the option '--with-pcre=/usr'.

This solved the problem and the URLs were working properly.

Thursday, 16 February 2012

Shrinking MS-SQL Database

Normally shrinking a database increases performance and reduces size only by a small margin.

The following process helps to shrink the database and increases performance by a huge factor.


1 - Take  Transaction Log  backup twice.

2 - Then shrink the Database.

Saturday, 4 February 2012

Errors while installing PHP from source (RHEL 5)

Following were some of the errors (and their solutions) that I had to face while installing PHP from source tarballs. The solutions are described with the assumption that the yum repository is already configured.


Configure: error: Cannot find openssl's <evp.h>

# yum install openssl-devel


Could not find pcre.h in /usr

# yum install pcre-devel


Configure: error: Please reinstall the BZip2 distribution
# yum install bzip2-devel


Configure: error : Please reinstall the libcurl distribution.

# yum install curl-devel


DBA: Could not find necessary header file(s)

# yum install db2-devel


Configure: error: Unable to locate gmp.h

# yum install gmp-devel


Configure: error: utf8_mime2text() has new signature, but U8T_CANONICAL is missing. This should not happen. Check config.log for additional information

# yum install libc-client-devel


Cannot find libpq-fe.h. Please specify correct PostgreSQL installation path
# yum install postgresql-devel


Configure: error: xslt-config not found. Please reinstall the libxslt >= 1.1.0 distribution

# yum install libxslt-devel


Configure: error: freetype.h not found

# yum install freetype-devel


Configure: error: Cannot find ldap.h

# yum install openldap-devel


Could not find pspell

# yum install aspell-devel


Configure: error: xml2-config not found. Please check your libxml2 installation.
# yum install libxml2-devel


Configure: error: Cannot find MySQL header files under /usr.
Note that the MySQL client library is not bundled anymore!

Install the MySQL-devel package corresponding to your MySQL version


Checking for unixODBC support... configure: error: ODBC header file '/usr/include/sqlext.h' not found!

# yum install unixODBC-devel


Configure: error: snmp.h not found. Check your SNMP installation

# yum install net-snmp-devel


Note :- The following error occur while performing 'make'

php-5.3.9/sapi/cli/php: error while loading shared libraries: libpq.so.5: cannot open shared object file: No such file or directory
make: *** [ext/phar/phar.php] Error 127


The solution was the libpq.so.5 library file which was present inside the lib directory of the PostgreSQL installation directory was copied to /usr/lib64



Friday, 3 February 2012

Content Display Problem in Joomla with PHP 5.3.9

While running Joomla applications using PHP 5.3.9, the contents or aticles may not be displayed properly. There is a simple work around for this glitch.

Go to  Joomla application folder > includes > Cache > Lite

Open the file Function.php for editing.

Go to line number 74

Replace the code :

$arguments = func_get_args();


with



 $arguments = func_get_args();
 $numargs = func_num_args();
 for($i=1; $i < $numargs; $i++)
        {
             $arguments[$i] = &$arguments[$i];
        }


Now your articles will be properly displayed on the Joomla site.



Sunday, 29 January 2012

Unlocking iPhone 3GS with iOS 4.1 and Baseband 5.14.02

This is not a sysadmin topic. But still I would like to share my experience of Unlocking an iPhone 3GS.



The following method first Jailbreaks the Iphone with the help of Redsnow 0.9.6b5 and then unlocks using Ultrasnow 1.2. The method can be used with iOS 4.1, iOS 4.2.1 with Basebands 5.14.02 and 5.15.04.

The method requires that you download all the required softwares. WIFI need not be enabled for the process. All the files needed can be downloaded to the PC from the below links and then the process of unlocking can be commenced. (While using Redsnow, the PC has to be connected to the Internet as it has to fetch baseband files from the Apple Server)


Required Software :

iTunes - Download
Redsnow 0.9.6b5 - Download
Ultrasnow 1.2 - Download
iOS 4.1 - Download       
iExplorer - Download


After all the above has been downloaded continue to the steps described below.


Word of Caution : During all the steps mentioned below the iPhone must be plugged in to the PC through the data cable. Disconnecting the phone or turning it off can cause damage to the iPhone. So keep the phone fully charged and plugged in at all times till the process is over.


1. Install iTunes

Install iTunes 10 or above. This will help redsnow detect the iPhone when the phone restarts in recovery mode. The drivers required will be copied automatically during the iTunes Installation.


2. Running Redsnow (Jailbreaking)
The process that redsnow does is that :

a) It changes the baseband of the iPhone from 5.14.02 to 6.15.00. This is done since no unlock has been released for 5.14.02.
b) It installs Cydia Installer. This will be needed to Install Ultrasnow needed to unlock the iPhone.

If you are going to run Redsnow in Windows 7 or Vista be sure you run it in a compatibility mode for Windows XP and also run it as Administrator to avoid any problems.

Start Redsnow and click the 'Browse' Button and direct it to the Path of the iOS image that you have downloaded earlier.

Wait for the firmware to be processed. Once it is done click next. Choose “Install Cydia” and “Install iPad Baseband” options. A popup message will pop up with a warning, click Yes to continue.

Now follow the instructions by Redsnow to put the iPhone in the DFU mode.

After this redsnow will download the baseband files from the Apple Server, create a custom firware file and flash it into the device. (Please be patient while this step proceeds as it can take some time. Please don't do anything until this step is completed).

Once you get a confirmation message, the iPhone will restart and you will get a fully Jailbroken iPhone with baseband changed to 6.15.00 and Cydia Installer installed.

You can check the new baseband settings in Settings > General > About > Modem Firmware. It will be 6.15.00



3. Installing Ultrasnow

Install iExplorer. Using iExplorer browse to the folder private/var/root/Media.

Create a folder Cydia. Inside the folder Cydia again create a folder AutoInstall (the names are case sensitive)
Unzip the Ultrasnow_1.2.zip file you have downloaded and copy the contents to the AutoInstall Folder.

Restart the iPhone twice.



The iPhone will be unlocked and you can use the SIM card of the service provider you desire.

Friday, 27 January 2012

USER MANAGEMENT (Redhat)



Understanding Users


Following are the types of users that normally come in a Linux OS.


1. Administrator  or Super User
2. Normal Users
3. Sys Users or Pop Users (Users that have no shell to log in into)
4. Network User


The information regarding users is normally stored in the file /etc/passwd.

Each entry in the passwd file has 7 fields as shown:

Username : X : UID : GID : GECOS : Home directory : Default shell


Username           - gives the name of the user
X                         - indicates whether the user has a password
UID                    - the User ID  ( 0 is for root user , 1-499 are pop users, greater than 500 are normal users)
GID                     - the Primary Group ID number
GECOS               - It is used to give comment or description for that user
Home Directory  - Specifies the home directory of the user
Default Shell       - Specifies the default shell the user gets


Each user has a primary group associated with it. When a user is created, a primary group of the user with the same name as that of the user is created.


Information regarding the group is contained in the field  /etc/group


Each entry in the group file contains 4 fields :


Groupname : X : GID : Members in the group




Adding Users


useradd  <username>  - Creates a user

passwd  <username>  -  Sets a password for the user

useradd -d <directory location>  <username>  - Creates a user and makes the directory specified, the user's  home directory.

useradd  -s  <shell>  <username>  -  Creates a user by specifying the default shell the user gets.


Modifying Users


usermod  -g  <groupname>   <username>   -   Change primary group of the user

usermod  -G  <groupname>   <username>   -   Change secondary group of the user


User Groups

groupadd  <groupname>   -   Creates a group

gpasswd  <groupname>    -   Set or change the password of a group

groups  <username>         -   Lists the groups of a user

groupdel  <groupname>      -   Deletes a group


Delete Users


userdel  <username>        -    Deletes a user

userdel  -r  <username>   -    Deletes a user along with the home directory of the user.


" To create a pop user  -  useradd  -s  /sbin/nologin  <username> "



Thursday, 19 January 2012

Allowing Remote Access to a MySQL Database

By default MySQL does not allow databases in a machine to be accessed from a remote host. By performing the following steps, access to a database from a remote machine can be enabled.


Connect to the mysql server :

[root@localhost:~] mysql -u <username> -p



Now for  Granting access to the IP address of the remote machine :

mysql>   GRANT ALL ON dbname.*  TO  username@'IP ADDRESS' IDENTIFIED BY 'PASSWORD';



Along with this you will need to allow Port 3306 to be accessed by the remote machine.

If Iptables is used,

iptables -A INPUT -p tcp --dport 3306 -j ACCEPT



This will allow the user to access the database from a remote machine.