Archive for October 2011

How to disable SSH reverse mapping checking

If you want to disable reverse mapping checking getaddrinfo while connecting to a remote server via SSH then there two options :


local : /etc/hosts


If you want to resolve this locally then all you need to do is to add an entry for the remote host in the /etc/hosts file as :

[email protected][#] vi /etc/hosts 

Add the below line  save and quit.


remote : /etc/ssh/sshd_config


open the /etc/ssh/sshd_config file and then locate the entry


GSSAPI options


# GSSAPI options
#GSSAPIAuthentication no
GSSAPIAuthentication yes
#GSSAPICleanupCredentials yes
GSSAPICleanupCredentials yes
#GSSAPIStrictAcceptorCheck yes
#GSSAPIKeyExchange no

In the above entries you need to commend the line


GSSAPIAuthentication yes

to disable the reverse mapping authentication for SSH


#GSSAPIAuthentication yes

and then restart the sshd service


That’s all you are done.

Install APC for PHP on Linux

If you want to install APC for PHP on Linux server then follow the below easy steps :

 [email protected][#] pecl install apc


You can manually install it following the below steps :

[email protected][#] wget

The above command will always downloads the latest version of APC

Now extract the downloaded zip file :

[email protected][#] tar -zxf APC-3.1.9.tgz
[email protected][#] cd APC-3.1.9
Now we need to execute ‘phpize’ command

This requires that you have PHP development package installed. On CentOS it is php-devel and which can be installed by running the command :

 yum install php-devel
[email protected][/usr/local/src/APC-3.1.9]# phpize
 Configuring for:
 PHP Api Version: 20090626
 Zend Module Api No: 20090626
 Zend Extension Api No: 220090626
Now we need to configure APC

If you are unsure as to where the php-configs files are located then use the below command to find the correct path

[email protected][#] whereis php-config

php-config: /usr/bin/php-config /usr/local/bin/php-config /usr/man/man1/php-config.1

and then run the configure command like so:
./configure --enable-apc --enable-apc-mmap --with-apxs 

Now as configure is done, we need to run ‘make’ command:

[email protected][#] make
 and then make install:
 [email protected][#] make install

If everything goes well then you will get an output like this

Build process completed successfully
Installing '/usr/local/include/php/ext/apc/apc_serializer.h'
Installing '/usr/local/lib/php/extensions/no-debug-non-zts-20090626/'
install ok: channel://
Extension apc enabled in php.ini

Finally just restart the web server to reflect the changes :

[email protected][#] /etc/init.d/httpd restart

But if you encounter an error as below

error: syntax error before ')' token
make: *** [apc.lo] Error 1

then just execute the below command :

[email protected][#] yum install pcre-devel

After that again try “make” and “make install” commands and it will work for you now.

That’s all you are done.

How to change Collation from latin1_swedish_ci to utf8_general_ci

If you want to change your database collation form from latin1_swedish_ci to utf8_general_ci then follow the below steps :

take the sql dump for the DB for which you want to change the collation :

example :

[email protected][#] mysqldump --opt test_shop > test_shop.sql

Now in the .sql dump file search for the collation for latin :

[email protected][#] cat test_shop.sql | grep -i latin1

now replace the latin collation to utf8 by running the command :

[email protected][#] replace latin1 utf8 -- test_shop.sql

finally restore the changed .sql dump file (in ex : it is test_shop.sql)

[email protected][#] mysql test_shop < test_shop.sql

That’s all you are done.