0

I am developing php applications on Ubuntu 13.04 and when i am trying to change the upload_max_filesize setting:

$ sudo gedit /etc/php5/apache2/php.ini

and restart apache the values do not change in my phpinfo() they stay at the default values

This is the path mentioned in the phpinfo:

Loaded Configuration File /etc/php5/apache2/php.ini

hakre
  • 193,403
  • 52
  • 435
  • 836
Dev
  • 612
  • 2
  • 13
  • 33
  • Are you using third party application like LAMP? – Mark Aug 20 '13 at 07:52
  • Which other ini locations is the phpinfo giving you? (yes there are more). And what about your .user.ini configuration. Hows it configured? Hows it used? – hakre Aug 20 '13 at 07:52
  • I remove mysql tag because this is an isolated php issue. – Mark Aug 20 '13 at 07:54
  • @hakre: these are the additional .ini files parsed /etc/php5/apache2/conf.d/10-pdo.ini, /etc/php5/apache2/conf.d/20-gd.ini, /etc/php5/apache2/conf.d/20-mysql.ini, /etc/php5/apache2/conf.d/20-mysqli.ini, /etc/php5/apache2/conf.d/20-pdo_mysql.ini, /etc/php5/apache2/conf.d/mcrypt.ini – Dev Aug 20 '13 at 07:57
  • Those are for php extensions that are configured via your systems package manager. Nothing so special I'd say that this is interfering with your setting. Please restore your original php.ini file (in case you made a backup) or reinstall. Then try again and take care you don't make a mistake when editing the file. – hakre Aug 20 '13 at 08:00
  • @hakre: I am stuck in a tricky situation.. i dont have the backup of the php.ini file.. any other suggestion please!!! – Dev Aug 20 '13 at 08:04
  • looks carefully in the lines you remember you edited if you can spot an error. Just something when typing. Look careful and not in a hurry. You can make it :) Just keep cool. Also you could try to just re-install the package (rename your ini file after uninstall if it still exists. then install the package and the ini will be created again. then compare both files (diff). meld is your friend if you like gui). – hakre Aug 20 '13 at 08:10
  • @hakre: It works !!! there was an syntax error in my php.ini file. Thanks for your help. – Dev Aug 20 '13 at 09:07

4 Answers4

3

Those values can be read from more than one location. You only show one location (and yes there is a phpinfo showing only one location but there are other elements in phpinfo hinting additional ini locations and to tell you the truth: the phpinfo does not show all inis).

So actually this depends on your configuration (which can greatly differ as you've got an open system) and the only thing we can say for sure is that you

  • a) edited the wrong file -or -
  • b) made a mistake while editing the right file.

To fix your issue, edit the right file.

To find the right file, learn about your systems PHP configuration.

To learn about your systems PHP configuration, start removing the ini and see what happens.

To learn about how it works in general - not specific to your system - you can easily consult the PHP manual:

hakre
  • 193,403
  • 52
  • 435
  • 836
  • 1
    Just use phpinfo() to check what is your current php.ini file, please update your answer – Vova Lando Aug 20 '13 at 07:48
  • @Vova Lando: OP checked that and I'm with the OP that it is not always possible to obtain all loaded ini files from the output of phpinfo(). – hakre Aug 20 '13 at 07:48
  • true, sorry my mistake – Vova Lando Aug 20 '13 at 07:49
  • No, generally it's not such a bad suggestion and a good place to look into first (especially the "additional ini files parsed" entry and the one about additional directories to look into for inis). I now also added a link to the PHP manual that is exactly about that topic. – hakre Aug 20 '13 at 07:51
  • @VovaLando : i have already mentioned the path of php.ini its located in /etc/php5/apache2/php.ini – Dev Aug 20 '13 at 07:52
  • @VovaLando: Please see this related question: [php.ini changes but not effective in ubuntu](http://stackoverflow.com/q/11662295/367456) - Double-Check you didn't made a mistake. And when you edit configuration files *always* keep a backup. If you didn't you perhaps already screwed your system in case you made an error editing the file in the first place and can't restore. That's a hard lesson to learn. Believe me :) - keep backups from configuration files *before* editing them. – hakre Aug 20 '13 at 07:58
2

Try to check if there is any syntax error in your php.ini, if there is any, it will not take the changes.

also make sure that your php.ini is writable

Leo Bali
  • 309
  • 1
  • 8
1

Or if you are on Linux (same will apply for windows, just different path), check the error log file with the command like this:

$ tail -n 100 /var/log/apache2/error.log

after restarting apache server

This will show you the line of the error and its cause in case of the syntax error in php.ini.

Darmen Amanbay
  • 4,869
  • 3
  • 29
  • 50
vitro
  • 900
  • 6
  • 20
0

Check also "Scan this dir for additional .ini files" and "Additional .ini files parsed"

Marek
  • 7,337
  • 1
  • 22
  • 33