2

On our Amazon EC2 instance, I uninstalled PHP5.3 (yum remove php) and installed PHP 5.5, which also bundled in Apache 2.4 (yum install php54).

For some reason, my php.ini file is no longer being read. It looks like it may be deprecated, and maybe I should use /etc/php-5.5.ini instead - but that one isn't being read either! (Strangely, I can't find any documentation on this. Googling "php-5.5.ini" (with quotes) returns no helpful results!??)

Running php --ini, I get this:

[ec2-user@ip ~]$ php --ini
Configuration File (php.ini) Path: /etc/php-5.5.d
Loaded Configuration File:         /etc/php-5.5.d/php.ini
Scan for additional .ini files in: /etc/php-5.5.d
Additional .ini files parsed:      /etc/php-5.5.d/apc.ini,
/etc/php-5.5.d/bz2.ini,
/etc/php-5.5.d/calendar.ini,
/etc/php-5.5.d/ctype.ini,
/etc/php-5.5.d/curl.ini,
/etc/php-5.5.d/dom.ini,
/etc/php-5.5.d/exif.ini,
/etc/php-5.5.d/fileinfo.ini,
/etc/php-5.5.d/ftp.ini,
/etc/php-5.5.d/gd.ini,
/etc/php-5.5.d/gettext.ini,
/etc/php-5.5.d/iconv.ini,
/etc/php-5.5.d/json.ini,
/etc/php-5.5.d/mbstring.ini,
/etc/php-5.5.d/mysqlnd.ini,
/etc/php-5.5.d/mysqlnd_mysql.ini,
/etc/php-5.5.d/mysqlnd_mysqli.ini,
/etc/php-5.5.d/pdo.ini,
/etc/php-5.5.d/pdo_mysqlnd.ini,
/etc/php-5.5.d/pdo_sqlite.ini,
/etc/php-5.5.d/phar.ini,
/etc/php-5.5.d/php.ini,
/etc/php-5.5.d/posix.ini,
/etc/php-5.5.d/shmop.ini,
/etc/php-5.5.d/simplexml.ini,
/etc/php-5.5.d/sockets.ini,
/etc/php-5.5.d/sqlite3.ini,
/etc/php-5.5.d/sysvmsg.ini,
/etc/php-5.5.d/sysvsem.ini,
/etc/php-5.5.d/sysvshm.ini,
/etc/php-5.5.d/tokenizer.ini,
/etc/php-5.5.d/xml.ini,
/etc/php-5.5.d/xml_wddx.ini,
/etc/php-5.5.d/xmlreader.ini,
/etc/php-5.5.d/xmlwriter.ini,
/etc/php-5.5.d/xsl.ini,
/etc/php-5.5.d/zip.ini

Neither ini file are listed here. There's a /etc/php-5.5.d/php.ini, but it is blank except for this message: ; The php.ini file has moved to /etc/php-5.5.ini.

But again, /etc/php-5.5.ini isn't being read either...

I'm not sure what the ".d" naming scheme means here - is it "default" or "daemon" or something else?

What can I do to get either of these INI files read? Or do I just need to throw everything into /etc/php-5.5.d/php.ini?

user9517
  • 115,471
  • 20
  • 215
  • 297
DOOManiac
  • 791
  • 6
  • 12
  • 26

1 Answers1

2

Your PHP is configured to read all .ini files in the /etc/php-5.5.d folder. This allows for logical separation of settings - APC's settings go into apc.ini, memcached's go in memcached.ini, etc.

You can put any settings you want to modify in /etc/php-5.5.d/php.ini or create a new .ini in the folder. /etc/php-5.5.d/DOOManiac.ini would work just fine, for example.

Regarding .d folders: https://unix.stackexchange.com/questions/4029/what-does-the-d-stand-for-in-directory-names

ceejayoz
  • 32,910
  • 7
  • 82
  • 106
  • That's what it looks like, except for the fact that `/etc/php-5.5.d/php.ini` is devoid of any 'default' settings and merely points the user to `/etc/php-5.5.ini`. I know it would work, but it feels kind of hacky, so I just wanted to check and make sure that yes this is what I should really do. Thanks – DOOManiac Jan 02 '14 at 15:10
  • Also, thanks for clarifying the `.d` issue! – DOOManiac Jan 02 '14 at 15:11
  • 1
    An empty `php.ini` file will still get PHP's internal defaults. Some distributions pre-populate the default `php.ini` file with a big long list of default settings, but it's not strictly necessary. You can run PHP with no `php.ini` file whatsoever, in fact. – ceejayoz Jan 02 '14 at 15:13
  • Okay, I bit the bullet and did `sudo cp /etc/php-5.5.ini /etc/php-5.5.d/php.ini`. Everything works fine now. I guess I'll just delete all these old INI files and tell everyone it's in a different place now... – DOOManiac Jan 02 '14 at 15:18
  • Other option - symlink `/etc/php-5.5.ini` to `/etc/php-5.5.d/php.ini` or the other way around. – ceejayoz Jan 02 '14 at 15:30
  • Would've worked, but I get confused easily and would just prefer to have it in one place. :) – DOOManiac Jan 02 '14 at 15:39
  • If i symlink it, is that going to get erased/overwritten when I upgrade PHP with yum? – Tallboy Jan 07 '14 at 03:54