How to hide PHP version in Linux

Most of the web server software has been installed with default settings that will lead to information leakage. One of them is a PHP software. Later this information can be used by hackers to try to exploit any vulnerabilities in the PHP version you are running, especially if you are running an older version with known weaknesses. In this article we will show you how to hide PHP version in Linux.

First make a backup copy of your php.ini file

cp -p /etc/php.ini /etc/php.ini.orig

Edit the php.ini and search for keyword expose_php and make it off by using your favorite editor:

nano /etc/php.ini

expose_php = Off

Now restart the apache web server:

systemctl restart httpd

Done, We have successfully hide PHP version.