Error while compiling apache on CentOS 5.5

I got the following error when I was trying to modify my existing installation of Apache. Only thing I changed was to add –with-expires to my configure. Here is the error:

libtool: link: cannot find the library `/usr/local/src/httpd-2.2.14/srclib/apr-util/xml/expat/lib/libexpat.la' or unhandled argument `/usr/local/src/httpd-2.2.14/srclib/apr-util/xml/expat/lib/libexpat.la'

I was able to fix this error by adding: --with-expat=builtin

Remember to do make clean or untar again before doing configure. Good luck!

How do you print number of files for each folder in a directory [Linux]

I have been annoyed by the fact that I couldn’t easily print file count for all of the folders in certain directory.  Most of the time I just want to see what space each folder is using (du -hs *) but there are times when I need to know how many files are in each folder (checking cache folder, session folders etc).   So I whipped together a command line which does just that for me:

for i in `find -maxdepth 1 -type d`; do  echo -n $i " ";find $i|wc -l; done

I am sure there are many different ways to show file count for each folder in a directory and I am curious to see what people do so please do post comments with what you do.

Above command is pretty simple and can be expanded to do whatever you need.  For example, you can throw it into a bash script and be able to pass parameters.  For example:  count_files /home/  In this case your command line would look like:

for i in `find /home/ -maxdepth 1 -type d`; do  echo -n $i " ";find $i|wc -l; done

only difference would be that /home/ would be argument you passed and therefore will be $1.  Here is a sample script for above example:

#!/bin/bash
for i in `find $1 -maxdepth 1 -type d`; do
echo -n $i " ";
find $i|wc -l;
done

————————————-
DISCLAIMER: Please be smart and use code found on internet carefully. Make backups often. And yeah.. last but not least.. I am not responsible for any damage caused by this posting. Use at your own risk.

PHP: Curl being slow from php call on CentOS 5.4

I ran into an issue where curl request run within few ms from command line but same url fetch was taking over 10 secs. After doing some debugging and research it turned out that call to check (getaddr ipv6 was timing out. Obviously you can do multiple things to fix this (including enabling ipv6 support) but since I did not have a need for ipv6 (it is disabled in my network configuration), I decided to recompile curl and disable ipv6. Here is the command for recompiling curl and installing into /usr/local/curl directory with ipv6 disabled.

./configure –prefix=/usr/local/curl –disable-ipv6

————————————-
DISCLAIMER: Please be smart and use code found on internet carefully. Make backups often. And yeah.. last but not least.. I am not responsible for any damage caused by this posting. Use at your own risk.

Virus: What is mygener.im virus on facebook?

If you are a facebook user, please be aware that mygener.im virus is spreading quickly on facebook. From what I have seen online so far, it seems to redirect to a site which probably is stealing data from you computer and/or installing trojans. Initially it looks like this site allows to create generation tree and looks like a legit domain. This is being spread via messages to you from other friends of yours who are “infected”.

One of the things you can do to prevent getting “infected” is to not click on any links on facebook. Even if it comes from friends you trust.  If you do click on a link, make sure you don’t enter any login/passwords  on any sites you end up on.

Here is an article on eHow which talks about avoiding the virus:  how to avoid mygener.im on facebook

EDIT:  some people have reported that destination url has changed at least once so you may end up on a site which looks like aother “legit” site.

Health: H1N1 Swine Flu Google Map

There has been a lot of talk on the news about the swine flu and how it is spreading fast and a lot of people are affected. Here is something worth checking out, a google map with incidents marked with information on areas affected, how many dead, infection reported, etc.

http://tinyurl.com/cosuzr

Watch where you hang out and if you are feeling any symptoms, go see a doctor.

Here is some info from  wikipedia:

Mexican officials state that since March 2009 there have been over 1600 reported cases and put the death toll at 149, with 20 confirmed to be linked to a new swine influenza strain of influenza A virus subtype H1N1.

In the US, twenty-eight cases have been confirmed among New York students, seven in California, two in Texas, two in Kansas and one in Ohio; all have recovered. Kansas state health officials confirmed two cases of swine flu in Kansas on April 25, 2009, just minutes after eight school children in New York City were believed to be infected after a school trip to Mexico. The New York case had been confirmed as influenza A virus, which met the Centers for Disease Control and Prevention (or CDC) definition of a probable case of swine flu. Tests have now confirmed that this flu virus is the new strain of H1N1, according to reports on UK BBC News. On April 25, 2009, Texas closed a high school near San Antonio indefinitely after a third student showed symptoms of swine flu.

In Canada, the virus has now been confirmed in six cases. There are also three confirmed cases outside North America. The first confirmed case in Europe has occurred in a man in Spain, the second and third in Scotland in the UK. In Scotland there are two confirmed cases being treated in a hospital in Airdrie, Lanarkshire. The results from their tests came in at 6.10pm on 27 April 2009 and were confirmed as positive. These are the first two confirmed cases in the UK and the second and third in Europe. On April 26, 2009, students from Rangitoto College and Northcote College, both on the North Shore of Auckland, New Zealand, returned from school trips to Mexico and began exhibiting signs of influenza. Like the US students, they tested positive for influenza A which means swine flu is highly likely, however definite results are pending. There have also been reports of suspected infection in Australia, Brazil, Chile, France and Israel. Airports worldwide are on alert, with passengers from Mexico entering Japan being screened for the virus.

The head of the World Health Organization will lead the agency’s efforts against a deadly swine flu outbreak. The World Health Organization warns this new swine flu has the potential to become an international influenza pandemic. On April 25, 2009, the World Health Organization issued a document called the Swine influenza frequently asked questions. On April 24, 2009, the World Health Organization agreed that the current situation constitutes a public health emergency of international concern. The EU are advising against non essential travel to Mexico and the USA. Experts warn that use of face masks does not provide adequate protection. Face masks only work when dry; after an hour or two the breath causes the fabric to become damp and then it does not provide filtration of infection. A face mask must be replaced every two hours and the one used disposed of or cleaned. The WHO have increased the level pandemic alert to phases 4 on a 6 point scale. Phase 4 indicates a “significant increase in risk of pandemic”.

Next Page »