How to upgrade Linux kernel

by Tweak on November 1, 2010
in Linux, Servers

How do I upgrade my Linux kernel? I would like to upgrade kernel without compiling from source code i.e. binary upgrade. How do I perform the actual upgrade of the kernel in Linux?

You need to compile kernel only if:

  • You need custom made kernel for specific task such as embedded kernel.
  • Apply third party security patches.
  • You need to apply specific patch to Linux.

Read more…

Securing PHP webservers

by Tweak on October 29, 2010
in Php, Security

PHP applications have a reputation for higher than average security problems. What configuration techniques do you use for making sure the application is secure as possible ?

I’m looking for ideas like:

I normally use Linux, but feel free to suggest Windows solutions too.

By David Pashley?

Read more…

IP Address conversion in PHP

by Tweak on October 20, 2010
in Php

The purpose of this technote is to provide a small recipe for manipulating and/or converting IP addresses to decimals and back. I wrote a similar technote on how to do this in the Perl language. I thought it would be just as useful to know how to do the same thing in PHP. PHP has a few built-in functions but use of these functions may not yield the desired results.

The PHP function ip2long( string ip_address) is a built-in function that will return an integer. PHP’s Integer type is signed, so many IP addresses will result in a negetive number.
Read more…

MySQL IF() usage

by Tweak on October 15, 2010
in Mysql

This article discusses the usage of the MySQL IF() function to display the status of a BOOLEAN or TINYINT(1) column. While working on a tool to track a migration, I needed a means to show the migration status of a collection of tasks. If all the tasks had been migrated, then I needed to summarize that collection as being “migrated”. Where as, if any one task was incomplete, all tasks in that collection needed to be summarized as being “not migrated”.

This particular project was to make changes to collections of templates that were grouped by a server. To do this, I used the MySQL IF() function to check the number of templates in the collection was equal to the summation of the boolean flag associated with each template. When a template was migrated, it’s BOOLEAN flag was set to 1.
Read more…

Google Sandbox FAQ

by Tweak on October 11, 2010
in Google

  • What is the sandbox?
  • Basically its a time period that keywords that are competitive must wait in order to achieve results on Google.

  • Is it real?
  • Better believe it.

  • Does the sandbox effect my entire site?
  • No! It is keyword related only. Say you make a site for home loans. Everything about the site is home loan this and home loan that. But you name your site www. doodypants.com. Now you will rank well for the term “doody pants” because it is not competitive. But you will be in the sandbox for the keyword “home loans”.
    Read more…

Reset lost root password in MySQL

by Tweak on October 10, 2010
in Mysql

This is a handy procedure that can be used to reset the root password for the MySQL account. I had to use this procedure on a failed installation. It appeared that I had a problem with the bin/install_db command, and it failed to pre-populate the mysql.user table with the correct initial permissions and grants. Without this information, I was dead in the water. I had an empty grant / access table so I couldn’t log in.

The following sequence was taken to correct this problem: Read more…

How to install UnixBench ?

by Tweak on October 8, 2010
in Linux, Servers, Vps

UnixBench is the original BYTE UNIX benchmark suite, updated and revised by many people over the years.

The purpose of UnixBench is to provide a basic indicator of the performance of a Unix-like system; hence, multiple tests are used to test various aspects of the system’s performance. These test results are then compared to the scores from a baseline system to produce an index value, which is generally easier to handle than the raw scores. The entire set of index values is then combined to make an overall index for the system.
Read more…

10 Tips to Keep Email Out of the Spam Folder

by Tweak on October 6, 2010
in Domain/Hosting, Servers

1. Be Compliant with the CAN-SPAM Act

If you are sending “any electronic mail message, the primary purpose of which is the commercial advertisement or promotion of a commercial product or service,” then you must comply with the following 7 main requirements (or face penalties up to $16,000) [5]:

  1. Don’t use false or misleading header information
  2. Don’t use deceptive subject lines
  3. Identify the message as an ad
  4. Tell recipients where you’re located
  5. Tell recipients how to opt-out of receiving future email from you
  6. Honor opt-out requests promptly
  7. Monitor what others are doing on your behalf

If your email contains only transactional emails or relationship content, then you are exempt from these rules; however, you must still not include false or misleading routing information.
Read more…

Export MySQL data into CSV or PSV files

by Tweak on October 1, 2010
in Mysql

One way to export data from MySQL tables into plain text files would be to use mysqldump, then remove SQL from the dump file. Perhaps an easier way is to pipe SQL SELECT output to a file.

For CSV (comma delimited, enclosing content in quotes):

mysql mydb -e "SELECT * FROM my_table" | sed 's/\t/","/g;s/^/"/;s/$/"/;' > my_db.my_table.csv

Example output:

"column1","column2"
"value1","value2"

Read more…

Install mcache (msession) to be used for session caching in PHP

by Tweak on September 30, 2010
in Ajax

Installing mcache, previously known as msession, on CentOS 32 bit system.

MCache can be used completely transparently to a PHP application. By editing PHP’s “php.ini” file to use MCache as its default session handler (see Appendix D), applications will simply use MCache without knowing. This has an advantage in that MCache presents a standard interface for PHP regardless of it storage configuration. It can even hide which storage system or database is used and provides an amount of connection pooling and SQL caching.

If you are on 64 bit system, you will get errors, lots of them. Following instructions work fine with 32 bit systems. For more help look at the MCache Handbook.

Web site: http://www.mohawksoft.org/?q=node/32
PHP reference: http://us2.php.net/manual/en/ref.msession.php
Read more…

« Previous PageNext Page »