How To Hide PHP Version in Linux

Hide PHP Version in Linux

In this tutorial we will show you how to hide PHP version in Linux server. In default Apache/PHP configuration, the server sends HTTP Header with the information of which PHP version is running on the server. The HTTP response header “X-Powered-By” displays the version of PHP that is running on the server. This information can be used by attacker to try to exploit any vulnerabilities in the PHP version you are running, specially if you are running an older version with known vulnerabilities.

This article assumes you have at least basic knowledge of linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo’ to the commands to get root privileges. I will show you through the step by step installation hide php version information in header on a Linunx server.

Hide PHP Version in Linux

Step 1: First take the backup copy of file php.ini.

Step 2. Edit the php.ini and search for keyword expose_php and make it off I use vi or nano editor. You can select your favorite editor:

Next find the expose_php and change its default value On to Off:

Now restart the apache web server:

To check whether it is working or not request for a response using below command:


Congratulation’s! You have successfully hide PHP version. Thanks for using this tutorial hide PHP version in the HTTP Headers on Linux system. For additional help or useful information, we recommend you to check the official PHP web site.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get a best deal!