Monthly Archive: July 2014

0

How to make iptables rules permanent

To setup persistant iptables rules, after we enter our iptables as usual, we export them to config file.

iptables-save > /etc/iptables.conf

Edit your global rc.local file [/etc/rc.local] with your favorite editor and before the ‘exit 0’ add:

iptables-restore < /etc/iptables.conf

Save and restart, your iptables rules are now permanent

mysqlnd vs libmysql 0

mysqlnd vs libmysql

TL:DR If you are using php 5.3.3 or newer then go mysqlnd, otherwise stay with the default libmysql.

Whats the difference? While I could post it here for you, a more updated source would be http://www.php.net/manual/en/mysqlinfo.library.choosing.php.

As you can see, currently mysqlnd does ‘pretty-much’ evrything libmysql does with a plethora of additional features. So why on earth is that even a valid question? Well.. its not… at least not currently… If we move a few years in the past, mysqlnd did not support compression or SSL, which was in many cases a deal breaker. As of PHP 5.3.3 all of these are supported and it just makes more sense to go with the native driver.

Personally I use mysqlnd because I love using fetch_all. So, how to install? Follow below:

apt-get remove php5-mysql
apt-get insall php5-mysqlnd

(Note. you may have to reinstall anything that depended on mysql, such as phpmyadmin)
0

How to get mssql to work on php (debian/ubuntu)

Assuming that you already have PHP installed, you enter into the console

 apt-get install php5-sybase

(sadly not as intuitive as apt-get install php5-mssql)

For most instances that may be enough to give you what you need. If by any chance that doesn’t work, or you need more ‘functionality’ you can try (untested by me)

apt-get install php-pear
pear install --nodeps MDB2_Driver_mssql
How to check active connections on web server 0

How to check active connections on web server

Now this isn’t the most accurate method out there but it is by far the easiest.

Open up your console and type
 netstat -an | grep :443 | grep ESTABLISHED | wc -l

 

or even better, for a running total

watch "netstat -an | grep :443 | grep ESTABLISHED | wc -l"

 

Just to add one more not without getting too technical

netstat -an | grep :443 | grep -v TIME_WAIT | wc -l

should give you all connections that the local server hasn’t closed, depening on your application, this may be more accurate