Friday, November 7, 2014

/usr/lib/apache2/modules/libphp5.so: cannot open shared object file

If you facing this error on your ubuntu system while operating apache2, here is solution for you.

Install following package on your ubuntu system.
sudo apt-get install libapache2-mod-php5
Now try again.

Ubuntu Login Error : failed to start session

Ubuntu Login Error : failed to start session

If you are not able to log into your account and it shows above error. Here is a solution for you.

Press ctrl+alt+f1 to open command prompt.

Now install following packages.
sudo apt-get install ubuntu-desktop
and
sudo apt-get install gnome-shell ubuntu-gnome-desktop
Now try to Login again.

Configure: error: memcache support requires ZLIB

checking for the location of zlib,configure: error: memcache support requires ZLIB. Use --with-zlib-dir=<DIR> to specify prefix where ZLIB include and library are located
ERROR: `/tmp/pear/temp/memcache/configure --enable-memcache-session=yes' failed


To remove this error,you need to install zlib package.

If you are using Debian or Ubuntu, Run command

sudo apt-get install zlib1g-dev libncurses5-dev
If you are using CentOS, fedora or RHEL, Run command
sudo yum install zlib-devel
Now run again,

sudo /opt/lampp/bin/pecl install memcache
If it runs successfully

Add line

extension=memcache.so
in the file php.ini.

Restart xampp.

Memcache php extension not loaded

 Memcache php extension not loaded

If you are using XAMPP and you are facing this error while running your web application, Run following command in terminal.
sudo /opt/lampp/bin/pecl install memcache
If you face error: phpize failed
To remove this error, you need to install autoconf package.

If you are using Debian or Ubuntu, Run command
sudo apt-get install autoconf
If you are using CentOS, fedora or RHEL, Run command
sudo yum install autoconf
Now Run:
sudo /opt/lampp/bin/pecl install memcache

If you face error: 
checking for the location of zlib,configure: error: memcache support requires ZLIB. Use --with-zlib-dir=<DIR> to specify prefix where ZLIB include and library are located
ERROR: `/tmp/pear/temp/memcache/configure --enable-memcache-session=yes' failed


To remove this error,you need to install zlib package.

If you are using Debian or Ubuntu, Run command

sudo apt-get install zlib1g-dev libncurses5-dev
If you are using CentOS, fedora or RHEL, Run command
sudo yum install zlib-devel
Now run again,

sudo /opt/lampp/bin/pecl install memcache
If it runs successfully

Add line

extension=memcache.so
in the file php.ini.

Restart xampp

Error while restarting xampp - apachectl returned 1.

Error while restarting xampp - apachectl returned 1.

If you are facing this error while restarting XAMPP, the reason may be your virtualhost file. (/opt/lampp//etc/extra/httpd-vhosts.conf)

Check your virtual host file if there is any garbage text in it and Apache is not able to understand it.

Garbage text means half closed tags, copy-paste unnecessary data etc

Check your file closely and make necessary corrections.

Solution II
If you are still facing same problem, open Directory /opt/lampp/logs
and remove the file httpd.pid.
sudo rm -f /opt/lampp/logs/httpd.pid 
Now restart xampp. You should not face this problem again.

php pdo driver not found

php connect to mssql database on Linux using pdo: driver not found
php pdo mssql driver installation on centos and ubuntu

If you are using CentOS, fedora or RHEL, Run commands
sudo yum install php-pdo
sudo yum install php-mssql
sudo yum install freetds-devel libxml2-devel
If you are using Debian or Ubuntu, Run

sudo apt-get install php5-dev php5-mysql php5-odbc php5-sybase libmysqlclient-dev freetds-dev

dblib is needed on Linux to connect to mssql server using pdo.

Here is php code to connect to ms sql server from Linux Apache using pdo.
<?php
$dsn = 'dblib:dbname=testdb;host=127.0.0.1';
$user = 'dbuser';
$password = 'dbpass';
$dbh = new PDO($dsn, $user, $password);
?>
Now try to connect MS SQL server.

mkmf.rb can't find header files for ruby at /usr/lib/ruby/ruby.h

/usr/bin/ruby extconf.rb
mkmf.rb can't find header files for ruby at /usr/lib/ruby/ruby.h
Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/ffi-1.9.6 for inspection.
Results logged to /usr/lib/ruby/gems/1.8/gems/ffi-1.9.6/ext/ffi_c/gem_make.out


If you are using CentOS, fedora or RHEL, Run command
sudo yum install ruby-devel
If you are using debian or ubuntu, Run command
sudo apt-get install ruby-dev

nodejs npm - Fatal error: unable to find local grunt

Fatal error: unable to find local grunt

You need to install grunt on your system.
All the explanations are here.

To solve this problem, Run following command in terminal :
npm install -g grunt-cli
npm install grunt --save-dev
npm install grunt-cli

cronjob is running at wrong timezone

cronjob time zone is wrong

First check hardware time and timezone using command
hwclock
If it is different than system time, it may be possible that your cron is following hardware time.

Set your hardware clock time same as system time using command
hwclock -w
Now check if cron is following correct time zone.

If you are still facing problem, Restart cron daemon once.
You need to restart cron when you change your time zone.

If you are still facing problem, Restart your system once.

karma - can not start chrome

INFO [karma]: Karma v0.12.24 server started at http://localhost:xxxx/
INFO [launcher]: Starting browser Chrome
ERROR [launcher]: Cannot start Chrome


Set chrome path using
export CHROME_BIN=/opt/google/chrome/google-chrome
Now run your script.

If you are still facing this error, Install chrome launcher using
npm install karma-chrome-launcher
Now run your script.

If you are still facing this error.
Kill all instances of chrome.
Output of `ps aux | grep chrome | grep -v grep` should be empty.
Now run your script.