Error while updating YUM

Posted in VPS/Dedicated server on September 18, 2012 by Aparna Murthy

Today While updating yum on one of the server I  face the error as below ::

=============================================================

[root@323191 yum.repos.d]# yum update
Loaded plugins: fastestmirror
Setting up Remove Process
No Match for argument: epel
Loading mirror speeds from cached hostfile
Traceback (most recent call last):
File “/usr/bin/yum”, line 29, in <module>
yummain.user_main(sys.argv[1:], exit_code=True)
File “/usr/share/yum-cli/yummain.py”, line 285, in user_main
errcode = main(args)
File “/usr/share/yum-cli/yummain.py”, line 136, in main
result, resultmsgs = base.doCommands()
File “/usr/share/yum-cli/cli.py”, line 438, in doCommands
return self.yum_cli_commands[self.basecmd].doCommand(self, self.basecmd, self.extcmds)
File “/usr/share/yum-cli/yumcommands.py”, line 419, in doCommand
return base.erasePkgs(extcmds)
File “/usr/share/yum-cli/cli.py”, line 861, in erasePkgs
self._checkMaybeYouMeant(arg, always_output=False)
File “/usr/share/yum-cli/cli.py”, line 647, in _checkMaybeYouMeant
matches = self.doPackageLists(patterns=[arg], ignore_case=False)
File “/usr/lib/python2.6/site-packages/yum/__init__.py”, line 2327, in doPackageLists
avail = self.pkgSack.returnNewestByNameArch(patterns=patterns,
File “/usr/lib/python2.6/site-packages/yum/__init__.py”, line 897, in <lambda>
pkgSack = property(fget=lambda self: self._getSacks(),
File “/usr/lib/python2.6/site-packages/yum/__init__.py”, line 682, in _getSacks
self.repos.populateSack(which=repos)
File “/usr/lib/python2.6/site-packages/yum/repos.py”, line 265, in populateSack
self.doSetup()
File “/usr/lib/python2.6/site-packages/yum/repos.py”, line 92, in doSetup
self.ayum.plugins.run(‘postreposetup’)
File “/usr/lib/python2.6/site-packages/yum/plugins.py”, line 184, in run
func(conduitcls(self, self.base, conf, **kwargs))

=============================================================

Resolution ::

Open File: /etc/yum/pluginconf.d/fastestmirror.conf

vi /etc/yum/pluginconf.d/fastestmirror.conf

Change enabled=1 TO enabled=0

and Fire command

[root@323191 yum.repos.d]# yum clean all
[root@323191 yum.repos.d]# yum update
It should be fixed 🙂 🙂 🙂

How to Install FFmpeg on CentOS via Yum

Posted in Apache, VPS/Dedicated server on September 18, 2012 by Aparna Murthy

The easiest way to install FFMPEG and other modules is through yum. Following are the steps given to install ffmpeg with yum command.

First we will have to install the DAG RPM repositories which includes amount of rpm packages. It’s very easy. Just install the latest rpmforge-release package for your distribution and architecture.

This will automatically install the configuration and GPG keys that are for safely installing RPMforge packages.

Please select the correct command from the following list:

* Supported Red Hat Enterprise Linux 5 / i386:

rpm -Uhv http://apt.sw.be/redhat/el5/en/i386/rpmforge/RPMS/rpmforge-release-0.3.6-1.el5.rf.i386.rpm

* Red Hat Enterprise Linux 5 / x86_64:

rpm -Uhv http://apt.sw.be/redhat/el5/en/x86_64/rpmforge/RPMS/rpmforge-release-0.3.6-1.el5.rf.x86_64.rpm

Installing FFMPEG.

yum install ffmpeg ffmpeg-devel

Install FFMPEG-PHP Extension

FFmpeg-php is a very good extension and wrapper for PHP which can pull useful information about video through API interface. Inorder to install it you will need to download the source file and then compile and install extension in your server.

cd /usr/local/src

wget http://downloads.sourceforge.net/project/ffmpeg-php/ffmpeg-php/0.6.0/ffmpeg-php-0.6.0.tbz2?use_mirror=nchc

tar -xjf ffmpeg-php-0.6.0.tbz2

phpize

./configure
make
make install

Once you have done that without any problems then you will see the php extension file /usr/local/lib/php/extensions/no-debug-non-zts-20060613/ffmpeg.so and you will need mention that extension in php.ini file.

vi  /usr/local/lib/php.ini OR /etc/php.ini

Put the below two lines at the end of the php.ini file

[ffmpeg]
extension=ffmpeg.so

Then restart apache using — service httpd restart

Installing Mplayer + Mencoder

Just issue the following yum commands to install the rest of the packages.

yum install mplayer mencoder

Installing FlvTool2

Flvtool2 is a flash video file manipulation tool. It can calculate metadata and can cut and edit cue points for flv files.

If you are on Centos 5 try yum install flvtool2 with dag repository and if you get package not found you will need to manually download and compile the flvtool2. You can download latest version of flvtool2 from:-  http://rubyforge.org/projects/flvtool2/

wget http://rubyforge.org/frs/download.php/17497/flvtool2-1.0.6.tgz

ruby setup.rb config
ruby setup.rb setup
sudo ruby setup.rb install

If you get command not found error, it probably means that you dont have ruby installed. Being a cpanel server you can do that using /scripts/installruby OR yum install ruby

You are done!!!!

How to Install Mod_Pagespeed on Centos+cPanel ?

Posted in Apache, Cpanel/WHM with tags on September 2, 2012 by Aparna Murthy

>> What is mod_pagespeed ?

mod_pagespeed is basically an open-source module for Apache which does the task of optimizing the web-pages and its resources. Its an automated process and makes use of the filters for enhancment of web performance by re-writing the resources. Performance enhancement for
Apache HTTP Server can easily be achieved using the module.
Installation ::

1. Login to your server using root login

2. Before you start the installation, make sure “mod_deflate” is enabled via easy apache.

3. Determine the version of your kernel via the command ::

# uname -a

In my case its a 64 bit version

root@server [~]# uname -ar
Linux server.server.com 2.6.18-028stab099.3 #1 SMP Wed Mar 7 15:20:22 MSK 2012 x86_64 x86_64 x86_64 GNU/Linux
4. Once you deteemind the vesion, Go to the directory ::

root@server [~]# cd /usr/local/src

6. Create a directory mod_pagespeed

root@server [~]# mkdir mod_pagespeed
v# cd mod_pagespeed

7. Now download the source of mod_pagespeed using the link ::

>> Link :: http://code.google.com/speed/page-speed/download.html
>> Go to the link :: https://developers.google.com/speed/docs/mod_pagespeed/download
>> Right click on the “mod_pagespeed 64-bit .rpm (CentOS) and copy the link location

NOTE :: Location is :: https://dl-ssl.google.com/dl/linux/direct/mod-pagespeed-beta_current_x86_64.rpm

8 . Download >>

# root@server [~]# wget https://dl-ssl.google.com/dl/linux/direct/mod-pagespeed-beta_current_x86_64.rpm

9. Install the downloaded RPM ::

# root@server [~]# rpm2cpio mod-pagespeed-beta_current_x86_64.rpm | cpio -idmv

The outpu should be as below ::
root@server [~]rpm2cpio mod-pagespeed-beta_current_x86_64.rpm | cpio -idmv
./etc/cron.daily/mod-pagespeed
./etc/httpd/conf.d/pagespeed.conf
./usr/lib/httpd/modules/mod_pagespeed.so
./var/mod_pagespeed/cache
./var/mod_pagespeed/files
3135 blocks

10. Copy the mod_pagespeed.so to the apache modules ::

root@server [~]# cp /usr/local/src/mod_pagespeed/usr/lib64/httpd/modules/mod_pagespeed.so /usr/local/apache/modules/

And then copy the mod_pagespeed.conf to the apache conf directory ::

root@server [~]# cp /usr/local/src/mod_pagespeed/etc/httpd/conf.d/pagespeed.conf /usr/local/apache/conf/

11. Give permissions ::

root@server [~]# chmod 755 /usr/local/apache/modules/mod_pagespeed.so

12. Create cache files for the mod_pagespeed ::

root@server [~]# mkdir /var/mod_pagespeed/{cache,files} -p

13. Change ownership of cache files ::

root@server [~]# chown nobody:nobody /var/mod_pagespeed/*

>> Mod_pagespeed needs mod_deflate to be loaded in Apache. If it is not loaded tyou can include it using the command below ::
/usr/local/apache/bin/apxs -c -i /home/cpeasyapache/src/httpd-2.2.22/modules/filters/mod_deflate.c

NOTE :: the apache version “httpd-2.2.16” could be change according to your server. In my case its httpd-2.2.22.

14. After that, we’ll have to edit the mod_pagespeed configuration file located at /usr/local/apache/conf/pagespeed.conf to reflect the correct paths,

root@server [~]# vi /usr/local/apache/conf/pagespeed.conf
=================
<IfVersion < 2.4>
LoadModule pagespeed_module /usr/local/apache/modules/mod_pagespeed.so
</IfVersion>
=================

=================
<IfModule !mod_deflate.c>
LoadModule deflate_module /usr/local/apache/modules/mod_deflate.so
</IfModule>
=================

15. After that, we’ll need to include the mod_pagespeed configuration in Apache’s configuration file (/usr/local/apache/conf/httpd.conf):

=================
Include “conf/pagespeed.conf”
=================

In order to keep the changes permanant run the command below ::

root@server [~]#/usr/local/cpanel/bin/apache_conf_distiller –update

This will then ensure that your changes are integrated into the templates which WHM cPanel uses to regenerate the httpd.conf file after an automatic update.

You’re done now restart the apache ::

root@server [~]# service httpd restart

If everything is fine, apache will start normally and as your domains begin to get hits, you will see data being written in to /var/mod_pagespeed/*.

How to install A2billing with Asterisk on Centos 5

Posted in Uncategorized on August 26, 2012 by Aparna Murthy

Asterisk / A2Billing on centos

What is A2Billing

A2Billing is a class 4 and class 5 softswitch with inline billing, designed for providing residential, business and wholesale VoIP services, calling cards.

Prerequisites  ::

>> Centos 5 clean and scratch server with yum installed.

>> First the get version of OS and 64bit/32Bit

You can get the version by following the command below ::

#cat /etc/*release*

>> Kernel  versin using the below command ::

#uname -a

>> disable firewall first. re-enable it later.

# service iptables stop

Initial setup to proceed with installation ::

First Get everything up to date on your server, you can update it via yum using commands below ::

#yum -y upgrade

#yum -y update

#reboot

#yum -y update

Need to install first the required modules on the server  as below ::

If you are server version is [32 bit] (i686) then do follow the command below to install modules ::

#yum -y install gcc gcc-c++ kernel-devel bison openssl-devel libtermcap-devel ncurses-devel doxygen curl-devel newt-devel mlocate lynx tar wget nmap bzip2 mod_ssl crontabs vixie-cron speex speex-devel unixODBC unixODBC-devel libtool-ltdl  libtool-ltdl-devel mysql-connector-odbc mysql mysql-devel  mysql-server php-mysql php-mbstring php-mcrypt flex screen  libxml2 libxml2-devel libtiff libtiff-devel

If you are server version is [64 bit] (x86_64) then do follow the command below to install modules ::

#yum -y install gcc.x86_64 gcc-c++.x86_64 kernel-devel.x86_64 bison.x86_64 openssl-devel.x86_64  libtermcap-devel.x86_64 ncurses-devel.x86_64 doxygen.x86_64 curl-devel.x86_64 newt-devel.x86_64  mlocate.x86_64 lynx.x86_64 tar.x86_64 wget.x86_64 nmap.x86_64 bzip2.x86_64 mod_ssl.x86_64  crontabs.x86_64 vixie-cron.x86_64 speex.x86_64 speex-devel.x86_64 unixODBC.x86_64  unixODBC-devel.x86_64 libtool-ltdl.x86_64 libtool-ltdl-devel.x86_64 mysql-connector-odbc.x86_64 mysql.x86_64 mysql-devel.x86_64 mysql-server.x86_64 php-mysql.x86_64 php-mbstring.x86_64  php-mcrypt.x86_64 flex.x86_64 screen.x86_64 libxml2-devel

#yum -y install libidn-devel krb5-devel krb5-libs zlib-devel libidn-devel

#ln -sf /lib64/libcom_err.so.2 /lib64/libcom_err.so

Done.

NOTE :: A2billing Asterisk required PHP 5.2 or higher.

Now installation of Asterisk ::

#groupadd asterisk
#useradd -c “asterisk PBX” -d /var/lib/asterisk -g asterisk asterisk

#cd /usr/src/

#wget http://downloads.digium.com/pub/asterisk/asterisk-1.6.2.9.tar.gz

#tar -zxvf asterisk-1.6.2.9.tar.gz

#cd asterisk-1.6.2.9

#make clean

#./configure

#make menuselect

(setup what you need in the menu manager,include mysql)

#make

#make install

#make samples

#make progdocs

#make config

#chkconfig asterisk on

#asterisk -vvvvvvvvvvvvvvvvvvvc

#core stop now

#service asterisk start

>> edit the following files in /etc/asterisk:

#nano /etc/asterisk/indications.conf – Change default country (its not manadatory do modification if required )

#nano /etc/asterisk/modules.conf – Uncomment the line ‘preload => res_odbc.so’

#nano /etc/asterisk/modules.conf – Add ‘noload => pbx_ael.so’ to bottom of file

#nano /etc/asterisk/modules.conf – Add ‘noload => codec_dahdi.so’ to the bottom of the file

Now copy and paste the below code to the specified files using the commands as below ::

1.
===============================
# rm /etc/asterisk/extensions.ael

# cat > /etc/asterisk/extensions.conf << EOF

[general]

static=yes

writeprotect=yes

autofallthrough=yes

extenpatternmatchnew=no

clearglobalvars=yes

priorityjumping=no

userscontext=default

[globals]

[default]

exten => _.,1,Goto(i,1)

exten => i,1,NoOp(Invalid)

exten => i,n,Congestion()

exten => i,n,Hangup()

exten => h,1,NoOp(Hanging up)

EOF
================================

2.
================================
# rm /etc/asterisk/extensions.lua

# cat > /etc/asterisk/sip.conf << EOF

[general]

context=default

allowguest=yes

match_auth_username=yes

allowoverlap=no

allowtransfer=no

realm=pbx12.vitell.co.uk

udpbindaddr=0.0.0.0

tcpenable=no

tlsenable=no

srvlookup=yes

pedantic=no

tos_sip=cs3

tos_audio=ef

tos_video=af41

tos_text=af41

cos_sip=3

cos_audio=5

cos_video=4

cos_text=3

maxexpiry=3600

minexpiry=60

defaultexpiry=120

mwiexpiry=3600

qualifyfreq=60

qualifygap=100

qualifypeers=1

vmexten=voicemail

disallow=all

allow=alaw

mohinterpret=default

mohsuggest=default

parkinglot=plaza

language=en

relaxdtmf=yes

useragent=AsteriskPBX

sdpsession=AsteriskPBX

promiscredir=no

dtmfmode=rfc2833

videosupport=no

callevents=no

alwaysauthreject=yes

shrinkcallerid=no

allowsubscribe=yes

subscribecontext=default

notifyringing=yes

notifyhold=yes

notifycid=yes

callcounter=yes

t38pt_udptl=yes,fec,maxdatagram=400

faxdetect=no

nat=no

directmedia=no

directrtpsetup=no

EOF

=======================================

You’re done with Asterisk installation here 🙂 🙂 🙂

Now lets get a2Billing for both asterisk server and Master SQL( just gonna use the sql for sql)

# cd /usr/src

# mkdir a2billing

# cd  a2billing

Download the a2billing source from the link below ::

http://www.asterisk2billing.org/get-started/direct-download/

Click on download, it will download the source at your local computer and then upload it to your server using SFTP.

Once uploaded. extract it ::

tar -zxvf Star2Billing-a2billing-v1-current-0-g95789f5.tar.gz

cd Star2Billing-a2billing-d960375

then move all the files from Star2Billing-a2billing-d960375   to a2billing

#scp -r -p /usr/src/a2billing/Star2Billing-a2billing-d960375/ /usr/src/a2billing/

Extraction done. Then ::

>> On Master SQL Server do the following

# cd /usr/src/a2billing/DataBase/mysql-5.x

# mysql -u root -p < a2billing-createdb-user.sql;

# mysql -u root -p mya2billing < a2billing-mysql-schema-v1.7.0.sql;

We will need to make a new user on the master SQL server that has permissions remotely.

# mysql> CREATE USER ‘a2bMySQL’@’10.10.10.%’ IDENTIFIED BY ‘yourpassdb’;
# mysql> GRANT ALL ON *.* TO ‘a2bMySQL’@’10.10.10.%’;

Mysql database, user adding  and importing the database file is restored.

Now Back to Asterisk Box

#cp /usr/src/a2billing/a2billing.conf /etc/

#nano /etc/a2billing.conf

>> Edit a2billing.conf to  the following

===================================
[database]

hostname = 10.10.10.1

port = 3306

user = a2bMySQL

password = yourpassdb

dbname = mya2billing

dbtype = mysql

===================================

>> Edit the file as below ::

# /etc/asterisk/res_mysql.conf  Or you can find /etc/asterisk/res_config_mysql.conf

# nano /etc/asterisk/res_mysql.conf   Or nano /etc/asterisk/res_config_mysql.conf

===================================
[general]

dbhost = 10.10.10.1

dbname = mya2billing

dbuser = a2bMySQL

dbpass = yourpassdb

;dbport = 3306

dbsock = /var/lib/mysql/mysql.sock
===================================

>> Edit the file as below ::

# nano /etc/asterisk/extconfig.conf

===================================
[settings]

sipusers => mysql,mya2billing,cc_sip_buddies

iaxusers => mysql,mya2billing,cc_iax_buddies

sippeers => mysql,mya2billing,cc_sip_buddies

iaxpeers => mysql,mya2billing,cc_iax_buddies
===================================

>> Once done Fix folder Permissions using commands below ::

#chmod 777 /etc/asterisk

#touch /etc/asterisk/additional_a2billing_iax.conf

#touch /etc/asterisk/additional_a2billing_sip.conf

#echo \#include additional_a2billing_sip.conf >> /etc/asterisk/sip.conf

#echo \#include additional_a2billing_iax.conf >> /etc/asterisk/iax.conf

#chown -Rf apache /etc/asterisk/additional_a2billing_iax.conf

#chown -Rf apache /etc/asterisk/additional_a2billing_sip.conf

>> Copy sound to asterisk folder

#/usr/src/a2billing/addons/sounds/install_a2b_sounds.sh

>> Now Edit the Manger.conf

#nano /etc/asterisk/manager.conf

and add below code ::
==============================================
[myasterisk]

secret=mycode

read=system,call,log,verbose,command,agent,user

write=system,call,log,verbose,command,agent,user

==============================================

and now save and exit the file.

>> Copy AGI files and make executable

#cd /usr/src/a2billing/AGI

#cp a2billing.php /var/lib/asterisk/agi-bin/

#cp -Rf lib /var/lib/asterisk/agi-bin/

#chmod +x /var/lib/asterisk/agi-bin/a2billing.php

#mkdir /var/www/a2billing

#chown apache:apache /var/www/a2billing

#cp -rf /usr/src/a2billing/admin /var/www/a2billing

#cp -rf /usr/src/a2billing/agent /var/www/a2billing

#cp -rf /usr/src/a2billing/customer /var/www/a2billing

#cp -rf /usr/src/a2billing/common /var/www/a2billing

chmod 755 /var/www/a2billing/admin/templates_c

chmod 755 /var/www/a2billing/customer/templates_c

chmod 755 /var/www/a2billing/agent/templates_c

chown -Rf apache:apache /var/www/a2billing/admin/templates_c

chown -Rf apache:apache /var/www/a2billing/customer/templates_c

>> edit apache file that is  /etc/httpd/conf/httpd.conf

#nano /etc/httpd/conf/httpd.conf

find DocumentRoot and chane to below:

===================

DocumentRoot “/var/www/a2billing”

===================

Save and exit the file and restart the apache.

# service httpd restart

Its Done.

Now you can go on your A2billing page  using below link ::

http://yourip/admin/  Here (your ip will be your server ip )

log in  Using the details  below ::

======================
user: root
pass: changepassword
======================

Once logged in Change your login passowrd.

Now lets edit asterisk so the AGI works

# nano /etc/asterisk/extensions.conf

Paste below to the bottom of the file.

====================================
[a2billing]
; CallingCard application
exten => _X.,1,DeadAGI,a2billing.php
exten => _X.,2,Wait,2
exten => _X.,3,Hangup
[did]
; CallingCard application
exten => _X.,1,DeadAGI(a2billing.php|1|did)
Now configure httpd to start on boot
#ntsysv
arrow down to httpd and hit the space bar .tab to ok click enter
====================================

Asterisk will already start on boot 🙂

Errors and troubelshootings ::

Access Denied  while changing the password.

Check the ownership of the /var/lib/php/session  and change it to root.

#chown root.root /var/lib/php/session

Done. Now you can configure the A2billing as per your requiredments.

🙂 🙂 🙂

Error PHP Fatal error: Out of memory (allocated 24641536) (tried to allocate 24381441 bytes) on cPanel server with php scripts

Posted in Cpanel/WHM, PHP/Mysql on May 2, 2012 by Aparna Murthy

Today came across with the memory exhausted error and while investigation note that after increasing the memory in server php.ini file even though increased php memory limit for the particular user as server is suphp enabled, but did not help… 😦 😦

While browsing the site I find the error as below under error logs ::
==========================================
[root@server/home/username/public_html]# tail -f error_log
[01-May-2012 20:45:55] PHP Fatal error:  Out of memory (allocated 24641536) (tried to allocate 24381441 bytes) in /home/username/public_html/filename.php on line 117
==========================================

——————————————————
Soution 1 ::

1. If server is suphp enabled then do as below ::

>> create Or copy server php.ini under public_html as below :

#cp /usr/local/lib/php.ini /home/username/public_html

Then open the php.ini file

# vi  /home/username/public_html/php.ini

Find for the memory_limit parameter and change the value as below :

memory_limit = 32 MB

To

memory_limit = 64 MB

Save the file.

>> Now open the .htaccess file under your public_html

#vi /home/username/public_html/.htaccess

and enter the code below :

suPHP_ConfigPath /home/username/public_html

Save the file.

2. Now try to access your page again and check if that help to resolve the issue.
——————————————————

In my case solution 1 did not help and then I checked the issue further and came to know that the issue was with the apache memory limit. I did check as below :

——————————————————
Solutions 2::

1. Checked the parameter RLimitMEM  under apache configuration file.

# vi /etc/httpd/conf/httpd.conf

Find for RLimitMEM

you will see something like below :

RLimitMEM 154857600 154857600
RLimitCPU 150 200
RLimitNPROC 25 30

Just increase the value of RLimitMEM , In my case I did as below ::

RLimitMEM 184857600 184857600

NOTE :: if you don’t find the value in httpd.conf, please do check in the file /etc/httpd/conf/includes/pre_main_global.conf

and then restart apache on the server.

# service httpd restart
——————————————————

and now try to access your site. your site will work like a charm without any error.

How to Change FTP service Port on cPanel server

Posted in Cpanel/WHM with tags on April 22, 2012 by Aparna Murthy

Today while working come across on the request to change port of the FTP from 21 to some other port that is 921 and I followed the steps below to do so :

Check if your server is using Proftpd and pure-ftpd, To check refer the steps below :

>> Login to your WHM
>> Service Configuration >> FTP Server Selection
>> Here you can see on which radio button is checked.

If you are using pureftpd then follow the steps below :

1. Login to ssh via root

2. Edit /etc/pure-ftpd.conf and look for the following line:

# vi /etc/pure-ftpd.conf
======================
Bind <addr> <port>
======================

Example :: #Bind 127.0.0.1,21

Replace it with the below line :

======================
Bind 127.0.0.1,921
======================

NOTE : 127.0.0.1 is a localhost and you must replace it with your certain server ip. You may add the lines for multiple ips under it as below :

=================
Bind 192.168.1.2,921
Bind 192.168.1.3,921
=================

192.168.1.2 are just example, you must enter your own server ips.

In my case the port is 921. Save the file.

3. Restart FTP service and cpanel service.

# /etc/init.d/pure-ftpd restart
# /etc/init.d/cpanel restart
Ensure the port 921 is allowed at your firewall.

If you are using proftpd then follow the steps below :

1. Login to ssh via root

2.Edit /etc/proftpd.conf and change:

Port 21

to

Port 921

3. Save file and restart proftpd and cpanel service.
# /etc/init.d/proftpd restart
# /etc/init.d/cpanel restart

You’re Done.

PHP Setting change, register_globals and more using htaccess

Posted in PHP/Mysql on April 5, 2012 by Aparna Murthy

In order to change your PHP  setting, from upload limit to register_globals just do the follow:

1) Create a file called .htaccess inside your public_html
(Note: if you want to change PHP 5 settings, you need to put these values in a file called php.ini inside the folder of the php files and
remove the php_value part)

1) Create a file called .htaccess inside your public_html

(Note: if you want to change PHP 5 settings, you need to put these values in a file called php.ini inside the folder of the php files and  remove the php_value part)

2) Edit it and add the line below in this format

php_value value_name newvalue

example:

# to turn off register_globals

php_value register_globals off

#To change upload size limit to 100mb (Make sure add both lines below into htaccess)

php_value upload_max_filesize 100M

php_value post_max_size 100M

# to change php script execution time

php_value max_execution_time 1000

# to turn mod_rewrite on

RewriteEngine on

php_value upload_max_filesize 100M

php_value post_max_size 100M

php_value output_buffering on

php_value max_execution_time 1000

php_value max_input_time 1000

php_value session.gc_maxlifetime 14400

RewriteEngine On

# Turn off mod_security filtering.

SecFilterEngine Off

# The below probably isn’t needed,
# but better safe than sorry.
SecFilterScanPOST Off

Correcting ownership of all cPanel Users

Posted in Cpanel/WHM with tags on April 5, 2012 by Aparna Murthy

If you have messed up with the ownership of all the users on a cPanel server, following script will help you to correct the ownership:

====================================

# Login to server as a root
# create a shell script and enter the code below :
# vi permissions.sh
Code to be entered :
====================
for i in `cat /etc/trueuserdomains | awk ‘{print $2}’`
do
/bin/chown $i.$i /home/$i -R;
/bin/chown $i.mail /home/$i/etc -R;
/bin/chown $i.nobody /home/$i/public_html;
done;
====================

Save the file and change the permission for the file permissions.
# chmod 755 permissions.sh
Then run the script.
# ./permissions.sh

 
It will take some time according to the amount of users and The ownership of the home directory of a user, etc and public_tml will be corrected in a one go.

 

🙂 🙂 🙂

Differences between TCP and UDP Protocol

Posted in Uncategorized on November 17, 2011 by Aparna Murthy

If you want to know the exact difference between TCP and UDP protocol, lets have a look below :

Firstly, What is TCP and UDP protocol :

Transmission Control Protocol (TCP) and User Datagram Protocol (UDP) are the major protocols operating at Transport Layer. Transmission Control Protocol (TCP) and User Datagram Protocol (UDP) operate very differently and you can choose Transmission Control Protocol (TCP) or User Datagram Protocol (UDP) depending on your requirement.

1. TCP Protocol : TCP stands for Transmission Control Protocol and it guarantees delivery of data packets. This protocol provides extensive error checking mechanisms such as flow control and acknowledgment of data. Transmission Control Protocol (TCP) is a connection oriented protocol. Before transmitting data, a connection must be established between the devices participating in data transmission. If your Application require guaranteed delivery of data, then you must choose TCP as the Transport layer protocol.

2. UDP Protocol : UDP stands for User Datagram protocol and it operates in Datagram mode. The main difference you should notice here is User Datagram Protocol (UDP) is a connection-less protocol. User Datagram protocol (UDP) has only the basic error checking mechanism using checksums.

Now I assume that you under stand what is TCP and UDP protocol more than there long forms 😉  Now see Difference between Transmission Control Protocol (TCP) and User Datagram Protocol (UDP) below :

        Transmission Control Protocol (TCP)

1) Transmission Control Protocol (TCP) is a connection oriented protocol, which means the devices should open a connection before transmitting data and should close the connection gracefully after transmitting the data.

2) Transmission Control Protocol (TCP) assure reliable delivery of data to the destination.

3) Transmission Control Protocol (TCP) protocol provides extensive error checking mechanisms such as flow control and acknowledgment of data.

4) Sequencing of data is a feature of Transmission Control Protocol (TCP).

5) Delivery of data is guaranteed if you are using Transmission Control Protocol (TCP).

6) Transmission Control Protocol (TCP) is comparatively slow because of these extensive error checking mechanisms

7) Multiplexing and Demultiplexing is possible in Transmission Control Protocol (TCP) using TCP port numbers.

8) Retransmission of lost packets is possible in Transmission Control Protocol (TCP).

   User Datagram Protocol (UDP)

1) User Datagram Protocol (UDP) is Datagram oriented protocol with no overhead for opening, maintaining, and closing a connection.

2) User Datagram Protocol (UDP) is efficient for broadcast/multicast transmission.

3) User Datagram protocol (UDP) has only the basic error checking mechanism using checksums.

4) There is no sequencing of data in User Datagram protocol (UDP) .

5) The delivery of data cannot be guaranteed in User Datagram protocol (UDP) .

6) User Datagram protocol (UDP) is faster, simpler and more efficient than TCP. However, User Datagram protocol (UDP) it is less robust then TCP

7) Multiplexing and Demultiplexing is possible in User Datagram Protcol (UDP) using UDP port numbers.

8) There is no retransmission of lost packets in User Datagram Protcol (UDP).

Cheers!!!! ;);)

How do i password protect subdomain directories in plesk

Posted in Uncategorized with tags on September 5, 2011 by Aparna Murthy

You can protect the subdomain directories in plesk using .htaccess and .htpasswd files. Follow the stpes below :

>> SSH to the server with root user
>> Go to the folder which you want to be password protected :

[root@server ~]# cd /www/vhosts/yourdomai.com/subdomains/directory/httpdocs/

NOTE : “Yourdomain.com” will be replaced with your domain main domain and “Directory” replaced with the folder that you want to protect.

>> Now create .htaccess file :

[root@server ~]# vi .htaccess

Enter the below code in .htaccess file :

AuthType Basic
AuthName “Authentication”
AuthUserFile /www/vhosts/yourdomai.com/subdomains/directory/httpdocs/.htpasswd
Require valid-user

Save and exit from the file .htaccess.
>> Then create .htpasswd file under the same directory or the directory which you’ve specified in your .htaccess file. Here I’ve created .htpasswd file at /www/vhosts/yourdomai.com/subdomains/directory/httpdocs/.htpasswd

[root@server ~]# vi ..htpasswd

Edit this file and enter the username and password combination. You can enter one per line. Or you may create the htpassword file using the link http://www.htaccesstools.com/htpasswd-generator/ and enter the code that is generated using this link to the file .htpasswd file.

Save and exit from the file.

>> OR you may Run the command as below :

[root@server ~]# htpasswd -c .htpasswd username

NOTE : username will be replaced with your username.

It will prompt you to set a password and create a file in that folder called .htpasswd with the username and encrpyted password for it.

Thats it!!! Now you have your subdomain with protected username and password.