简体   繁体   中英

Weird behavior of apache2 on Ubuntu with php.ini file

I am trying to solve ultimate problem of why session variables are not saved when I run my php script. After researching for a while I went on to check session.cookie_lifetime value which is set to 0 so session data should have preserved.

After that I checked my php configuration by running info.php file. This is what it says for loaded configuration value for php.ini file:

   /etc/php5/apache2 

However, I don't have php.ini file at this location. All I have at this location is conf.d directory which contains three other ini file except php.ini . I don't know why and how it happened. In fact, I have php.ini at location

    /etc/apache2

So php.ini file does not seem to taking effect. Could you please suggest what needs to be done to bring correct php.ini file ?

  1. Should I move php.ini file from /etc/apache2 to /etc/php5/apache2 ?

  2. if php.ini file at all not there then why info.php says loaded configuration file from /etc/php5/apache2

Any help is appreciated.

You should have the following directories

/etc/php5/conf.d 
/etc/php5/apache2   

In the /etc/php5/apache2 directory you should have your php.ini file. The con.d directory is simlinked to /etc/php5/apache2 where you would find the mysql and pdo ini files if you have that installed.

In your case if you don't have the above configuration you should move your php.ini file to /etc/php5/apache2/

Sounds like you may have upgraded Apache or installed something that changed the php5 configuration.

Hope this helps, Pat

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM