facebook pixel
upper right bubble
ephort logo
lower left bubble

phpinfo() security

The phpinfo() function in PHP is a built-in function that provides detailed information about the PHP environment and its configuration. When called, it generates a page containing an extensive amount of information, including PHP version, server information, modules, extensions, PHP settings, and more.


While the phpinfo() function can be useful for developers and system administrators to gather information about the PHP installation, it is generally considered a security risk to expose this information to the public. Here are a few reasons why it's important not to expose the phpinfo() file:


Security vulnerabilities: The phpinfo() output reveals specific details about the PHP environment, such as PHP version, installed extensions, and their versions. This information can be exploited by attackers to identify potential vulnerabilities and security weaknesses that exist in outdated or insecure PHP versions or extensions. It provides valuable insights for potential attackers to craft targeted attacks.


Sensitive information exposure: The phpinfo() output may contain sensitive information such as server paths, database credentials, and environment variables. This information can be valuable to attackers as it helps them understand the server's configuration and potentially gain unauthorized access or launch more sophisticated attacks.


System fingerprinting: The detailed information provided by phpinfo() can be used by attackers to fingerprint and identify the underlying server and software versions running on it. This knowledge can aid attackers in tailoring attacks specifically for the target system, increasing the chances of successful exploitation.


To mitigate the risks associated with exposing phpinfo(), it is recommended to remove or disable the phpinfo() file from production environments. This can be done by either deleting the file entirely or preventing direct access to it by configuring web server rules or access controls. By limiting the exposure of sensitive information, you reduce the attack surface and improve the overall security posture of your PHP application.


Få en uforpligtende snak

Rune Due Møller

Rune Due Møller

Partner og direktør

Du er velkommen til at ringe direkte til mig på +45 30 95 99 93 eller skrive en mail på rune@ephort.dk

Du kan også udfylde formularen, så kontakter jeg dig hurtigst muligt.