Category Archives: Linux

Linux being one of the most widely used system now a days we shared tips here which user may find useful
The commands and tricks being shared are already implemented on production servers
which you can use without any worries.

Strict standard error in PHP

While working on one of clients website after migration from PHP 5.3 to PHP 5.6

I would see the error on “[01-Jul-2016 02:18:54 America/Chicago] PHP Strict Standards:  Declaration of Countries::getAttribute() should be compatible with CActiveRecord”

On googling around I could see the issue was fixed by making changing few settings in php.ini

Add & ~E_STRICT to the end of the active error reporting line. For example, if your current setting is:

error_reporting = E_ALL & ~E_NOTICE & ~E_DEPRECATED

You would change it to read:

error_reporting = E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT

and restart httpd

This will fix the issue.

 

 

An installation already exists softacalous

While working on one server with cpanel I was facing this error

where I was getting “An installation already exists softacalous” while installing an application via softacalous

Where as in Softacalous I could not see any application installed.

While debugging I  found the error was occuring from  in file

/home/username/ .softaculous/ installations.php

I went ahead and truncated it and fixed this issue

 

How-To disable IPv6 on RHEL6 / CentOS 6 / etc

Proper way of disabling IPv6 subsytem in RedHat Linux 6 / CentOS 6 (dont unload modules or so)

in /etc/sysctl.conf  :  net.ipv6.conf.all.disable_ipv6 = 1

in /etc/sysconfig/network  : NETWORKING_IPV6=no

in /etc/sysconfig/network-scripts/ifcfg-eth0 : IPV6INIT=”no”

disable iptables6 – chkconfig –level 345 ip6tables off

reboot

done

 

Without reboot it can be done using below command to disable IPV6

root@host121 [~]# echo 1 > /proc/sys/net/ipv6/conf/all/disable_ipv6
root@host121 [~]# echo 1 > /proc/sys/net/ipv6/conf/default/disable_ipv6

 

However on reboot will need to run same command again as it will revert back to original settings.

 

 

 

Apache Issue

“Secure Connection Failed

An error occurred during a connection to realtrafficsource.com. The OCSP server suggests trying again later. Error code: SEC_ERROR_OCSP_TRY_SERVER_LATER

The page you are trying to view cannot be shown because the authenticity of the received data could not be verified.
Please contact the website owners to inform them of this problem.”

Solution:

Login in server and restart Apache.

 

Find GPU or Graphical processing Unit in Linux

While working on one of the issue we need to check if GPU is installed

We got it using below command which shows type of CPU installed in cli mode

[root@localhost ~]# lspci -vnn | grep VGA -A 12
07:0b.0 VGA compatible controller [0300]: ASPEED Technology, Inc. ASPEED Graphics Family [1a03:2000] (rev 10) (prog-if 00 [VGA controller])
Subsystem: QUANTA Computer Inc Device [152d:897a]
Flags: medium devsel, IRQ 10
Memory at df800000 (32-bit, non-prefetchable) [size=8M]
Memory at df7e0000 (32-bit, non-prefetchable) [size=128K]
I/O ports at ec00 [size=128]
Expansion ROM at <unassigned> [disabled]
Capabilities: [40] Power Management version 3

We could see our server had  ASPEED Technology, Inc. ASPEED Graphics card installed

 

Find the Model Number of Network Card in Linux

To find the model number of Network Interface Card installed in your Machine, you can use the lspci command. lspci command will list all detected PCI or PCIe hardware devices installed on your machine. So in order to find only network cards, you can run following command:

We got it using below command on our linux server

[root@localhost ~]# lspci | grep -i “Ethernet”
06:00.0 Ethernet controller: Intel Corporation 82576 Gigabit Network Connection (rev 01)
06:00.1 Ethernet controller: Intel Corporation 82576 Gigabit Network Connection (rev 01)

We see the ethernet card installed is  Intel Corporation 82576 Gigabit Network

Installing lspci on CentOS

lspci module is not installed on linux os by default

you need to use below steps to install it

[root@localhost ~]# yum install pciutils
Loaded plugins: fastestmirror
Setting up Install Process
Loading mirror speeds from cached hostfile
* base: yum.tamu.edu
* extras: mirrors.cmich.edu
* openvz-kernel-rhel6: openvz.jetfire.io
* openvz-utils: openvz.jetfire.io
* updates: centos.mia.host-engine.com
Resolving Dependencies
–> Running transaction check
—> Package pciutils.x86_64 0:3.1.10-4.el6 will be installed
–> Finished Dependency Resolution

Dependencies Resolved

========================================================================================================================================================================
Package Arch Version Repository Size
========================================================================================================================================================================
Installing:
pciutils x86_64 3.1.10-4.el6 base 85 k

Transaction Summary
========================================================================================================================================================================
Install 1 Package(s)

Total download size: 85 k
Installed size: 180 k
Is this ok [y/N]: y
Downloading Packages:
pciutils-3.1.10-4.el6.x86_64.rpm | 85 kB 00:00
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : pciutils-3.1.10-4.el6.x86_64 1/1
Verifying : pciutils-3.1.10-4.el6.x86_64 1/1

Installed:
pciutils.x86_64 0:3.1.10-4.el6

Complete!

The module is necessary to check of ethernet or graphics card installed in cli mode

 

 

How to install FFmpeg & PHP-FFmpeg on cPanel

By Default ffmpeg rpms are not added in centos yum repositories

a new repository will have to be added to install ffmpeg

For centos6 64bit OS

run below commands,

wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm
rpm -ivh rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm

Once done

# yum install ffmpeg ffmpeg-devel

This will install ffmpeg on server

Now once this is done

you will need to install ffmpeg-php for php to recognize ffmpeg

Below are the steps

#wget http://sourceforge.net/projects/ffmpeg-php/files/ffmpeg-php/0.6.0/ffmpeg-php-0.6.0.tbz2

# tar -xvf  ffmpeg-php-0.6.0.tbz2

#cd ffmpeg-php-0.6.0

#phpize

#./configure

#make && make install

now you need to add ffmpeg.so module in php.ini

add   extension=ffmpeg.so and restart httpd

You can check for ffmpeg in phpinfo page

 

 

Note: You may get error ” error: ‘new_le’ undeclared (first use in this function)” while running make command

You need to make modification in below file ffmpeg_movie.c which is in ffmpeg-php-0.6.0

 

Changes in ffmpeg_movie.c:

  • row 311: list_entry *le; to zend_rsrc_list_entry *le;
  • row 346: list_entry new_le; to zend_rsrc_list_entry new_le;
  • row 360: hashkey_length+1, (void *)&new_le, sizeof(list_entry), to hashkey_length+1, (void *)&new_le,sizeof(zend_rsrc_list_entry),

 

 

enable PPP Module to a VPS on OpenVZ

To enable PPP on a Openvz VM

First you need to check for modules in main node

# lsmod | grep ppp

[root@hostonline ~]# lsmod | grep ppp
pppoatm 4677 0
atm 48487 1 pppoatm
zlib_deflate 21629 1 ppp_deflate
ppp_mppe 6182 0
ppp_generic 25763 4 pppoatm,ppp_async,ppp_deflate,ppp_mppe
slhc 5813 1 ppp_generic

We see below modules missing in results so we enable it on main node using

# modprobe ppp_async
# modprobe ppp_deflate
(In Below example 110 is VM ID / VPS ID )
  vzctl stop 110
 vzctl set 110 –features ppp:on –save
vzctl start 110
vzctl set 110 –devices c:108:0:rw –save
vzctl exec 110 mknod /dev/ppp c 108 0
vzctl exec 110 chmod 600 /dev/ppp
vzctl enter 110
To check whether PPP is enabled or not:

Vps# /usr/sbin/pppd

You should see gibberish in the standard output like
~�}#�!}!}!} }4}”}&} } } } }%}&)Q�}4}’}”}(}”p})

W [FATAL] – Your RPM database appears unstable. It is not possible at the moment to install a simple RPM.

While working on a cpanel server was getting below error

“W [FATAL] – Your RPM database appears unstable. It is not possible at the moment to install a simple RPM”

root@server1 [~]# /scripts/upcp –force
—————————————————————————————————-
=> Log opened from cPanel Update (upcp) – Slave (20610) at Wed Nov 18 23:52:35 2015
[2015-11-18 23:52:35 -0500] Detected cron=0 (–force passed on command line)
[2015-11-18 23:52:35 -0500] 1% complete
[2015-11-18 23:52:35 -0500] Running Standardized hooks
[2015-11-18 23:52:35 -0500] 2% complete
[2015-11-18 23:52:35 -0500] mtime on upcp is 1444896548 (Thu Oct 15 04:09:08 2015)
—————————————————————————————————-
=> Log opened from /usr/local/cpanel/scripts/updatenow (20613) at Wed Nov 18 23:52:35 2015
[2015-11-18 23:52:35 -0500] Detected version ‘11.52.0.22’ from version file.
[2015-11-18 23:52:35 -0500] Running version ‘11.52.0.22’ of updatenow.
[2015-11-18 23:52:35 -0500] –force passed on command line. Upgrade will disregard update config settings.
[2015-11-18 23:52:35 -0500] Using mirror ‘67.222.0.10’ for host ‘httpupdate.cpanel.net’.
[2015-11-18 23:52:35 -0500] Successfully verified signature for cpanel (key types: release).
[2015-11-18 23:52:36 -0500] Target version set to ‘11.52.1.2’
[2015-11-18 23:52:36 -0500] Switching to 11.52.1.2 to determine if we can reach that version without failure.
[2015-11-18 23:52:36 -0500] ***** FATAL: Failed to download updatenow.static from server: The system cannot update the /var/cpanel/sysinfo.config file. at /usr/local/cpanel/Cpanel/GenSysInfo.pm line 101.
[2015-11-18 23:52:36 -0500] The Administrator will be notified to review this output when this script completes
=> Log closed Wed Nov 18 23:52:36 2015
[2015-11-18 23:52:36 -0500] 17% complete
=> Log closed Wed Nov 18 23:52:36 2015
—————————————————————————————————-
=> Log opened from /usr/local/cpanel/scripts/maintenance (20635) at Wed Nov 18 23:52:36 2015
[2015-11-18 23:52:36 -0500] 21% complete
[2015-11-18 23:52:36 -0500] Purging cpupdate.conf of invalid entries
[2015-11-18 23:52:36 -0500] Processing: Assuring needed symlinks in 3rdparty/bin are in place.
[2015-11-18 23:52:36 -0500] – Processing command `/usr/local/cpanel/scripts/link_3rdparty_binaries`
[2015-11-18 23:52:36 -0500] Processing: Setting clock
[2015-11-18 23:52:36 -0500] – Processing command `/usr/local/cpanel/scripts/rdate`
[2015-11-18 23:52:36 -0500] 22% complete
[2015-11-18 23:52:36 -0500] Processing: Updating cPanel signing keys.
[2015-11-18 23:52:36 -0500] – Processing command `/usr/local/cpanel/scripts/updatesigningkey`
[2015-11-18 23:52:36 -0500] 23% complete
=> Log closed Wed Nov 18 23:52:36 2015
—————————————————————————————————-
=> Log opened from cPanel Update (upcp) – Slave (20610) at Wed Nov 18 23:52:36 2015
[2015-11-18 23:52:36 -0500] E Maintenance ended, however it did not exit cleanly (256). Please check the logs for an indication of what happened
[2015-11-18 23:52:36 -0500] 95% complete
[2015-11-18 23:52:36 -0500] Running Standardized hooks
[2015-11-18 23:52:36 -0500] 100% complete
[2015-11-18 23:52:36 -0500]
[2015-11-18 23:52:36 -0500] cPanel update completed
[2015-11-18 23:52:36 -0500] A log of this update is available at /var/cpanel/updatelogs/update.1447908755.log
[2015-11-18 23:52:36 -0500] Removing upcp pidfile
[2015-11-18 23:52:36 -0500] W NOTE: A system upgrade was not possible due to the following blockers:
[2015-11-18 23:52:36 -0500] W [FATAL] – Your RPM database appears unstable. It is not possible at the moment to install a simple RPM.
=> Log closed Wed Nov 18 23:52:36 2015

 

[2015-11-18 23:52:36 -0500] W NOTE: A system upgrade was not possible due to the following blockers:
[2015-11-18 23:52:36 -0500] W [FATAL] – Your RPM database appears unstable. It is not possible at the moment to install a simple RPM.
=> Log closed Wed Nov 18 23:52:36 2015

The issue was due to corrupt RPM database

Below is the fix which is used

root@server1 [~]# mkdir /root/old_rpm_dbs/

root@server1 [~]# mv /var/lib/rpm/__db* /root/old_rpm_dbs/

root@server1 [~]# rpm –rebuilddb

root@server1 [~]# /scripts/upcp –force

Now upcp is working fine without any errors 🙂