What are the potential security risks of allowing directory listing in PHP?

Allowing directory listing in PHP can pose a security risk as it exposes the internal structure of the server to potential attackers. This can lead to sensitive information being leaked, such as file names, directories, and potentially even configuration files. To mitigate this risk, it is recommended to disable directory listing in PHP by configuring the server to prevent the web server from displaying directory contents.

// Disable directory listing in PHP
Options -Indexes