Expose to the world that PHP is installed on the server, which includes the PHP version within the HTTP header (e.g., X-Powered By: PHP/5.3.7).

When the expose _php directive is enabled, PHP includes the PHP version in the HTTP response header when a PHP page is requested.

By default, the expose_PHP directive is enabled. However, you may not want to broadcast the specific PHP version your site is using, you can modify your php.ini file to disable the expose_php.

In this article, we learn about how t oenable the expose_php directive and all step is the same as how to disable it.

How to enable expose_php directive on Linux

VPSrobots users launch your client and connect to server with it, you maybe need our guide on How to connect to Linux server with VPSrobots. After connection to server, click the connected server. Open breadcrumb setting tab on the panel by clicking it and open PHP tab by clicking More button on PHP section. Click PHP config sub tab and enter the config name in the search box, you will find the result highlighted in blue. And then click Edit button.

Search for expose_php directive

After clicking Enter key, a drop down menu appears, select On option, and click Ok button.

Enable expose_php direcitve

At last, click Apply and Restart Apache buttons to validate the change.

How to enable expose_php directive on Linux

Windows users open PuTTY, configure it by following our guide on How to connect to Linux server with SSH client. Note that the following command prompts are running on Debian 7 with PHP 5.

Connect to server with PuTTY, and run the command prompt below to open php.ini file:

nano /etc/php5/apache2/php.ini

Open php.ini file

Press Ctrl+W keys to open search line and enter the directive name, press Enter key.

Search for expose_PHP directive

This will take you to the configuration page, you will find the derective is set to Off, replace it with On, Press Ctrl+O keys to save the change and press Enter key to confirm it. Press Ctrl+X keys to exit from the file.

Eable expose PHP directive

At last, run the command prompt below to restart Apache so that the change will take effect:

service apache2 restart

In this article, we covered how to enable expose_php on Linux by VPSrobots and by command line. To learn another directive, take a look at the following guide: