Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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 ?

share|improve this question

closed as off-topic by Falcon Momot, Ward, mdpc, MadHatter, dawud Sep 19 '13 at 6:17

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions must be relevant to professional system administration. Server Fault is a site dedicated to professionals; novice questions are off-topic. Please see the Help Center for more information on topicality. The best advice we can give you is to hire a professional to help you out." – Ward, mdpc, MadHatter
If this question can be reworded to fit the rules in the help center, please edit the question.

2 Answers 2

up vote 1 down vote accepted

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
share|improve this answer

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).

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.