Jump to content

php_ini_loaded_file() says php.ini not loaded


johnmerlino

Recommended Posts

Hey all,

 

So I was have common problem with date() function in php5.3.  Someone said the error message suggests that your php.ini settings have 'EDT/-4.0/DST' set as your timezone setting and should rather be 'America/New_York' instead. Now i have two php.ini files: php.ini.default php.ini.default-5.2-previous. running phpinfo() just tells me that the php.ini is located in etc but doesn't mention which php.ini is in use.

 

So to figure out which one, I run this:

 

$inipath = php_ini_loaded_file();

if ($inipath) {
    echo 'Loaded php.ini: ' . $inipath;
} else {
    echo 'A php.ini file is not loaded';
}

 

And this outputs the else statement "not loaded".  How could the php.ini not be loaded?

 

thanks for response

Is there an /etc/php.ini file? If not then you need to make one - use the php.ini.default as a reference/original.

 

Thanks for response, but from the unix shell, I did the following:

 

cd ~

cd /etc/

ls

php.ini.default

hp.ini.default-5.2-previous

 

So there was no php.ini per se. Hence, I did the following:

 

mate php.ini.default

sudo touch php.ini (copied content from php.ini.default into php.ini and then saved file)

 

When I listed the /etc contents, the php.ini was now in there:

 

php.ini

php.ini.default

php.ini.default-5.2-previous

 

Yet, under Loaded Configuration File, it still says none.

 

Platform is Mac OSX

 

Thanks for response

 

 

 

Did you restart the web server? From the shell does

php -i

show the php.ini being used? (php -i is the command-line version of calling phpinfo().)

 

thanks for response, now that I copied the file into the new php.ini. Suddenly php stops raising exception errors and rather I just get a "server error" from the browser. Was some configuration setting reset?

 

 

  • 2 weeks later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.