h1

Instruction Guide to Install PHP5 from Source on Linux

December 12, 2009

All Linux distributions comes with PHP. However, it is recommended to download latest PHP source code, compile and install on Linux. This will make it easier to upgrade PHP on an ongoing basis immediately after a new patch or release is available for download from PHP. This article explains how to install PHP5 from source on Linux.
1. Prerequisites

Apache web server should already be installed. Refer to my previous post on How to install Apache 2 on Linux. If you are planning to use PHP with MySQL, you should have My SQL already installed. I wrote about How to install MySQL on Linux.
2. Download PHP

Download the latest source code from PHP Download page. Current stable release is 5.2.6. Move the source to /usr/local/src and extract is as shown below.

# bzip2 -d php-5.2.6.tar.bz2
# tar xvf php-5.2.6.tar

3. Install PHP

View all configuration options available for PHP using ./configure –-help (two hyphen in front of help). The most commonly used option is –-prefix={install-dir-name} to install PHP on a user defined directory.

# cd php-5.2.6
# ./configure –help

In the following example, PHP will be compiled and installed under the default location /usr/local/lib with Apache configuration and MySQL support.

# ./configure –with-apxs2=/usr/local/apache2/bin/apxs –with-mysql
# make
# make install
# cp php.ini-dist /usr/local/lib/php.ini

4. Configure httpd.conf for PHP

Modify the /usr/local/apache2/conf/httpd.conf to add the following:

SetHandler application/x-httpd-php

Make sure the httpd.conf has the following line that will get automatically inserted during the PHP installation process.

LoadModule php5_module modules/libphp5.so

Restart the apache as shown below:

# /usr/local/bin/apache2/apachectl restart

5. Verify PHP Installation

Create a test.php under /usr/local/apache2/htdocs with the following content

# vi test.php

Go to http://local-host/test.php , which will show a detailed information about all the PHP configuration options and PHP modules installed on the system.
6. Trouble shooting during installation

Error 1: configure: error: xml2-config not found:
While performing the ./configure during PHP installation, you may get the following error:

# ./configure –with-apxs2=/usr/local/apache2/bin/apxs –with-mysql
Configuring extensions
checking whether to enable LIBXML support… yes
checking libxml2 install dir… no
checking for xml2-config path…
configure: error: xml2-config not found. Please check your libxml2 installation.

Install thelibxml2-devel and zlib-devel as shown below to the fix this issue.

# rpm -ivh /home/downloads/linux-iso/libxml2-devel-2.6.26-2.1.2.0.1.i386.rpm /home/downloads/linux-iso/zlib-devel-1.2.3-3.i386.rpm
Preparing… ########################################### [100%]
1:zlib-devel ########################################### [ 50%]
2:libxml2-devel ########################################### [100%]

Error 2: configure: error: Cannot find MySQL header files.
While performing the ./configure during PHP installation, you may get the following error:

# ./configure –with-apxs2=/usr/local/apache2/bin/apxs –with-mysql
checking for MySQL UNIX socket location… /var/lib/mysql/mysql.sock
configure: error: Cannot find MySQL header files under yes.
Note that the MySQL client library is not bundled anymore!

Install the MySQL-devel-community package as shown below to fix this issue.

# rpm -ivh /home/downloads/MySQL-devel-community-5.1.25-0.rhel5.i386.rpm
Preparing… ########################################### [100%]
1:MySQL-devel-community ########################################### [100%]

To uninstall PHP
[root@xyz bin]# yum remove php

How to know installed PHP version.
[root@xyz ~]# php -v
PHP 5.2.11 (cli) (built: Nov 30 2009 01:16:58)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2009 Zend Technologies
[root@xyz ~]#

h1

How to add TaskScheduler using perl

December 8, 2009

Win32::TaskScheduler – Perl extension for managing Win32 jobs scheduled via Task Scheduler

#################################################
# Example 1. How to get/set account information for a task
#
use Win32::TaskScheduler;

$scheduler = Win32::TaskScheduler->New();
$scheduler->Activate(“My scheduled job”);

$runasuser=$scheduler->GetAccountInformation();
die “Cannot set username\n” if (! $scheduler->SetAccountInformation(‘administrator’,’secret’));
die “Cannot save changes username\n” if (! $scheduler->Save());

#Release COM stuff (Optional)
$scheduler->End();

#################################################
# Example 2. Create a task.
#
use Win32::TaskScheduler;

$scheduler = Win32::TaskScheduler->New();

#
# This adds a daily schedule.
#
#%trig=(
# ‘BeginYear’ => 2001,
# ‘BeginMonth’ => 10,
# ‘BeginDay’ => 20,
# ‘StartHour’ => 14,
# ‘StartMinute’ => 10,
# ‘TriggerType’ => $scheduler->TASK_TIME_TRIGGER_DAILY,
# ‘Type’=>{
# ‘DaysInterval’ => 3,
# },
#);

#
# And this a monthly one, for first and last week.
#
%trig=(
‘BeginYear’ => 2001,
‘BeginMonth’ => 10,
‘BeginDay’ => 20,
‘StartHour’ => 14,
‘StartMinute’ => 10,
‘TriggerType’ => $scheduler->TASK_TIME_TRIGGER_MONTHLYDOW,
‘Type’=>{
‘WhichWeek’ => $scheduler->TASK_FIRST_WEEK | $scheduler->TASK_LAST_WEEK,
‘DaysOfTheWeek’ => $scheduler->TASK_FRIDAY | $scheduler->TASK_MONDAY,
‘Months’ => $scheduler->TASK_JANUARY | $scheduler->TASK_APRIL | $scheduler->TASK_JULY | $scheduler->TASK_OCTOBER,
},
);

#
# Execute this task every 10th of january,april,july,october
#
# Please note that days are given in the conventional form 1,2,30,25 not
# what m$ says in theyr APIs. This is the only exception to m$ APIs.
#
#%trig=(
# ‘BeginYear’ => 2001,
# ‘BeginMonth’ => 10,
# ‘BeginDay’ => 20,
# ‘StartHour’ => 14,
# ‘StartMinute’ => 10,
# ‘TriggerType’ => $scheduler->TASK_TIME_TRIGGER_MONTHLYDATE,
# ‘Type’=>{
# ‘Months’ => $scheduler->TASK_JANUARY | $scheduler->TASK_APRIL | $scheduler->TASK_JULY | $scheduler->TASK_OCTOBER,
# ‘Days’ => 10,
# },
#);

$tsk=”alfred”;

foreach $k (keys %trig) {print “$k=” . $trig{$k} . “\n”;}

$scheduler->NewWorkItem($tsk,\%trig);
$scheduler->SetApplicationName(“winword.exe”);

$scheduler->Save();

##########################END#####################

h1

How to create free user domain in google

December 8, 2009

Use this link to create free domain-

http://www.google.com/a/cpanel/domain/new

h1

How to add ROUTE in Linux

December 7, 2009

route del default
route add default gw 192.168.1.1 dev eth0
route add -net 192.168.119.0 netmask 255.255.255.0 dev ppp0

-net IP is range of your VPN IP.

h1

What is Volatility…

November 28, 2009

In other words, volatility refers to the amount of uncertainty or risk about the size of changes in a security’s value. A higher volatility means that a security’s value can potentially be spread out over a larger range of values. This means that the price of the security can change dramatically over a short time period in either direction. A lower volatility means that a security’s value does not fluctuate dramatically, but changes in value at a steady pace over a period of time.

One measure of the relative volatility of a particular stock to the market is its beta. A beta approximates the overall volatility of a security’s returns against the returns of a relevant benchmark. For example, a stock with a beta value of 1.1 has historically moved 110% for every 100% move in the benchmark, based on price level. Conversely, a stock with a beta of .9 has historically moved 90% for every 100% move in the underlying index.

h1

what is Risk Management

November 28, 2009

Simply put, risk management is a two-step process – determining what risks exist in an investment and then handling those risks in a way best-suited to your investment objectives. Risk management occurs everywhere in the financial world. It occurs when an investor buys low-risk government bonds over more risky corporate debt, when a fund manager hedges their currency exposure with currency derivatives and when a bank performs a credit check on an individual before issuing them a personal line of credit.

h1

SSH/SCP without prompting password.

November 28, 2009

Step 1. The step is to copy a unique key generated on your ‘homebox’ to the server you are connecting too. First, before you generate a new key, check to see if you already have a key:

user@homebox ~ $ ls -l ~/.ssh
total 20
-rwx–xr-x 1 user user 601 Feb 2 01:58 authorized_keys
-rwx–xr-x 1 user user 668 Jan 1 19:26 id_dsa
-rwx–xr-x 1 user user 599 Jan 1 19:26 id_dsa.pub
-rwx–xr-x 1 user user 6257 Feb 2 21:04 known_hosts

# The file we need to copy to the server is named id_dsa.pub. As you can see above, the file needed exists. You may or may not have other files in ~/.ssh as I do. If the key doesn’t exist, however, you can make one as follows:

user@homebox ~ $ ssh-keygen -t dsa
Generating public/private dsa key pair.
Enter file in which to save the key (/home/user/.ssh/id_dsa): # Press ‘enter’ here
Enter passphrase (empty for no passphrase): # Press ‘enter’ here
Enter same passphrase again: # Press ‘enter’ here
Your identification has been saved in /home/user/.ssh/id_dsa.
Your public key has been saved in /home/user/.ssh/id_dsa.pub.
The key fingerprint is:
6f:c3:cb:50:e6:e9:90:f0:0f:68:d2:10:56:eb:1d:91 user@host

Note : Entering a password when asked during the key generation processes when prompted would require you to enter a password each time you SSH/SCP to the server which defeats the purpose of this document.

Step 2. Regardless whether you had a key ready to go or if you had to generate a new key, the next step is the same in either case. Now you’re ready to copy the key to the server. Do so like this:

Now copy the text of file “id_dsa.pub” to server from where to copy in /home/user/.ssh/id_dsa.pub file. If this file already there then append your new generated key text.

Step 3. Now it’s time to test the setup. To do that, try to ssh to the server:

#### Example ####

user@homebox ~ $ ssh ’servername’ (or ‘ipaddress’)

# You should log in to the remote host without being asked for a password.

Step 4. You can now SSH or SCP to the remote host without having to enter a password at each connection. To make sure your public key stays secure from prying eyes, do the following to change permissions and restrict access on ‘homebox’ and also on ’servername’ to ~/.ssh:

#### Example ####

user@homebox ~ $ chmod 600 ~/.ssh/id_dsa ~/.ssh/id_dsa.pub

# Verify the permissions on the files:

#### Example ####

user@homebox ~ $ ls -l ~/.ssh
-rw——- 1 user user 668 Feb 4 19:26 id_dsa
-rw——- 1 user user 599 Feb 4 19:26 id_dsa.pub

h1

What Does Multiline Insurance Mean?

November 28, 2009

What Does Multiline Insurance Mean?
An insurance instrument used to bundle the risk exposures of multiple insurance obligations into one insurance contract. The risk exposures put together often are related, such as property and casualty risks.

In another word
Many different varieties of multiline contracts exist, and they cover a wide range of risk exposures. The basis behind multiline contracts is that a firm often is exposed to a portfolio of risk, and instead of creating a portfolio of insurance policies to manage that risk, they should use a single multiline contract to manage the portfolio of risks. One insurance contract is then more efficient and less costly than many contracts.

h1

About WaterSense: Saving Water And Money

November 28, 2009

WaterSense is the lesser-known sibling to the successful Energy Star program that was launched in 1992. The goal of the program is to conserve water, which is not only good for the environment, but also good for consumer’s wallets. With the growing global water shortage, the U.S. government hopes to see the WaterSense program gain popularity. (For an overview of the Energy Star program, see Home Energy Savings Add Up.)

Program Overview
WaterSense was launched by the U.S. Environmental Protection Agency (EPA) in 2006. It is a partnership with businesses designed to encourage the creation, sale and installation of products that are at least 20% more efficient in terms of water use than their predecessors. The program began with a focus on professional certification for landscape irrigation processionals, an area of particular focus because the EPA has determined that the “average single-family suburban home uses at least 30% of its water for outdoor purposes such as irrigation and as much as 70% in dry climates.”

Commercial enterprises drink up more than their fair share of water too, with golf courses coming in as one of the highest-profile offenders. Audubon International estimates water using on the average American golf course at 312,000 gallons per day. With around 16,000 courses in the United States and double that many worldwide, that’s a lot of water getting dumped on the ground. Toss in commercial farming and industrial applications and you’ve got a virtual tsunami of water consumption. Worse yet, the EPA reports that up to 50% of the water use for landscape purposes is “wasted due to evaporation, wind or over-watering.”

Future Potential
The WaterSense program has expanded beyond its origins to include EPA certification for host of products that includes irrigation systems, faucets, shower heads, toilets and even whole houses. The EPA has high hopes that, like the well-known Energy Star program, WaterSense will go mainstream.

While it is likely to take some time to catch on, the success of Energy Star provides hope, as consumers are familiar with it, product providers promote it heavily and savvy marketers have even launched entire sales campaigns around Energy Star rated appliances. Buoyed by that success, the EPA is doing everything it can to replicate that successful model with the WaterSense program.

How You Save Money and Help the Environment
Water is a scarce resource. With just 1% of the earth’s water supply available for human consumption, demand rising with population growth, and an aging infrastructure system in terms of municipal water delivery, the cost of clean water is expected to rise for the foreseeable future. As of 2008, the EPA estimates that the average homeowner spends up to $500 per year on water and sewage costs. Retrofitting with water-efficient fixtures can significantly reduce that number. For example, the EPA estimates the average household can save 20,000 gallons of water annually by installing a low-flow shower head. Over the course of a lifetime, that’s a tremendous savings in both money and water for one device upgrade.

There’s Money in Water
Water and money are linked in more ways that one. From a conservation perspective, takings simple steps can reduce your costs. Even if you cannot afford to proactively retrofit your house, you can make the changes slowly, over time, replacing inefficient fixtures with WaterSense fixtures as the old ones wear out. Fixing a single dripping faucet can save up to 3,000 gallons of water per year.

Limiting your use helps too. Landscaping is the biggest opportunity for conservation. Simply installing drought resistant plants instead of turf grass instantly reduces the need for watering. This aspect of water conservation is so important that it is a key component of the EPAs efforts to certify new homes with the WaterSense label. Cities and towns in drought-prone areas from Florida to Texas have joined the cause, and are encouraging – and in some cases requiring – homebuilders to limit the use of turf grass as a lawn covering. Some municipalities are offering rebates to homeowners that convert their lawns to water-friendly plants, others are offering gift certificates to nurseries to encourage the purchase of non-turf plants.

Conclusion
Minimizing the amount of water used on landscaping isn’t the only way to reduce water usage. The EPA reports that taking a five-minute shower uses just 10-25 gallons of water, versus up to 70 gallons for the large bathtubs common in McMansions, and turning off the water when you brush your teeth saves eight gallons of water. (Learn how living in a smaller home can cut major expenses in Downsize Your Home To Downsize Expenses.)

There’s money in water from an investment standpoint, too. From pumps and valves to desalination and purification, the efforts to keep this scarce resource flowing generates opportunities for investors.

h1

How to Shutdown & Restart Windows XP & Windows 2000 using command line.

November 28, 2009

Windows 2000 (with the Resource Kit installed) and Windows XP (natively) have an actual shutdown command that can be launched from a command prompt — and which, therefore, also can be launched from a shortcut. To see all available options for this command, click Start, click Run, type CMD, and click OK. Then, in the box that appears, type:

SHUTDOWN /?

You can also study the available options in the Microsoft KB 317371, “How to Use the Remote Shutdown Tool to Shut Down and Restart a Computer in Windows 2000.” (The article is basically suitable for Win XP also.)

This command starts a 30-second countdown for a shutdown or restart, which permits you to abort it (with a shutdown -a command). It you want the command to execute, use the -t flag, which lets you set the time lapse in seconds. The examples below use a 1-second delay.

For a shortcut to RESTART Windows XP:
SHUTDOWN -r -t 01

For a shortcut to SHUT DOWN Windows XP:
SHUTDOWN -s -t 01

Unfortunately — especially on Windows XP — this option only shuts down Windows. It does not shut down your computer, at least on most hardware. For that, on Win XP (and for most Win 2000 users also), I recommend the freeware utility Shutdown.exe (not to be confused with the Windows utility by the same name) by MS-MVP Andrej Budja. I’ve seen several shutdown utilities recommended, but this is the only one that I’ve seen actually shut down Windows XP and then powerdown the computer behind it. For more information on the tool, see here. After you place this utility in the root folder of C:, the commands for a shutdown, restart, or hibernate (respectively), each without a time delay, would be shutdown -u -t 0 for shutdown, shutdown -r -t 0 for restart, and shutdown -h -t 0 for hibernate.