How to Fix PHP Warning: Module already loaded in Unknown on line 0 on Ubuntu

I received email from cronjob saying that there was PHP module already loaded:

PHP Warning:  Module 'mysql' already loaded in Unknown on line 0

This warning happens when there is PHP extension loaded more than once. To fix this problem, check /etc/php5/apache2/php.ini file and the corresponding module configuration file in /etc/php5/conf.d/. For mysql module, I found it loaded 2 times in /etc/php5/apache2/php.ini and /etc/php5/conf.d/mysql.ini. Deactivate one module will settle the problem.

I also found that mysql.so extension is loaded 2 times on /etc/php5/cli/php.ini and /etc/php5/cli/conf.d/mysql.ini

I put ; (semi colon)  in front of the line in /etc/php5/conf.d/mysql.ini

mysql.ini

Keywords:

  • php warning: module mysql already loaded in unknown on line 0
  • php warning: module \mysql\ already loaded in unknown on line 0
  • php warning: module curl already loaded in unknown on line 0
  • PHP Warning: Module \curl\ already loaded in Unknown on line 0
  • Module mysql already loaded in Unknown on line 0
  • php warning: module apc already loaded in unknown on line 0
  • php warning module mysql already loaded in unknown on line 0
  • module curl already loaded in unknown on line 0
  • php warning: module \apc\ already loaded in unknown on line 0
  • php warning module \mysql\ already loaded in unknown on line 0

Filed Under: FeaturedLinuxPHPTechnologyTips and TricksUbuntu

RSSComments (11)

Leave a Reply | Trackback URL

  1. Neto says:

    Thanks!!!!

    I resolved my problem!!!! ;)

  2. Reza Maghsoudi says:

    Thanks, you saved my day

  3. Reza Maghsoudi says:

    But why it’s was happening only in cronjob? do you know?

  4. Ed says:

    @Reza
    The cron is probably using wget -O. An alternative Cron command line command that is safer to use is lynx -source instead of wget -O. You would simply replace the wget command line with lynx -source.

  5. giz says:

    I’m wondering why you chose to disable the conf.d instance, and not the apache one.

    The reason I ask is conf.d is linked (in my case anyway) to several sub php instances (apache2, cli, cgi, )

    So essentially the choice was to disable the mysql extension ‘globally’ as opposed to per instance.

    I’m not an expert here (looking for reasoning so I can attempt intelligent decision making in the future..) just wanted to understand the justification.

    Thanks so much.. by the way this indeed solved my issue.

    Thanks in advance,
    giz

    • kumkum says:

      My reason is because I’m using EHCP (easy hosting control panel) which has script to check php.ini for mysql.so extension. If there is no mysql.so in php.ini, the EHCP script will say no MySQL is running. If you don’t use EHCP, you can disable the php.ini record and keep the one in conf.d.

  6. David says:

    Thank you, i found another instance, but can’t figure it out how it came there :).

  7. SunilJ says:

    Thanks, it’s work for me. But module was “pcntl” I commented the extra line.

    Great :)

Leave a Reply




If you want a picture to show with your comment, go get a Gravatar.