Archive for May, 2010

By default, any error message in your php script will be visible to site visitors on the browser and will be logged to apache error log file – most commonly in “/var/log/httpd/error.log”. In a production server it is advisable to prevent the error message from appearing on browser and has to be silently sent to a custom log file, specifically created for logging only php error messages. Following these steps might help:

1. Create the file under /var/log –

$touch /var/log/php-error.log

2. change permission to 644 –

$chmod 644 /var/log/php-error.log

3. set ownership –

$chown root.apache /var/log/php-error.log

(if httpd is running under apache, could be www-data, nobody…)

4. Edit /etc/php.ini  and make sure the following options are set correctly

error_reporting = E_ALL
display_errors = OFF
error_log =/var/log/php-error.log
log_errors = ON

5. Write a php script with some syntax error in it and check whether the error notification is logged or not

$tail -f /var/log/php-error.log

It is not advisable to use password based login for ssh any more. One of the most secure ways of  remote login through ssh is to use public key authentication. But in order to do that you have to generate both private and public keys using ssh-keygen, for RSA the default file names would be id_rsa (private key) and id_rsa.pub (public key).  Since you have already generate those keys with a passphrase and want to change the passphrase now, execute the following command:

$ ssh-keygen -f id_rsa -p

type your new passphrase, you are done!

Have you locked yourself out of your linux machine? If by any chance you forgot the root password of your linux box and you have physical access to that machine, booting linux in single user mode will do the trick. Restart your computer using one of the following commands:

 $shutdown -r now 

OR        

 $init 6  

OR      

 $reboot 

Then select the Linux kernel from the boot menu, type “e” (for edit). Then select the second line which starts with the word “kernel” and type “e”. Then press “space bar” and type “single” (for linux single user mode). Finally press “Enter” and type “b” for boot. Go ahead change the password now with

$passwd

Stand-up comedians

I like stand-up comedians. Not all of them, but those who tell it as it is. If I were to decide who the most intelligent and smartest stand-up comedian was I would pick George Carlin. He didn’t hesitate to question things we normally take for granted and simply accept as social norms. Actually he was more of a philosopher than just a regular comedian. My second choice would be Richard Pryor, an excellent story teller.

1. Carlin – critique on consumerism

2. Pryor – In the Jungle

Insightful quotes

Insightful quotes by a smart person – George Carlin.
  • At a formal dinner party, the person nearest death should always be seated closest to the bathroom.
  • Atheism is a non-prophet organization.
  • Electricity is really just organized lightning.
  • If you can’t beat them, arrange to have them beaten.
  • May the forces of evil become confused on the way to your house.
  • Well, if crime fighters fight crime and fire fighters fight fire, what do freedom fighters fight? They never mention that part to us, do they?
  • If someone with multiple personalities threatens to kill himself, is it considered a hostage situation?
  • What do you do when you see an endangered animal eating an endangered plant?

Who said Linux is not sexy?

Typical scenario: guy goes to a bar, does a quick scanning of the people inside the bar and walks straight to a blonde sitting all alone at the corner…the story goes. What about the Linux/Unix version of the story?

#who | grep -i "blonde" | echo "hi" | date;  \
cd ~/bedroom ; unzip; touch; strip; finger; \
mount; gasp; yes; uptime; umount; sleep

You might find this link interesting too, the war on terror for dummies – the way Linux geeks interpret and analyse the war on terror.