I have this ini file: /etc/php5/apache2/conf.d/appconfig.ini
Here is the content of the file:
serverhost = localhost
And I reset the apache2 server. How do I get this value from a PHP script without specifying path to ini file? I assumed when PHP parsed this file, it would store the value for serverhost somewhere accessible. I know that this file was parsed because I ran php --ini
.
I tried this script:
<?php
echo ini_get("serverhost");
?>
But nothing was returned. I can get it this way:
<?php
$file = parse_ini_file("/etc/php5/apache2/conf.d/appconfig.ini");
echo $file["serverhost"];
?>
But I want to know how to get it as an environment variable of sort. PHP did parse the file right?
After all, I will store a password in that appconfig.ini
. I wonder what is best practice for storing password.