How to hide php version information in header

While migrating from godaddy account to new server which is hosted in DigitalOcean,I checked the header by using command curl -I .
In output of command ,I found PHP version was given.For security point of view I want to hide or disable this information.

For this you have to do small change in php.ini file.Because it is CentOS hence the path is /etc/php.ini

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

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

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

vi  /etc/php.ini

expose_php = off

Step 3: Now restart the apache web server

/etc/init.d/httpd restart

Step 4: Now check your website.the PHP version info will not be there

curl -I http://your-website-url






Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.