0

Please bear with me. I think my question is so stupid, it may be the reason I cannot find the answer on the web.

I need to use a PHP function called mcrypt_encrypt(). So I take a look at php.ini to activate the mcrypt extension, searching for:

;extension=php_mcrypt.dll

But there is NOTHING about mcrypt in my php.ini... So I install the extension using yum :

yum install php-mcrypt

Everything works !

But, looking back at the php.ini file, I was hoping to find a line about the mcrypt extension being activated. Nothing.

I guess my question is more about how yum works: How can yum install and activate a php extension without ever modifying the php.ini file ?

2 Answers 2

1

It does not need to modify php.ini to activate this extension.
Take a look at your default php.ini, there should be a comment in there like this:

;;;;
; Note: packaged extension modules are now loaded via the .ini files
; found in the directory /etc/php.d; these are loaded by default.
;;;;

And that is exactly what happened.
By installing that extension the package placed a file in /etc/php.d/ which then gets loaded by default.

In your case there will probably be a file called /etc/php.d/mcrypt.ini which contains:

; Enable mcrypt extension module
extension=mcrypt.so
1

Check this documentation about the %config directive of a file declared in an rpm package.

The %config directive is used to flag the specified file as being a configuration file. RPM performs additional processing for config files when packages are erased, and during installations and upgrades. This is due to the nature of config files: They are often changed by the system administrator, and those changes should not be lost.

And listing the config files of the php-config rpm package reveals that indeed, /etc/php.ini is a configuration file, and so abides by the %config directive.

rpm -qc php-common |grep php.ini
/etc/php.ini

Therefore, yum does not normally edit the file. Besides, the package is owned by another package (php-common).

Not the answer you're looking for? Browse other questions tagged .