Ubuntu: PHP libphp5.so missing: cannot open shared object file

February 27, 2012    |   Posted by admin   |    Category: Linux Administration

If Apache2 service fails to start with a “libphp5.so: cannot open shared object file” message, it indicates that libphp5.so is missing on your Ubuntu server.

Apache2 has detected a syntax error in your configuration files:
Syntax error on line 1 of /etc/apache2/mods-enabled/php5.load:
Cannot load /usr/lib/apache2/modules/libphp5.so into server:
/usr/lib/apache2/modules/libphp5.so: cannot open shared object file:
No such file or directory

Apache configuration calls the php5.load file which includes the path to the libphp5.so module. The php5.load cannot load libphp5.so file if it is missing from the /usr/lib/apache2/modules/ directory. See if it exists:

# ls -la /usr/lib/apache2/modules/libphp5.so
 ls: cannot access /usr/lib/apache2/modules/libphp5.so:
 No such file or directory

See if the libphp5.so module is installed elsewhere on the server using the find and locate command

# find / -name libphp5.so
# locate libphp5.so

if it is, copy it to /usr/lib/apache2/modules/ directory and restart Apache.

If the file is not present, install the ‘libapache2-mod-php5’ package, the PHP5 module for Apache2. It adds the required FilesMatch directives to the Apache configuration.

# apt-get install libapache2-mod-php5

The ‘libapache2-mod-php5’ package will create the libphp5.so file under the modules directory and apache2 will restart successfully

# /etc/init.d/apache2 restart
Comments Off on Ubuntu: PHP libphp5.so missing: cannot open shared object file

Unzip: skipping filename.zip need PK compat. v4.5

February 20, 2012    |   Posted by admin   |    Category: Linux Administration

Sometimes extracting a zip file using the unzip command may result in the “skipping: filename.zip  need PK compat. v4.5” error message.

# unzip filename.zip
Archive:  filename.zip
   skipping: filename.zip  need PK compat. v4.5 (can do v2.1)

This is due to the file been compressed with the latest version of PKZIP which the unzip command cannot handle. The solution is to install p7zip package which can handle the files compressed using PKZIP.

Download the latest version of p7zip:

# wget http://sourceforge.net/projects/p7zip/files/p7zip/\
9.20.1/p7zip_9.20.1_x86_linux_bin.tar.bz2

Extract the file

# tar -jxf p7zip_9.20.1_x86_linux_bin.tar.bz2

goto the extracted directory and run the installer

# ./install.sh

This will install the ‘7za’ command on your server using which the zip file can be extracted

# 7za x filename.zip
 Processing archive: filename.zip
 Extracting  filename
 Everything is Ok
Comments Off on Unzip: skipping filename.zip need PK compat. v4.5

Howto Install and Configure VNCserver in Linux?

January 5, 2012    |   Posted by admin   |    Category: Linux Administration

The common method to manage a Linux server remotely is through CLI interface via SSH, which many people often find it difficult as they are not familar with the Linux commands.

The solution is to install a KDE Or GNOME Desktop on the Linux server and access it through VNC. VNC (Virtual Network Computing) is a graphical desktop sharing system which allows you to share a desktop of a remote server as if you are sitting in front of it.

Following are the steps to install and configure VNC on a Linux server:

1. Install the vnc-server packages.

# yum install vnc*

2. Now, edit the file /etc/sysconfig/vncservers and add the following lines at the end:

VNCSERVERS="1:root"
VNCSERVERARGS[1]="-geometry 800x600"

This will enable VNC on terminal 1 with 800×600 resolution.

3. Next step is to create a startup file in .vnc directory under the user’s home directory, in this case it is /root

# nano /root/.vnc/xstartup

4. Now, add the following in the file

###########################
#!/bin/sh

# Uncomment the following two lines for normal desktop:
unset SESSION_MANAGER
exec /etc/X11/xinit/xinitrc

[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
startkde &

#############################

The last line in the above file indicates that it will start the KDE desktop by default. To start the GNOME desktop, replace the last line with “exec gnome-session &”

5. Set execute permissions on the file:

# chmod 755 /root/.vnc/xstartup

6. Now set a vnc password for user ‘root’

# vncpasswd

7. Once done, start the vncserver and it should show something like below:

# vncserver
New 'server.hostname:1 (root)' desktop is server.hostname:1
Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/server.hostname:1.log

where, server.hostname above is your server’s hostname. The log file will be created under the .vnc directory of the users home directory. The Linux server side part is done.

8. Now, download and install VNC-Viewer on your computer (client-side). Open vnc-viewer and enter “server.hostname:1” (use your server IP instead of server.hostname) and the vnc password you have set above. You will now be connected to the graphical interface of your Linux server.

Comments Off on Howto Install and Configure VNCserver in Linux?

error event.h: No such file or directory

December 19, 2011    |   Posted by admin   |    Category: Linux Administration

While compiling a package say, Greensql you may end up with the “event.h: No such file or directory”  error message as follows:

# make
g++ -g -Wno-deprecated -Wall -I/usr/local/include/ 
-c -o main.o main.cpp
main.cpp:23:19: error: event.h: No such file or directory

It indicates that the required ‘libevent’ package is missing from the server. You have to install the libevent and libevent-devel package either using YUM or from a RPM.

# yum install libevent libevent-devel

OR install the RPMs:

# rpm -ivh ftp://ftp.muug.mb.ca/mirror/centos/5.7/os/x86_64/\
CentOS/libevent-1.4.13-1.x86_64.rpm
# rpm -ivh ftp://ftp.muug.mb.ca/mirror/centos/5.7/os/x86_64/\
CentOS/libevent-devel-1.4.13-1.x86_64.rpm

(download the i386 version if you have a 32bit machine)

Comments Off on error event.h: No such file or directory

RPM remove error: specifies multiple packages

November 18, 2011    |   Posted by admin   |    Category: Linux Administration

You may receive an error message “error: packagename specifies multiple packages” while removing a package with “rpm -e package-name”, for example:

# rpm -e mysql-devel
error: "mysql-devel" specifies multiple packages

This is because the packages of both the architectures (32 and 64 bit) are installed  on the server i.e.

mysql-devel.i386
mysql-devel.x86_64

CentOS, Fedora will list the duplicate packages when you query them using RPM. It won’t list the architecture i.e.

# rpm -qa mysql-devel
mysql-devel
mysql-devel

To list the packages along with their architecture, use the –queryformat option while querying the package,

# rpm -q --queryformat "%{name}.%{arch}\n" mysql-devel
mysql-devel.i386
mysql-devel.x86_64

Now, remove the package you wish to, for example 32 bit package:

# rpm -e mysql-devel.i386
Comments Off on RPM remove error: specifies multiple packages