In order to avoid potential hacker from accessing your phpinfo page, it's wise to protect or remove any
phpinfo.php or other sensitive files that you may have sitting around on your server.
Here's how you can protect your phpinfo page by using .htaccess by inserting the following code:
# protect phpinfo <Files phpinfo.php> Order Deny,Allow Deny from all </Files>
Once you have saved the .htaccess file above, please follow the following steps to upload into your public_html directory.
1) Login to cPanel and click on File Manager
2) Double click on the path you wish to place the .htaccess file. For example, the public_html directory
3) Click Upload from the top menu and click on Select File
4) Your .htaccess file has been uploaded into public_html directory successfully.
If you try to visit the phpinfo page e.g. http://yourdomain.com/phpinfo.php , you shall see Error 403 Forbidden as seen below