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

https://frontendmasters.com/ https://www.class-central.com http://www.udacity.com http://www.freecodeamp.com https://codecademy.com https://mva.microsoft.com/ https://github.com/open-source-society/computer-science https://www.khanacademy.org https://www.safaribooksonline.com/ ( One Month Free Trial ) http://edx.org http://coursera.org http://udemy.com https://www.skillshare.com/ https://thenewboston.com/videos.php https://angularfirebase.com/ http://w3schools.com https://www.airpair.com/ https://egghead.io http://tutsplus.com https://www.pluralsight.com/browse/software-development ( 10 Days Free Trial ) https://hackr.io https://academy.fossbytes.com/ https://www.codeschool.com http://www.learnvern.com/ http://www.lynda.com (10 Days Free Trial) https://www.datacamp.com https://alison.com/ http://programming-motherfucker.com/become.html https://itpro.tv/PAID https://www.cbtnuggets.com https://linuxacademy.comAWS (Amazon Web Services) https://www.youtube.com/watch?v=BDBvHOaaKHo&list=PLv2a_5pNAko0Mijc6mnv04xeOut443Wnk https://linuxacademy.com/ (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: http://www.php.net/manual/en/function.ssh2-exec.php $connection = ssh2_connect(‘shell.example.com’, 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 = ‘https://googledrive.com/host/0B_3oJnpnNoF9UjlkVUwtWE5CY0U/city.jpg’; 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: ‘ . […]