Tuesday, March 6, 2018

postgresql error : ERROR: database is being accessed by other users

ERROR:  database "X" is being accessed by other users
DETAIL:  There is 1 other session using the database


Solution :
SELECT pg_terminate_backend(pid) FROM pg_stat_activity WHERE pid <> pg_backend_pid() AND datname = 'database-name';
You need to replace only database name in above query.

Now you can drop the database or perform other activity what you were trying to perform.

composer update - exceeded the timeout of 300 seconds

Failed to download from source: The process  exceeded the timeout of 300 seconds.

Solution :
Increase the timeout limit globally for composer
composer --global config process-timeout 6000
Now run
composer update
You should not get timeout issue.

gitlab forbidden issue

This feature has been added by default in recent update of gitlab.
When there are number of failed login attempts while cloning or pushing files into gitlab repository, gitlab blocks UI as well as pull and push for the IP. Technically, it bans the IP.

Solution :
Disable this feature.

sudo nano /etc/gitlab/gitlab.rb
Uncomment these lines.
gitlab_rails['rack_attack_git_basic_auth'] = {
'enabled' => false,
}
Reconfigure gitlab.
sudo gitlab-ctl reconfigure
Now it will not block that ip after number of failed login attempts.

ubuntu 16.04 - wkhtmltopdf error - QSslSocket: cannot resolve CRYPTO_num_locks

wkhtmltopdf error on ubuntu 16.04 :
Loading pages (1/6)
QSslSocket: cannot resolve CRYPTO_num_locks                  ] 10%
QSslSocket: cannot resolve CRYPTO_set_id_callback
QSslSocket: cannot resolve CRYPTO_set_locking_callback
QSslSocket: cannot resolve sk_free
QSslSocket: cannot resolve sk_num

Solution :

sudo apt-get install libssl-dev=1.0.2g-1ubuntu4.10 openssl=1.0.2g-1ubuntu4

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

Ruby Error while installing charlock_holmes 

Error :
Fetching charlock_holmes 0.7.5
Installing charlock_holmes 0.7.5 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.



Solution : 1

If you are using debian or ubuntu
sudo apt-get install libicu-dev

If you are using Centos or fedora
sudo yum install libicu-devel

Solution : 2
Try to install other version of charlock_holmes
gem pristine charlock_holmes --version 0.6.9.4
or
gem install charlock_holmes -v '0.6.9'

Friday, February 23, 2018

Skipping ssh-dss key id_dsa - not in PubkeyAcceptedKeyTypes

SSH keeps skipping my pubkey and asking for a password

You have correct ssh key but still it is asking password to login or if password authentication is prohibited, it stopped accepting correct keys.

If it was working before and suddenly it starts giving above error, it means you have upgraded your openssh. The new openssh version - 7.0+ does not support DSA keys anymore  (Neither on server nor on client). 

If openssh client has been upgraded and openssh server still supports DSA keys, make the changes in client side ssh config.

Solution  :
sudo nano /etc/ssh/ssh_config
Add following line in the file.
PubkeyAcceptedKeyTypes=+ssh-dss
Restart ssh.

If openssh server has been upgraded and openssh client still supports DSA keys, make the changes in server side sshd config.

Solution  :
sudo nano /etc/ssh/sshd_config
Add following line in the file.
PubkeyAcceptedKeyTypes=+ssh-dss
Restart ssh.

Note :  The best solution, you must use RSA keys. It has strong and secure algorithm and it is better than the patch you are finding.

Saturday, February 10, 2018

openedx installation on Linux | openedx installation on Ubuntu


Easy way :
1. Download the installer (.run file)
https://bitnami.com/stack/edx/installer
2. Make it executable.
chmod a+x filename.run
3. Run the installer.
./filename.run

Hard way:
Install using bash script. Why it is hard because it is gonna give many errors, you need to fix them one by one and start installing again and again until it is installed completely.
wget https://raw.githubusercontent.com/edx/configuration/$OPENEDX_RELEASE/util/install/sandbox.sh -O - | bash

You choose the version of Open edX by setting the OPENEDX_RELEASE variable before running the commands. See Open edX Releases for the tags you can use.
https://openedx.atlassian.net/wiki/spaces/DOC/pages/11108700/Open+edX+Releases
Release names like open-release/ginkgo.2, open-release/eucalyptus.3, open-release/ficus.4 etc

Example:
wget https://raw.githubusercontent.com/edx/configuration/open-release/ginkgo.2/util/install/sandbox.sh -O - | bash

Helpful url :
https://openedx.atlassian.net/wiki/spaces/OpenOPS/pages/146440579/Native+Open+edX+Ubuntu+16.04+64+bit+Installation

Hardest way:
Install each package separately like these guides are suggesting. Similar guides you can find for centos and fedora.
https://www.iblstudios.com/step-step-guide-install-open-edx-platform-ficus-release/
I would suggest you to install on virtual machine like docker, vagrant or vmware instead of start installing on your system.

Friday, January 26, 2018

postgresql - Check ip of logged in user

To get Logged in user IP

Run Query :
postgres=> select inet_client_addr();

Tuesday, January 9, 2018

mysql - Check IP of logged in user


Run Query :

mysql> select user();



Mysql 5.7 - Update root password

mysql 5.7 does not have password field in user table of mysql database. They have come up with new idea i.e. authentication_string for security purpose.

Here is way to update mysql superuser password using command line.
UPDATE mysql.user SET authentication_string=PASSWORD('sToituY78hebrt'), plugin='mysql_native_password' WHERE User='root' AND Host='localhost';

where sToituY78hebrt is my root password

Friday, December 15, 2017

Invalid command '\xef\xbb\xbf#', perhaps misspelled or defined by a module not included in the server configuration


\xef\xbb\xbf are three invisible junk characters (at least from Apache's perspective) called the Unicode BOM, or byte order mark. Apache thinks that those characters are part of the command that follows right after. This is what you see in the log, though the characters are escaped so they're visible to the naked eye. \xef\xbb\xbfRewriteEngine

Copy the content in any advanced notepad editor which will detect the characters and you can easily remove them.

If you are not able to see these characters, remove this file completely and write again.

cpanel - wordpress - internal server error because of invalid permissions

cpanel - wordpress application - fix wordpress permissions of complete directory

cpanel > wordpress tool kit > Manage your site (Click on manage button) > Fix Permissions

It will fix all permissions of wordpress directory.

s3cmd : Configure multiple s3 buckets of multiple aws accounts on same server


First configure s3 bucket of 'AWS account - A' with s3cmd
s3cmd --configure
Add Access key and Secret Key of your 'AWS account A'.

Now rename ~/.s3cfg to ~/.s3cfg-first
You can find .s3cfg file in your home directory of logged in user.

Now configure s3 bucket of 'AWS account - B'
s3cmd --configure
Add Access key and Secret Key of your 'AWS account B'.
Now rename ~/.s3cfg to ~/.s3cfg-second

 
Configure third and so on

If you do not define config file parameter in command, it takes default config file i.e. .s3cfg


You need to define config file with command and you can communicate with different s3 buckets of one AWS account or multiple AWS accounts.
s3cmd ls s3://bucketname -c ~/.s3cfg-first
Above command will list the content of the defined s3 bucket of AWS account - A.
s3cmd ls s3://bucketname -c ~/.s3cfg-second
Similarly it will list the content of the defined s3 bucket of AWS account - B.

Now you can copy content, delete content or move them with different s3cmd commands.

Note : Number of buckets you can access of AWS account A or AWS account B, it depends on the privileges provided to access key and secret key and privileges are defined by the policy attached to the user whose access key and secret key you are using. 

If a policy which has read, write and list access of only one bucket 'Bucket-A' of an AWS account and this is the only policy attached to a user whose access key and secret key you are using then you can access only Bucket-A of that AWS account by using the access key and secret key of the user.

Use Redirect and Proxypass under one virtualhost in apache


If you need to redirect your domain on another domain or you need to redirect http to https, you use Redirect Permanent in your virtualhost to achieve but if your application is running on different port (node, python, ruby etc) and you have resolved port using proxy pass then your redirect attribute might not be working.

To solve this issue, use redirect under proxy directive.

<VirtualHost *:80>
    ProxyPreserveHost On
    ProxyPass / http://localhost:8080/
    ProxyPassReverse / http://localhost:8080/

<Proxy *>
    Redirect permanent / https://domain.co.in
</Proxy>

</VirtualHost>

Now your port will be resolved with domain as well as you can redirect domain too.

/opt/lampp/bin/httpd: relocation error: .so: symbol SSL_library_init, version OPENSSL_1.0.0 not defined in file libssl.so.1.0.0 with link time reference

Xampp apache is not starting after adding stomp extension or mongo extension in php.ini file. After installation using pecl, you have added following line in php.ini file.
extension=mongo.so
extension=stomp.so

Now when you try to restart xampp, apache does not start. 

When you check the apache log, you see following error.

/opt/lampp/bin/httpd: relocation error: stomp.so: symbol SSL_library_init, version OPENSSL_1.0.0 not defined in file libssl.so.1.0.0 with link time reference

/opt/lampp/bin/httpd: relocation error: mongo.so: symbol SSL_library_init, version OPENSSL_1.0.0 not defined in file libssl.so.1.0.0 with link time reference

If you remove the extension line in php.ini, apache works fine but you need to use the extension so you can not remove it, here is the solution.

Solution :

Install stomp or mongo or other extension with disable ssl support


Choose no option while installing stomp/mongo/extension-name

OpenSSL install prefix (no to disable SSL support) [/usr] : no

Now when you add extension in php.ini, the apache works fine and you are able to use the installed extension.



XAMPP is currently only available as 32 bit application. Please use a 32 bit compatibility library for your system.

Solution - I
If you have latest 64 bit Linux Operating system like recent versions of Ubuntu / Debian / CentOS or Fedora and you want to use older version of php or mysql ( php 5.3 or php 5.4) then you should follow Solution - I.

Older libraries of xampp supports 32 bit operating system so your latest 64 bit operating system is not able to install older xampp.

To make it working install Ubuntu 12.04 LTS or Debian 7.0 in Vmware or Virtualbox
or 
Download ubuntu 12.04 docker image and install xampp inside it, it is faster solution and will not occupy too much RAM.

Solution - II
If your xampp was working fine and suddenly it has started giving this error then this solution is for you

Most common reason of this error, you have added an extension in xampp and after adding it in php.ini, the lampp is not getting started. You are getting following error :

XAMPP is currently only available as 32 bit application. Please use a 32 bit compatibility library for your system.

Here is the solution for you.

Comment following code in the file /opt/lampp/lampp

#case `uname -m` in
#    *_64)
#    if $XAMPP_ROOT/bin/php -v > /dev/null 2>&1
#    then
#        :
#    else
#        $GETTEXT -s "XAMPP is currently only availably as 32 bit application. Please use a 32 bit compatibility library for your system."
#        exit 1
#    fi
#    ;;
#esac


Now restart xampp and you should not get above error.

If still there is error and it was because of new installed extension, I would suggest to comment the extension .so line in php.ini and restart xampp.

You can see the solution in the following video.
 


Error : pecl/pecl_http requires PHP (version >= 7.0.0), installed version is 5

Not able to install STOMP extension in XAMPP

Solution :

Current stable version of stomp is 2.0 which supports php 7.0, 
if we run

pecl install stomp
or
/opt/lampp/bin/pecl install stomp

it installs stomp-2.0 by default which needs php 7.0 so we need to install stomp which supports php 5.x,


Run :
pecl install stomp-1.0.9
or
/opt/lampp/bin/pecl install stomp-1.0.9

Stomp 1.0.9 is for php 5.x versions.
Now you should not get php version error.

Tuesday, November 7, 2017

phpmyadmin exporting html in place of sql

Solution :

Add/Uncomment following attribute in php.ini

max_input_vars = 5000
Restart Apache.

FATAL: Peer authentication failed for user "postgres"

psql dump database from other user without loginto postgres user

$ whoami
ubuntu

$ pg_dump -U postgres dbname > db.sql
FATAL:  Peer authentication failed for user "postgres"


Solution :

sudo nano /etc/postgresql/9.4/main/pg_hba.conf

Change

local   all             postgres                                peer
to
local   all             postgres                                trust


Restart postgresql.

mysqli::mysqli(): Headers and client library minor version mismatch. Headers:50552 Library:100120


In centos or fedora, If you are facing above error.

Solution :


yum remove php56w-mysql

yum install php56w-mysqlnd

I used php56  in command as I installed php with php56 package because I wanted php 5.6 on my server. If you have installed php using simple php or php5 command, remove php-mysql or php5-mysql package and install php-mysqlnd or php5-mysqlnd.

Restart apache and verify the issue. It should be fixed.

Error: EACCES: permission denied, mkdir 'node_modules/node-sass'



Unable to save binary /usr/lib/node_modules/node-sass/vendor/linux-x64-57 : { Error: EACCES: permission denied, mkdir '/usr/lib/node_modules/node-sass/vendor'
    at Object.fs.mkdirSync (fs.js:891:18)
    at sync (/usr/lib/node_modules/node-sass/node_modules/mkdirp/index.js:71:13)
    at Function.sync (/usr/lib/node_modules/node-sass/node_modules/mkdirp/index.js:77:24)
    at checkAndDownloadBinary (/usr/lib/node_modules/node-sass/scripts/install.js:111:11)
    at Object.<anonymous> (/usr/lib/node_modules/node-sass/scripts/install.js:154:1)
    at Module._compile (module.js:573:30)
    at Object.Module._extensions..js (module.js:584:10)
    at Module.load (module.js:507:32)
    at tryModuleLoad (module.js:470:12)
    at Function.Module._load (module.js:462:3)



You are trying these commands in project directory
sudo npm install node-sass
or
npm install node-sass
and it is giving above error and module is not getting installed.

Solution :

sudo chmod -R 777 projectfolder
Now it has sufficient permission to create files inside it. 
Do not use sudo with npm, it does not need root access to install package(module).
Now Run :
npm install node-sass
Now it will be installed. You can give correct permission to folder and files again, 777 is a security breach. We just made it for installing this module.

Magento Installation Error : set always_populate_raw_post_data to -1

Magento Installation Error :

PHP Settings Check * Need Help? PHP Documentation Your PHP Version is 5.6.30, but always_populate_raw_post_data = 0. $HTTP_RAW_POST_DATA is deprecated from PHP 5.6 onwards and will be removed in PHP 7.0. This will stop the installer from running. Please open your php.ini file and set always_populate_raw_post_data to -1. If you need more help please call your hosting provider.

Solution :
 Open .htaccess file of magento and add line php_value always_populate_raw_post_data -1 between tags <IfModule mod_php5.c> and </IfModule>

<IfModule mod_php5.c>    php_value always_populate_raw_post_data -1
</IfModule>


Now Try to install again. You should not get same error again.

Monday, October 2, 2017

Convert Text into Hexadecimal and Hexadecimal into Text on command line


Convert Text into Hexadecimal using command line :
printf "linux is awesome" | xxd

or

echo -n "linux is awesome" | od -A n -t x1


Convert Hexadecimal into Text using command line:
echo "6c 69 6e 75 78 20 69 73 20 61 77 65 73 6f 6d 65" | xxd -r -p && echo ""

Monday, September 4, 2017

No PostgreSQL clusters exist; see "man pg_createcluster"

Solution :

Run commands :
dpkg-reconfigure locales

pg_createcluster 9.3 main --start
or
pg_createcluster 9.4 main --start
or
pg_createcluster 9.5 main --start
(depends on your postgresql version.)

Ubuntu Apache php error : Class 'NumberFormatter' not found

Solution :

Install Package :
apt-get install php5-intl
or
apt-get install php-intl


Make sure intl.so file is generated and it is defined as an extension in .ini file.

Tuesday, August 15, 2017

Regression testing of Web Application using Automation

Human beings try to explore new things that's why they do not want to do same work again and again. It is in their jeans, deep inside. The similar work appears monotonous for them. 

Regression testing is something that no tester wants to do and when developer tries to fix a bug and breaks a functionality which was working absolutely fine before, this condition disturbs a tester psychologically. It increases irritation and makes a tester annoyed, impatient and angry.

But for automation, it is a different story. The tools do not feel bad if you assign them same task again and again. That's why a script is a best friend of a tester whose work is regression.

If you want to do automation testing, the first tool comes in mind is Selenium. Definitely it gives the result efficiently and it is quite flawless. Big companies are using it as their primary testing tool and testers who are seeking good career opportunities are trying to learn it as fast as possible but it is not the only tool which can give you automation results.

Today I am going to discuss two less used web application automation test tools.

First is CURL yes you heard right, I am not joking. If you enjoy working on terminal and you like scripting, curl is one of the best tool to achieve regression testing task. It is so efficient that hacker started using to manipulate data that's why many big sites have blocked it.

How to do regression testing using CURL
1. Create a curl command for login or registration what you want to test by passing valid data with valid method like POST or GET.
If your form uses cookies, you can save and reuse again in CURL.

Example :
curl -c cookie.txt -d "LoginName=someuser" -d "password=somepass" https://oursite/a 

curl -b cookie.txt https://oursite/myaccount


2. You can use this command in BASH script and after running the script new user will be registered or existing user will be logged in successfully.

3. You can achieve login protected task like edit profile, create category, edit tasks, schedule tasks using CURL. You need to make script for each task and while regression, you do not need to do it again and again manually

A failed script is enough to notify that functionality is broken. Not only it will be efficient but it will save your time too.

Second one is JMETER. You must be thinking that we are not talking about performance testing, first we should achieve a working functionality. You can use JMETER for functionality testing too. It has a UI interface so it is quite easier than CURL.

How to do regression testing using JMETER
1. Record a script of functionality like login or registration.
2. Save the test plan as .jmx file 
Now this is a script which you can use in regression testing.

Jmeter has cookie manager using it you can achieve cookie based login to test login protected functionlity. Using regular expression extractor, you can test CSRF based login functionality or pass dynamic values by storing them in variables. Using csv set config, you can run data driven tests as well as parametrization can be done. Not only REST API and LDAP tasks but you can perform all types of java based web application functionality testing tasks.

This is very little that I have listed advantages of JMETER, once you start using it, you will come to know that it is fine tool to perform regression testing. 

Tutorials to Learn Jmeter : 
https://www.youtube.com/watch?v=f6AvTKLrD8A
https://www.youtube.com/watch?v=KgKtM48ujxQ
https://www.youtube.com/watch?v=LLTZG6tbyC8
https://www.youtube.com/watch?v=EdABL-1Z1qU
https://www.youtube.com/watch?v=hlnjD650oMY

Friday, August 11, 2017

Copy files into sd card which is mounted as mtp on Linux Command ine

mtp is media transfer protocol. These devices are mounted in /run/user/$UID/gvfs/mtp*

/run/user/0/gvfs/mtp\:host\=%5Busb%3A002%2C075%5D/Internal\ storage/Documents/

we can copy into this location


just use back slash (\) before spaces in file name (if you have spaces)) in cp command.


Similar way, you can use scp to copy from remote location

Examples :
cp /root/Documents/perl.pdf /run/user/0/gvfs/mtp\:host\=%5Busb%3A002%2C075%5D/Internal\ storage/Documents

or

scp 192.168.0.99:/root/Documents/perl.pdf  /run/user/0/gvfs/mtp\:host\=%5Busb%3A002%2C075%5D/Internal\ storage/Documents/


Zurmo CRM Error - Notice: Undefined property: WebApplication::$minScript in app/protected/core/views/PageView.php

If you are trying to open zurmo using url and not able to open because of following errors

Notice: Undefined property: WebApplication::$minScript in zurmo/app/protected/core/views/PageView.php on line 268

Fatal error: Call to a member function generateScriptMap() on a non-object in zurmo/app/protected/core/views/PageView.php on line 268


Solution :

Remove content of runtime Folder.

sudo rm -r zurmo/app/protected/runtime/*

Now try to open it again. You should not get the error now.

Monday, July 3, 2017

Convert Text file into pdf on Linux command line

Create a small size pdf file from a text file

First install enscript on linux system.

Debian/Ubuntu
apt-get install enscript


CentOS/Fedora
yum install enscript


Command to convert text file into pdf
enscript -B /path/of/text-file.txt -o - | ps2pdf - "/path/of/output.pdf"

-B is for not printing header on top of the pdf pages

Thursday, June 8, 2017

Mongodb secondary database - database list and collection is not visible

MongoDB secondary replica does not have collections as in primary

Error : 
"$err" : "not master and slaveOk=false", "code" : 13435

Solution :
serverdb:SECONDARY> rs.slaveOk()

Running Command rs.slaveOk() on secondary instance is the solution.

Thursday, May 18, 2017

Mysql installation conflict with mariadb

Error :
Renaming removed key_buffer and myisam-recover options (if present)


mysql_upgrade: Got error: 1524: Plugin 'unix_socket' is not loaded while connecting to the MySQL server


Upgrade process encountered error and will not continue.
mysql_upgrade failed with exit status 11


dpkg: error processing package mysql-server-5.7 (--configure):subprocess installed post-installation script returned error exit status 1


Errors were encountered while processing:mysql-server-5.7


Solution :
If you have installed MariaDB and then you have removed it to install mysql. This can be the cause of this issue. If you try to purge all old config filess and set everything up from scratch then it should work. 

Take Back up your important data before doing it.

# sudo apt purge mysql-client-5.7 mysql-client-core-5.7 mysql-common mysql-server-5.7 mysql-server-core-5.7 mysql-server
# sudo apt update 
# sudo apt dist-upgrade && sudo apt autoremove && sudo apt -f install
# sudo apt install mysql-server

Saturday, April 8, 2017

Odoo - Remove Manage Databases link from Login page

Odoo - Remove Powered by Odoo Text from Login page

Edit file addons/web/views/webclient_templates.xml
sudo nano /opt/odoo/addons/web/views/webclient_templates.xml

Remove or Comment text "Manage Databases" and "Powered by Odoo".


Now you tried to restart the odoo server but you are not able to see your changes on the browser.

Here you need to load the web module because you ahve changed content in the file of web module. Without loading web module, you will not be able to see your changes. Restarting Odoo does not load the web module.


sudo -S su postgres -c "./odoo-bin start --update=web"

--update=all loads all modules but we need to reload only web module to see the changes. Now changes will be visible.

Sunday, March 12, 2017

mysql - select query denied error

select command denied to user ''@'' for table ''

Solution :

You are getting this error because you are logged into the mysql user account where Select_priv is set as N for the user.

If you are able to modify your own privileges that is really good (Generally this can't be done because of security) otherwise you need to login with super user and need to set this privilege as Y.

Run this query :

update user set Select_priv = 'Y' where User = 'username';

Changes will not take effect after running this query. You will have to flush privileges.

Run Query :

FLUSH PRIVILEGES;

After flushing privileges, if still you face denied error for select query, Log out from mysql, Log in again with same user and running select query again.
You will not get the error.

If you get same denied error for Insert, Update and Delete queries, you need to set them as Y using same method.

Restarting mysql does the job but every time you do not have command line access to restart it that's why you need to flush privileges.

Friday, February 3, 2017

Magento - No trailing slash appears after domain name

Magento - js/css/image files are not loading because no trailing slash appears after domain name

No trailing slash after domain makes all js/css/skin/media urls 404.

Solution :
Give trailing slash in domain name in column web/unsecure/base_url and web/secure/base_url of table  core_config_data.


http://domainname/

Even if problem persists, login as admin.


Go to system > cache management
Flush all cache including 'flush magento cache' and 'flush cache storage'.


Now open site url. You should not get this issue.

Monday, January 9, 2017

Composer is getting stuck on installing dependencies

 php composer update stuck

Solution :

a) Download and Install updated composer
https://www.digitalocean.com/community/tutorials/how-to-install-and-use-composer-on-ubuntu-14-04

b) Use update command with verbose mode
composer -vvv update
It will display every single output and you will not be impatient.

Friday, December 9, 2016

ssh error - Agent admitted failure to sign using the key


Solution : 1

ssh login using command

SSH_AUTH_SOCK=0 ssh server-ip

Example : SSH_AUTH_SOCK=0 ssh username@192.168.0.xx


Solution : 2

Run Command
ssh-add

Ubuntu Boot Error - Fixing Recursive Fault Issue


Solution :

sudo nano /etc/default/grub
Change the line
GRUB_CMDLINE_LINUX_DEFAULT=”quiet splash” 
to
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash acpi=off"
And then update grub
sudo update-grub

Monday, November 14, 2016

PHP Parse error: syntax error, unexpected '$value' (T_VARIABLE)

PHP Parse error:  syntax error, unexpected '$value' (T_VARIABLE)

If you are getting this error for specific php keywords used in code like yield, you need to upgrade your php version. May be you have php 5.4 or lower version, upgrade it to php 5.5 or php 5.6 or higher.

PHP Fatal error: Call to undefined function mb_strpos()


Solution :

php-mbstring package is not installed on your Linux distribution.

Install it.

If you are using Debian or Ubuntu
sudo apt-get install libapache2-mod-php5
If you are using Fedora or CentOS
yum install php-mbstring

Restart apache and try again.

date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone.

Set following value in php.ini file


date.timezone = 'Asia/Kolkata'

It depends on your timezone. Set your timezone in php.ini
You may face this error if this line is commented.

Restart Apache and try again.

SQLSTATE[HY000]: General error: 1364 Field doesn't have a default value

Solution :

Go on mysql prompt and run following command.


mysql> SET GLOBAL sql_mode=''

Make sure no value has been set for attribute sql_mode in the file my.cnf.

Monday, October 10, 2016

mysql default current_timestamp error

The DEFAULT CURRENT_TIMESTAMP support for a DATETIME (datatype) was added in MySQL 5.6.

It is now possible to achieve this with DATETIME fields since MySQL 5.6.5

Previous versions can't do that with DATETIME.But you can do it with TIMESTAMP.


Upgrade your mysql with this version and you will not get this error again.

Ubuntu : apt-get upgrade : ubuntu The following packages have been kept back

Solution :

To solve this issue, Run command :

sudo apt-get dist-upgrade

Ubuntu 16.04 - Enable ssh root login

Steps :

a) Edit file /etc/ssh/sshd_config
sudo nano /etc/ssh/sshd_config

b) Change following attribute.
FROM:
PermitRootLogin prohibit-password
TO:
PermitRootLogin yes


c) sudo service ssh restart

gitlab large size files push issue

error: RPC failed; result=22, HTTP code = 413
fatal: The remote end hung up unexpectedly, gitlab large file size push issue

Steps :

1) Upgrade gitlab with latest version. Right now current version is 8.12.4

2) Increase file size in /etc/gitlab/gitlab.rb under nginx section.
  nginx['enable'] = true
  nginx['client_max_body_size'] = '250m'


3) Increase max attachment size in http://gitlab.domain/admin/application_settings


4) Reconfigure gitlab and restart system.

Tuesday, September 6, 2016

Netbeans : Next button of installer is not working

If you are trying to install Netbeans on Ubuntu 15.10 and Next button of the installation wizard is disabled so you are not able to install Netbeans. Here is the solution for you.

Install : oracle-java8-installer to solve above issue

sudo apt-add-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer

Now try to install Netbeans again. Next button of the wizard should be enabled now.

Friday, August 5, 2016

windows 7 and ubuntu dual boot : windows 7 boots in background but showing distorted screen of ubuntu

If you have installed Windows 7 and Ubuntu as a dual boot and when you boot windows 7, it loads a distorted screen of Ubuntu although you can hear the windows 7 start up sound but you are not able to do anything because nothing is displayed.

Here is the solution.
sudo nano /etc/default/grub
Now Uncomment following line.
GRUB_TERMINAL="console"

Update the grub.
sudo update-grub

Restart your system.
sudo reboot

Thursday, August 4, 2016

ejabberd Error : large number of users are crashing ejabberd

CRASH REPORT Process  with 0 neighbours exited with reason: {process_limit,{max_queue,}} in p1_fsm:terminate/8 line

CRASH REPORT Process <0.645.0> with 0 neighbours exited with reason: {process_limit,{max_queue,2706}} in p1_fsm:terminate/8 line 755

Solution : 1
May be, you have added all your users under one shared roster group. If you remove the group, you will not get the error again.

But if you remove the shared roster group, your users will not be able to see the other users in client like pidgin.
 
If you create multiple shared roster groups, Users of one group will not be able to see users of other group so they can not chat with each other. Bad Idea.

Solution : 2
In your shared roster group, you might have used @all@ parameter to add all users in one group. ejabberd is trying to list all users at once and it is crashing in this process.

You can change @all@ to @online@. Now ejabberd lists all online users only and this is definitely less than total number of users. In this condition ejabberd has less load and chances of crashing is less too.

But you have really a big database and you have 2000-3000 users are online simultaneously, then you should try solution 3.


Solution : 3
Add attribute
max_fsm_queue: 10000
under section port 5222: in the ejabberd.yml config file in following way
listen:
-
    port: 5222
    module: ejabberd_c2s4
    certfile: "/home/ubuntu/ejabberd-16.06/conf/server.pem"
    starttls: true
    resume_timeout: 0
    protocol_options:
      - "no_sslv3"
    max_stanza_size: 65536
    shaper: c2s_shaper
    access: c2s
    max_fsm_queue: 10000
  Restart ejabberd.

You should not get this error again.

Ubuntu boot error : fixing recursive fault but reboot is needed


While booting ubuntu, you are not able to reach upto Login screen. It appears with long list of errors and finally you get "fixing recursive fault but reboot is needed"

Solution :
Boot ubuntu in recovery mode and open command prompt
Now edit following grub file.


sudo nano /etc/default/grub
Change the line

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash" 
to
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash acpi=off"
sudo update-grub
sudo reboot

You should not get the error again and Login screen should be opened successfully.

Friday, July 8, 2016

ejabberd : Other users are not visible after login


Uncomment line

{mod_shared_roster,[]},

in config file of ejabberd and restart ejabberd.

config file - /etc/ejabberd/ejabberd.cfg 

Now you can see option "shared roster group".

Create a group and add users in the group. You can see all users of same group after login.