How can one securely store encryption keys for AES encryption in PHP, especially when using them in included files?

To securely store encryption keys for AES encryption in PHP, especially when using them in included files, you can store the keys in a separate configuration file outside of the web root and restrict access to it using file permissions. Then, include this configuration file in your PHP scripts that require the encryption keys.

// config.php
<?php
define('AES_KEY', 'your_aes_key_here');
define('AES_IV', 'your_aes_iv_here');
?>

// index.php
<?php
include('/path/to/config.php');

// Use AES_KEY and AES_IV for encryption/decryption
?>