Joomla Extension Manager warning (PHP temporary directory is not set)

Have you ever seen this warning message in your Joomla Extension Manager

The PHP temporary directory is not set. The PHP temporary directory is the directory that PHP uses to store an uploaded file before Joomla! can access this file. Whilst the directory not being set isn’t always a problem, if you are having issues with manifest files not being detected or uploaded files not being detected, setting this in your php.ini file might fix the issue.”

Okay here is the solution to remove this message

1. Create a php.ini file in the root folder of your Joomla web site
2. Add your temp directory path to it. It will be like this: upload_tmp_dir = /home/youraccontname/public_html/tmp
3. (Optional) Add a line to your .htaccess file so that your site can use the php.ini file. Add this line to .htaccess

SetEnv PHPRC /home/youraccountname/public_html