Pages

Wednesday, June 5, 2013

vi and vim cheat sheet for Linux

Cursor movement
h – move left
j – move down
k – move up
l – move right
w – jump by start of words (punctuation considered words)
W – jump by words (spaces separate words)
e – jump to end of words (punctuation considered words)
E – jump to end of words (no punctuation)
b – jump backward by words (punctuation considered words)
B – jump backward by words (no punctuation)
0 – (zero) start of line
^ – first non-blank character of line
$ – end of line
G – Go To command (prefix with number – 5G goes to line 5)
Note: Prefix a cursor movement command with a number to repeat it. For example, 4j moves down 4 lines.



Insert Mode – Inserting/Appending text
i – start insert mode at cursor
I – insert at the beginning of the line

Solve PHP Fatal Error: Allowed memory size of 8388608 bytes exhausted (tried…

This error message can spring up in a previously functional PHP script when the memory requirements exceed the default 8 MB limit. However, do not fret because this is an easy problem to overcome.


To change the memory limit for one specific script, include a line such as this at the top of the script:

ini_set("memory_limit","12M");

The 12M sets the limit to 12 megabytes (12582912 bytes). If this does not work, keep increasing the memory limit until your script fits or your server squeals for mercy.

Sunday, April 21, 2013

Error While installing FFMPEG on CentOS server “ffmpeg: error while loading shared libraries: libavdevice.so.52:”

After  installing FFMPEG on one of my client server,  I faced following error :

Error :

=========================================================================================
 ffmpegffmpeg: error while loading shared libraries: libavdevice.so.52: cannot open shared object file: No such file or directory
=========================================================================================

Solution :
Solution on the issue is very simple as follows, Just change your library path by running  below command :
=========================================================================================

root@ip[~]# export LD_LIBRARY_PATH=/usr/local/lib/
=========================================================================================
Its done!

Fatal error: Call to undefined function mb_strtolower() on cPanel server

I was facing following error on my site :
=======================================================
Fatal error: Call to undefined function mb_strtolower() in
=======================================================
Cause :
The error was due to mbstring php module  was not installed.
Solution:
To resolve this issue need to recompile apache with Multibye string(mbstring) module.
Once apache is compiled your error should be gone…Cheers!

yum upgade/update “Transaction Check Error:”

Today While updating yum on one of Centos server I got the following error :
Error :
———————————————————————————————-

Transaction Check Error:file /usr/share/man/man1/xdelta.1.gz from install of xdelta-1.1.4-1.el5.rf.x86_64 conflicts with file from package xdelta-1.1.3-20.i386
Error Summary

———————————————————————————————-

I’ve checked the xdelta package on the server by running the following command :

Error connecting to MySQL: Access denied for user: ‘da_admin@localhost’ (Using password: YES):

Today When connecting to the MySQL in DirectAdmin , I got this error and that would indicated that the “da_admin” user has not been setup correctly. To resolve this I did following:
1) You need to Make sure the root mysql password works. If you know it, Go to mysql,  If you don’t..  then mysql root password can be found in the /usr/local/directadmin/scripts/setup.txt , if it has not been deleted.
It’s under the header “mysql=”.
If it cannot be found, then mysqld will have to be restarted with the –skip-grant-tables option as follows :

==========================================

# [root@test ~]# service mysqld stop
# [root@test ~]# mysqld_safe –skip-grant-tables &

===========================================

This will  start up mysql without the need for a root password. Then run