Skip to main content

Posts

How to upgrade php version from 5.3 to 5.5 on DirectAdmin platform

Following is the instructions to upgrade your Dedicated Server’s PHP from version 5.3 to 5.5 on DirectAdmin platform: Step 1: ssh to the server Step 2: Enter following commands: #cd /usr/local/DirectAdmin/custombuild #./build set php5_ver 5.5 #./build update #./build php n #services httpd restart Once it’s done, confirm the upgrade by: #php -v

Mitigate Small DOS Attacks . Script to check IP connections along with Location.

This script will check the last 10 highest number of IP connections and will give the location of the IP address with connections more than 50. root@xxxx [~]# cat checkddos #!/bin/bash ################################################### # Script Name :checkddos # Created By : Jino Joseph # Created Date : 01-Jul-2013 # Last Modified : 01-Jul-2013 # Purpose : Finds the IPs with connections higher than 50 show the ip location ################################################### netstat -ntu | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -nr | head -10 | sed -e 's/^[ \t]*//' | sed -e 's/ /#/g' > result.txt for i in `cat result.txt`; do echo $i > temp.txt; No=$(cat temp.txt | gawk -F '#' '{print $1}'); IP=$(cat temp.txt | gawk -F '#' '{print $2}'); Num=${No/\.*} if [ $Num -gt 50 ] && [ $IP != '127.0.0.1' ] then echo -e " $IP : $Num \n " url="http://www.ipaddressloc...

What are cPanel release tiers & How can we change that?

We are all at least generally familiar with the software development cycles, and different software developers use different release schedules according to the testing phase the software is in at the time. For example, some developers use an alpha, beta, release candidate (RC) type of release schedule, and each of these may have varying levels of releases. The cPanel release schedule is very similar to the manner in which Linux distributions are released. cPanel updates in a variety of release tiers. Server administrators may then choose which release version is applicable to their system requirements. The following are cPanel’s current release tiers: ########################################### Stable Release Current Edge Long-term support Each of the above cPanel release tiers represents various stages of the software development cycle. While the final decision to which release version to deploy is entirely up to the organizational decision-makers, i...

Script to check the load and email you the details if the load is greater than given threshold.

#!/bin/bash LoadFloat=$(uptime | gawk -F 'load average:' '{print $2}' | awk '{print $1}' | sed -e 's/,//g') Load=${LoadFloat/\.*} LoadLimit=6 # This is the Load threshold that is to be set by your server requirements. if [ $Load -lt $LoadLimit ] then exit 1 else echo "Load is High " $Load # email subject SUBJECT="LOAD is $LoadFloat in CP6!!!" # Email To ? EMAIL="9207421@way2sms.com" # Email text/message EMAILMESSAGE="/tmp/emailmessage.txt" echo "Hi Team, " > $EMAILMESSAGE echo " " >> $EMAILMESSAGE echo " " >> $EMAILMESSAGE echo "The Load in CP6 is $LoadFloat">> $EMAILMESSAGE echo "Please Login and Have a check Immediately!!!!" >>$EMAILMESSAGE echo " " >> $EMAILMESSAGE echo " " >> $EMAILMESSAGE echo "Regards," >> $EMAILMESSAGE echo "System Ad...

Setting preview links in CMS

In Wordpress : ############## phpmyadmin >> take the database >> take the wp_users table >> Edit the "siteurl" and "home" fields to http://ipaddress/~username Now login to wp-admin and go to Settings >> permalink >> change to default >> click save >> then change to post >> Then save again. In Joomla : ########### Edit the "$mosConfig_live_site" field in the configuration file to http://ipaddress/~username

What to do if a query is logged in mysql slow query log.

On a mysql server there are a lot of queries to optimize and a lot of load generated by them. I’ll try to present the most usual optimization issues and how to identify them. First you’ll have to check mysql service settings . You can check them manually by following commands in mysql command line: mysql>show variables; or mysql>show variables like ‘%cache%’; and mysql> show status; you can check the counters and increase or decrease them according to their usage and limits. The more easy way is to use some scripts to check mysql settings like : MySQL performance tuning primer script (tuning-primer.sh). First and most important optimization is to activate and set query_cache and query_cache_size to lower disk IO usage. After that you will have to check the running queries . For that you’ll need to enable first : log-slow-queries= /var/lib/mysql/mysql-slow.log long-query-time=3 in my.cnf then touch /var/lib/mysql/mysql-slow.log and set owner as ...

PHP commands to get Php memory informations

You can put the below code in a memory.php file and then view the result from browser by http://yourdomain.com/memory.php echo 'Current Memory Usage: '.number_format(memory_get_usage()/1024/1024,"2",".",",").' MB'."\r\n"; echo 'Current Memory Allocted: '.number_format(memory_get_usage(true)/1024/1024,"2",".",",").' MB'."\r\n"; echo 'Peak Memory Usage: '.number_format((memory_get_peak_usage()/1024/1024),"2",".",",").' MB'."\r\n"; echo 'Peak Memory Allocated: '.number_format((memory_get_peak_usage(true)/1024/1024),"2",".",",").' MB';