PHP: How to fix Image rotation issue in img tag because of EXIF

Photos captured by some smartphones especially iPhones are automatically rotated when we use it in <img> tag which is mostly not acceptable as we don’t need such unwanted rotation. This happens because of EXIF Data stored in that image. But we can easily fix it using PHP by following these steps: function autorotate($src) { // […]

PHP: Array Version of htmlspecialchars() function

htmlspecialchars() function should be used for security reason to echo values from any variable. But htmlspecialchars() doe’s not work for arrays so following function would help to escape html characters from array values:

Best Websites to Learn Programming in Free ( One Month Free Trial ) ( 10 Days Free Trial ) (10 Days Free Trial) https://linuxacademy.comAWS (Amazon Web Services) (AWS and other cloud […]

How to remove index.php from codeigniter in UBUNTU?

This tutorial will show you that how to remove index.php from codeigniter in UBUNTU or how to enable url rewriting. Step 1 : Add this in htaccess file <IfModule mod_rewrite.c> RewriteEngine On #RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^ index.php [QSA,L] </IfModule> Step 2 : Remove index.php in codeigniter config $config[‘index_page’] = ”; Step 3 […]

SSH: How to stop a script running in the background?

Open/Login SSH into the server Type in ps x See the list of processes currently on your server Get the PID(process id) from that list and type kill xxxxx That should do it. Source: StackOverflow Tested on Linux / CentOS 6.7 x 64

PHP: How to run / execute a script in the background forever through SSH ?

You can execute a php script in the background forever by using SSH through PHP but for that you have to make sure first that SSH2 extension is available. PHP DOCS: $connection = ssh2_connect(‘’, 22); ssh2_auth_password($connection, ‘username’, ‘password’); /* if you want to execute script from a different directory then use commands in same line […]

SSH: how to run a PHP script in background forever in Linux (CentOS) ?

If you want to run a PHP script in the background forever through SSH then follow these steps: If you are using a SSH terminal (PuTTY) then directly run following command: // Notice ‘&’; that operator will help to run this script forever. php server.php & // make sure that you are in the root directory […]

CentOS: how to execute a php file with different php version than the php version of OS

To execute a php file with different php version than the version installed on the main php of your Server follow this: You should know that where is that php version located so that you can add the path. In my case I want to use PHP 7 that is installed in the plesk hosting […]

PHP: How to force to download remote file using php?

Following funcion can be used to force to download remote files via curl: $file = ‘’; download($file); function download($url) { set_time_limit(0); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); $r = curl_exec($ch); curl_close($ch); header(‘Expires: 0’); // no cache header(‘Cache-Control: must-revalidate, post-check=0, pre-check=0’); header(‘Last-Modified: ‘ . […]