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

Link to comment
Share on other sites

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

 

 

 

Link to comment
Share on other sites

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?

 

 

Link to comment
Share on other sites

  • 2 weeks later...
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.