July 11, 2014

Generate SSH Key for login without password in Ubuntu and Linux

There are several reasons that you might want to generate SSH key for login without password

  1. When you need daily login to different linux systems through the SSH many times and you feel annoying in entering the password every time.
  2. There are services/programs use SSH for connecting between the systems. For instance, rsync and lsyncd for file replication.

Check the steps below to create passwordless SSH login !

Assume that you have 2 servers (master server and salve server), and would like connect salve server from master server using SSH without enter password.

1. Create a SSH key in master server using this command to create RSA keys.


ssh-keygen -t rsa

2. Copy the generated SSH key from master server to salve server.


ssh-copy-id username@host

3. Access the salve server from master server.


ssh username@host

With the steps above, you are created a passwordless SSH login successfully.

July 9, 2014

Display and show PHP 500 internal server error

When you are working with PHP and sometime the browser is showing nothing but with HTTP Status code 500. It means there is an internal server error which causing by fatal error in your codes. It is difficult to identify the root cause without exception message when debugging. Therefore, we can show the exception message by changing the error display setting. There are two ways to enable this error display.

1. Modify the error display setting in php.ini

Change the setting as below in php.ini file.


display_errors = On
error_reporting = E_ALL | E_STRICT

2. Override the error display setting in runtime

When you are not allowed to modify the php.ini file, but would like to show the errors. We can change the setting in code level during runtime to override the setting in php.ini file. The codes should be inserted to the very beginning in your PHP file.


ini_set('display_errors', 'On');
error_reporting(E_ALL | E_STRICT);

PS : remember to turn off those setting in your production environment.