How to hide PHP 7/8 version on OpenSUSE / SUSE Linux

How do I hide PHP version displayed as HTTP header such as x-powered-by: PHP/7.4.6 ? I am using OpenSUSE on development and SUSE Enterprise Linux with GCP.

  1. Cd into the /etc/php7/conf.d/ directory on OpenSUSE or SUSE Linux server:
    cd /etc/php7/conf.d/
  2. Create or update a file named custom.ini as the root user:
    sudo vim custom.ini
  3. Append the following line:
    expose_php = off
  4. Save and close the file.
  5. Restart the php-fpm.service as follows if you are using php-fpm:
    sudo systemctl restart php-fpm.service
  6. Are you using Apache 2 with mod_php? Try the following syntax:
    sudo systemctl restart apache2
  7. Verify HTTP headers using the curl as follows:
    curl -I https://your-domain-name-here/

See my page for more info

Linux sysadmin blog - Linux/Unix Howtos and Tutorials - Linux bash shell scripting wiki