PHP Warning: Module ‘mcrypt’ already loaded

Josh Sherman
1 min read
Software Development PHP

So the other day I realized that my concert spider stopped running. To my surprise I had a lot going wrong on my local machine (which runs the spider). First and foremost, MySQL wasn’t running. Still not sure why, but I manually started it to get it going. It ran through a recovery routine to check for corrupt data, I suspect I had a bad shutdown at some point. At this point, I figured I was golden, so I tried to launch my spider. Bletch… no dice. After a few attempts of starting it from the init script, I decided to go to the actual location of the script, and launch it manually. “PHP Warning: Module ‘mcrypt’ already loaded in Unknown on line 0” was presented to me. Yes, it’s only a warning, but I work in E_STRICT mode in PHP so warnings are not an option. Well I dig around the internet and see that other folks have had the same issue, and it’s apparently reported to Canonical as a bug in Ubuntu 8.10 Intrepid Ibex. From what I can tell, this has yet to be resolved. Keep in mind, this is on the CLI version of PHP and I’m having no issues with the Apache module. So at this point, I went ahead and did a grep for ‘mcrypt’ in /etc/php5. Surprisingly, I got more hits than I expected. The extension was being loaded by mcrypt.ini in conf.d, apache2 and cli directories as well as the php.ini under the cli directory. Now don’t quote me on this, but it seems as if the package php5-mcrypt created mcrypt.ini files in all of those directories but somewhere along the line, the php.ini under the cli directory was also modified. This caused the double load of the extension but only for the command line version (I haven’t seen an issue with the Apache module). Easy solution is to comment out of the extension from /etc/php5/cli/php.ini. This did in fact solve my issue.

Join the Conversation

Good stuff? Want more?

Weekly emails about technology, development, and sometimes sauerkraut.

100% Fresh, Grade A Content, Never Spam.

About Josh

Husband. Father. Pug dad. Musician. Founder of Holiday API, Head of Engineering and Emoji Specialist at Mailshake, and author of the best damn Lorem Ipsum Library for PHP.

Currently Reading

Parasie Eve

Previous Reads

Buy Me a Coffee Become a Sponsor

Related Articles