Howto: Check Apache Connections

October 1, 2009    |   Posted by admin   |    Category: Linux Administration

How to check number of connections to the Apache server?

netstat command will show you the accurate connections to each of your service. In order to check the number of connections to port 80, use the netstat command and grep the Apache port.

List the connections to port 80:

netstat -alntp | grep :80

To check the number of connections to port 80:

netstat -alntp | grep :80 | wc -l

List the remote IPs connecting to your server on port 80:

netstat -alntp | grep :80 | awk ‘{print $5}’ | cut -d: -f1 | sort

List the uniq remote IPs and the number of connections from each IP:

netstat -alntp | grep :80 | awk ‘{print $5}’ | cut -d: -f1 | sort | uniq -c | sort -n

Please note: If you copy paste the above commands on your server, the single quote around the {} brackets may change to dots (.) and the command will fail, so make sure you replace those dots with the singe quote and execute the command.

vzquota : (error) Quota is running, stop it first

October 1, 2009    |   Posted by admin   |    Category: VPS Management

If you receive the error message “vzquota : (error) Quota is running, stop it first” while restarting a VPS, you will first have to turn off it’s quota and then drop it

vzquota off  VEID
vzquota drop VEID

Once done, restart the VPS and it will re-initialize the quota for the VPS and will start the VPS. If the problem persist, remove the /var/vzquota/quota.veid file

rm -f /var/vzquota/quota.veid

and then start the VPS. This should also display the correct disk space used by the VPS.

Comments Off on vzquota : (error) Quota is running, stop it first

CSF dropping the packets while dowloading

October 1, 2009    |   Posted by admin   |    Category: cPanel Management

You may have notice packet drops when CSF firewall is enabled and you are downloading something. The only reason is the option

PACKET_FILTER = “1”

By default the “PACKET_FILTER” is ON which drops packets that looks illegal or out of sequence. If it’s generating false alarms and causing the valid packet to drop, you should better turn OFF the option in /etc/csf/csf.conf file

PACKET_FILTER = “0”

Save the file and restart CSF firewall.

Comments Off on CSF dropping the packets while dowloading

Got a packet bigger than ‘max_allowed_packet’ bytes

October 1, 2009    |   Posted by admin   |    Category: cPanel Management, Linux Administration, Plesk Management

“Got a packet bigger than ‘max_allowed_packet’ bytes”

The message is displayed when you try to restore a database and the packet size if more than the default one OR the one defined in the my.cnf file.You can check the existing bytes with the following command

root@server [~]# mysqladmin variables | grep max_allowed_packet
| max_allowed_packet              | 1048576
|

To overcome the issue, add the following parameter in the my.cnf file

max_allowed_packet = 2097152

The value should be more than the default one. Save the file and restart the mysql service.

Comments Off on Got a packet bigger than ‘max_allowed_packet’ bytes

error: PIX_FMT_RGBA32 undeclared

September 30, 2009    |   Posted by admin   |    Category: Linux Administration

The error message “Unable to load dynamic library ‘/usr/lib64/php/modules/ffmpeg.so” is received when you add the ffmpeg.so extension to the PHP configuration file i.e. php.ini file and tries to run PHP. You can easily reproduce the error message by executing “php -v”:

PHP Warning:  PHP Startup: Unable to load dynamic library ‘/usr/lib64/php/modules/ffmpeg.so’ – /usr/lib64/php/modules/ffmpeg.so: undefined symbol: _php_create_ffmpeg_frame in Unknown on line 0

You may also notice the “PIX_FMT_RGBA32” error message while compiling ffmpeg-php

ffmpeg-php-0.5.0/ffmpeg_frame.c:495: error: ‘PIX_FMT_RGBA32′ undeclared (first use in this function)

The above error messages is the result of incorrect function declared in the ffmpeg_frame.c file under the ffmpeg-php-0.x.0 directory.

Solution:

Goto the the ffmpeg-php-0.x.0 directory and edit the ffmpeg_frame.c file

vi ffmpeg-php-0.x.0/ffmpeg_frame.c

Now replace every instance of ‘PIX_FMT_RGBA32’ with ‘PIX_FMT_RGB32’ in the file by executing

:%s/PIX_FMT_RGBA32/PIX_FMT_RGB32

OR

replace “PIX_FMT_RGBA32” “PIX_FMT_RGB32” — ffmpeg_frame.c

Save the file and compile ‘ffmpeg-php’ again using the following steps

cd ffmpeg-php-0.x.0
make clean
./configure
make
make install

Once done, ffmpeg should work along with PHP now.