PHP Warning: Module ‘modulename’ already loaded in Unknown on line 0 fileinfo [Solved]

Updated on July 17, 2018

If your PHP program throws this warning “Module <some_module_name> already loaded”, then  here’s how you can fix that. Normally this warning message is seen when you execute PHP program in the command line – as below:

$php sam.php
PHP Warning: Module 'fileinfo' already loaded in Unknown on line 0

You will also see this warning, when you run PHP interpreter with an (any) option. For example,

$php -v
PHP Warning: Module 'fileinfo' already loaded in Unknown on line 0
PHP 5.3.3 (cli) (built: Jul 12 2013 20:35:47)

techglimpse php support

Solution:

Generally, PHP modules are loaded in one of two ways – by compiling the modules directly into the PHP binary or by loading them as an extension via php.ini file. If the module is loaded in both ways, the warning will be given.

To fix the issue, you have to dig into php.ini file to see if the module has been loaded as an extension.

$ vi /etc/php.ini

Lookout for ‘extension=‘ as seen below:

extension=imagick.so
extension=fileinfo.so
extension=apc.so

In the above snapshot, you can see that the module named ‘fileinfo‘ (and imagick.so, apc.so) are loaded as an extension. Just go ahead and comment the line (module) that’s causing the issue as below:

;extension=fileinfo.so

You have to restart apache…

# /etc/init.d/httpd restart

That’s it!

Note: Make sure you don’t comment an extension that is not complied with PHP binary (for e.g imagick). To check what modules are loaded, run the below command:

# php -m

Was this article helpful?

Related Articles

Comments Leave a Comment

  1. Minor rewrite will improve grammar: Generally, PHP modules are loaded in one of two ways – by compiling the modules directly into the PHP binary or by loading them as an extension via php.ini file. If the module is loaded in both ways, the warning will be given.

Leave a Comment