Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

PHP Warning: Module already loaded in Unknown on line 0

Discussion in 'General Discussion' started by SkipperHosting, Oct 12, 2017.

  1. SkipperHosting

    Joined:
    Oct 12, 2017
    Messages:
    6
    Likes Received:
    2
    Trophy Points:
    3
    Location:
    Connecticut
    cPanel Access Level:
    Root Administrator
    I am getting this error in my error_log files, for all of my sites on my VPS; repeatable on every page load:
    Code:
    PHP Warning:  Module 'imagick' already loaded in Unknown on line 0
    Disabling the module entry in "MultiPHP INI Editor" (or manually to the php file at
    /opt/cpanel/ea-php71/root/etc/php.ini) quiets the error. But, imagick is also not loaded, as verified by phpinfo() call.

    I am not suspect of the extension itself. It feels like the system is somehow parsing the php.ini file twice. Has anyone any experience with this before?

    Details:
    One of the logs suggests this started on the morning of Oct 4, as none of these entries exist before that date. Nothingn in the update log stands out as related.

    I have also tried uninstalling and reinstalling imagick module via Module Installer > PECL, in case it added/removed anything elsewhere in the system.

    CentOS 6.9, cPanel 66.0.24, php7.1.8 via EA4
     
  2. 24x7serversecurity

    24x7serversecurity Active Member

    Joined:
    Aug 31, 2015
    Messages:
    39
    Likes Received:
    6
    Trophy Points:
    8
    Location:
    India
    cPanel Access Level:
    Root Administrator
    Hi :),

    Please check if there are any old php.ini files under the cPanel account's public_html, remove/rename if any. It can be the reason for such logs.
     
  3. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    42,782
    Likes Received:
    1,712
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello,

    Are you using any custom php.ini files within the accounts that are facing this error message?

    Thank you.
     
  4. SkipperHosting

    Joined:
    Oct 12, 2017
    Messages:
    6
    Likes Received:
    2
    Trophy Points:
    3
    Location:
    Connecticut
    cPanel Access Level:
    Root Administrator
    I have (4+) sites on this VPS, in various depths of customization. In fact, one is nothing more than a static html splash page. -- But, they all exhibit the same behavior; I do not see any php.ini files in any of the users' directories.

    Sorry, failed to notice that the Oct 4 update also rolled me up to 7.1.10. It is possible this is a problem with that php version. Will note if investigation into that yields any results when compared to previous 7.1.8.

    As a side point, in my case, 'imagick' is the only extension directly loaded by the main ini file. All the other extensions are loaded from the php.d directory.

    Oct 4th does appear to be the date when this stated to manifest in the log. That same morning, cron updated to php7.1.10:
     
  5. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    42,782
    Likes Received:
    1,712
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello,

    Could you open a support ticket using the link in my signature so we can take a closer look?

    Thank you.
     
  6. SkipperHosting

    Joined:
    Oct 12, 2017
    Messages:
    6
    Likes Received:
    2
    Trophy Points:
    3
    Location:
    Connecticut
    cPanel Access Level:
    Root Administrator
    Ticket 8945593 opened with same name.
    Thanks
     
  7. cPAusaf

    cPAusaf Linux Technical Analyst II
    Staff Member

    Joined:
    Aug 24, 2016
    Messages:
    23
    Likes Received:
    1
    Trophy Points:
    78
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    Hello

    Internal case EA-6872 has been opened regarding this issue. I will be sure to add your ticket to this case. I believe this is a recent change where we are now scanning /opt/cpanel/ea-php##/root/etc/ (which ends up causing the module to get loaded twice).
     
  8. SkipperHosting

    Joined:
    Oct 12, 2017
    Messages:
    6
    Likes Received:
    2
    Trophy Points:
    3
    Location:
    Connecticut
    cPanel Access Level:
    Root Administrator
    Thanks for the investigation and interim tweak/hold-over while any top-down system changes are pushed out.
     
  9. srichter

    srichter Member

    Joined:
    Oct 10, 2016
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    New York
    cPanel Access Level:
    Root Administrator
    Could someone share the interim tweak to resolve this issue until EA-6872 is fixed? Thanks
     
  10. SkipperHosting

    Joined:
    Oct 12, 2017
    Messages:
    6
    Likes Received:
    2
    Trophy Points:
    3
    Location:
    Connecticut
    cPanel Access Level:
    Root Administrator
    Bear in mind, this is a workaround if/when an official patch arrives. The relevant portion of the tech's response:

    I have commented out the loading of the ImageMagick extension in the global php.ini file for PHP 7.1. I then went and created the following file:

    ========================
    [~]$ cat /opt/cpanel/ea-php71/root/etc/php.d/imagick.ini
    extension="imagick.so"
    ========================

    The extension is now loading only once. This behavior is being caused by a recent change in which we are now scanning /opt/cpanel/ea-php##/root/etc/, which ends up causing modules to get loaded twice if they are in the global php.ini (which PECL/PEAR will automatically do when installing an extension).​
     
    Metro2 and srichter like this.
  11. srichter

    srichter Member

    Joined:
    Oct 10, 2016
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    New York
    cPanel Access Level:
    Root Administrator
    Thanks, that worked perfectly. Hopefully we see a fix from cPanel soon.
     
  12. GaryE

    GaryE Registered

    Joined:
    Nov 24, 2017
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    New Jersey USA
    cPanel Access Level:
    Root Administrator
    This also worked for php56 by creating the file in ea-php56 instead of 71 thank you
     
  13. Metro2

    Metro2 Well-Known Member

    Joined:
    May 24, 2006
    Messages:
    401
    Likes Received:
    19
    Trophy Points:
    168
    Location:
    USA
    cPanel Access Level:
    Root Administrator
    Wow, I'm losing my mind over here.. if this post needs to be moved to it's own thread, mods, I'm fine with that.. but it's on almost the same exact topic.

    PHP Warning: Module 'imagick' already loaded in Unknown on line 0 is happening with my HelpDesk scripts when a user sends an email to my support address (which is piped for my helpdesks) and also filling up the error_log file within the script folders each time a user emails support.

    This started yesterday right after I installed ImageMagick on my severs via WHM > Software > Module Installers > PHP Pecl and it was successful - made customers who requested imagick on those servers happy.

    But ever since then, the two helpdesk scripts I run are sending the following message to any user who emails my helpdesk support email address:

    Code:
    This message was created automatically by mail delivery software.
    
     A message that you sent could not be delivered to one or more of its
     recipients. This is a permanent error. The following address(es) failed:
    
       pipe to |/home/example/public_html/xx/admin/pipe.php
         generated by support@example.com
    
     The following text was generated during the delivery attempt:
    
     ------ pipe to |/home/example/public_html/xx/admin/pipe.php
            generated by support@example.com ------
    
     PHP Warning:  Module 'imagick' already loaded in Unknown on line 0
    
    Action: failed
     Final-Recipient: rfc822;|/home/example/public_html/xx/admin/pipe.php
     Status: 5.0.0
    
    (Naturally I replaced the user / domain with example for security reasons in the message above).

    The email, however, DOES come through to me and DOES create the ticket in my HelpDesks, and correspondence between me and users still works.

    So found this thread here this morning with the work-around kindly provided in PHP Warning: Module already loaded in Unknown on line 0 above, and I performed these steps:

    Via SSH, I did the following:

    1. Since only the native PHP 5.6 is where I've implemented imagick , I created:

    /opt/cpanel/ea-php56/root/etc/php.d/imagick.ini
    extension="imagick.so"

    2. Edited /usr/local/lib/php.ini to comment-out extension="imagick.so"

    3. restarted apache and ran cagefsctl --force-update (since I'm running CloudLinux , EA4, WHM 68 "Release"

    Problem still existed, so I:

    4. Edited /opt/cpanel/ea-php56/root/etc/php.ini to comment-out extension="imagick.so" there as well.

    5. Did the cagefsctl --force-update and apache restart routine again.

    Problem still exists.

    I thought I had covered all my bases at that point, following the work-around instructions from both this thread and another similar one where the poster mentioned they commented-out the extension in both Global and EA ini files, and just have the module loading from /opt/cpanel/ea-php56/root/etc/php.d/imagick.ini

    I checked phpInfo , php -v , php -m , and everything looks fine. Imagick is showing in phpInfo as loading from /opt/cpanel/ea-php56/root/etc/php.d/imagick.ini and imagick is working correctly for users.

    Still the problem exists, so just for good measure I restated CSF/LFD

    Still the problem persists...

    The emails come through fine, they create tickets in the helpdesk scripts, but every user who emails my support address gets that dreaded "message could not be delivered, PHP Warning: Module 'imagick' already loaded in Unknown on line 0" warning detailed above.

    Can anyone please tell me what I've overlooked here? Have I somehow missed a step?

    I did the same thing that worked for a few other folks in this thread and now losing my mind because as you all know, this time of year, support requests start coming in heavy.

    I'm grateful for any assistance, please and thank you!
     
    #13 Metro2, Dec 20, 2017
    Last edited by a moderator: Dec 20, 2017
  14. SkipperHosting

    Joined:
    Oct 12, 2017
    Messages:
    6
    Likes Received:
    2
    Trophy Points:
    3
    Location:
    Connecticut
    cPanel Access Level:
    Root Administrator
    A couple diagnostic-minded thoughts (and that is they are, as I am certainly no expert when it comes to these things):

    For a test, try to STOP imagick from loading :: When you comment out in ALL the php.ini locations -- and will now have to comment out in the created php.d directory file as well -- does imagick then stop loading? Without actually uninstalling via PECL, can you prevent imagick from loading with modifications to the config files you know about?
    The question is to confirm that the files you are editing are the exhaustive locations for inclusion, and to help determine if the problem is an additional file somewhere, or that one of these php.ini files are being parsed multiple times. If not prevented from loading by editing all the 'known' locations, then some other injection must be happening. Perhaps phpinfo will be able to provide some further clues.

    Also, what about .user.php/.local.php/other per account php files that may also have the directive set to load imagick?
     
  15. Metro2

    Metro2 Well-Known Member

    Joined:
    May 24, 2006
    Messages:
    401
    Likes Received:
    19
    Trophy Points:
    168
    Location:
    USA
    cPanel Access Level:
    Root Administrator
    @SkipperHosting thank you for the friendly advice!

    I have now:

    1. Commented-out extension="imagick.so" in the /opt/cpanel/ea-php56/root/etc/php.d/imagick.ini file I created

    2. Double checked to make sure it's commented out of:
    /usr/lib/php.ini
    /usr/local/lib/php.ini
    /opt/cpanel/ea-php56/root/etc/php.ini
    /opt/cpanel/ea-php56/root/etc/php.d/imagick.ini

    3. Restarted Apache, ran cagefsctl --force-update , restarted apache again , restart CSF/LFD for good measure

    4. Double checked to make sure I don't have any .user.ini or php.ini files in my account (I'm using my actual hosting main site / helpdesk for this test, so it's got nothing to do with any other users - all taking place right in my own account / domain).

    5. As far as I know, there aren't any "per account" custom files applied to my own account.

    And yet still, imagick is enabled staring me straight in the face...

    phpinfo shows in "Additional .ini files parsed" section:
    /opt/cpanel/ea-php56/root/etc/php.d/01-ioncube.ini, /opt/cpanel/ea-php56/root/etc/php.d/02-pecl.ini, /opt/cpanel/ea-php56/root/etc/php.d/bcmath.ini, /opt/cpanel/ea-php56/root/etc/php.d/calendar.ini, /opt/cpanel/ea-php56/root/etc/php.d/ctype.ini, /opt/cpanel/ea-php56/root/etc/php.d/curl.ini, /opt/cpanel/ea-php56/root/etc/php.d/dom.ini, /opt/cpanel/ea-php56/root/etc/php.d/exif.ini, /opt/cpanel/ea-php56/root/etc/php.d/fileinfo.ini, /opt/cpanel/ea-php56/root/etc/php.d/ftp.ini, /opt/cpanel/ea-php56/root/etc/php.d/gd.ini, /opt/cpanel/ea-php56/root/etc/php.d/gettext.ini, /opt/cpanel/ea-php56/root/etc/php.d/iconv.ini, /opt/cpanel/ea-php56/root/etc/php.d/imagick.ini, /opt/cpanel/ea-php56/root/etc/php.d/imap.ini, /opt/cpanel/ea-php56/root/etc/php.d/intl.ini, /opt/cpanel/ea-php56/root/etc/php.d/json.ini, /opt/cpanel/ea-php56/root/etc/php.d/mbstring.ini, /opt/cpanel/ea-php56/root/etc/php.d/mcrypt.ini, /opt/cpanel/ea-php56/root/etc/php.d/mysqlnd.ini, /opt/cpanel/ea-php56/root/etc/php.d/mysqlnd_mysql.ini, /opt/cpanel/ea-php56/root/etc/php.d/mysqlnd_mysqli.ini, /opt/cpanel/ea-php56/root/etc/php.d/pdo.ini, /opt/cpanel/ea-php56/root/etc/php.d/pdo_mysqlnd.ini, /opt/cpanel/ea-php56/root/etc/php.d/pdo_sqlite.ini, /opt/cpanel/ea-php56/root/etc/php.d/phar.ini, /opt/cpanel/ea-php56/root/etc/php.d/posix.ini, /opt/cpanel/ea-php56/root/etc/php.d/simplexml.ini, /opt/cpanel/ea-php56/root/etc/php.d/soap.ini, /opt/cpanel/ea-php56/root/etc/php.d/sockets.ini, /opt/cpanel/ea-php56/root/etc/php.d/sqlite3.ini, /opt/cpanel/ea-php56/root/etc/php.d/tokenizer.ini, /opt/cpanel/ea-php56/root/etc/php.d/xml.ini, /opt/cpanel/ea-php56/root/etc/php.d/xml_wddx.ini, /opt/cpanel/ea-php56/root/etc/php.d/xmlreader.ini, /opt/cpanel/ea-php56/root/etc/php.d/xmlrpc.ini, /opt/cpanel/ea-php56/root/etc/php.d/xmlwriter.ini, /opt/cpanel/ea-php56/root/etc/php.d/xsl.ini, /opt/cpanel/ea-php56/root/etc/php.d/zip.ini

    I'm stumped :(

    But your suggestions / advice were very good thinking, thank you!
     
  16. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    42,782
    Likes Received:
    1,712
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello @Metro2,

    Check to see if a duplicate entry exists for the imagick module in the following file:

    Code:
    /opt/cpanel/ea-php56/root/etc/php.d/02-pecl.ini
    Thank you.
     
    Metro2 likes this.
  17. Metro2

    Metro2 Well-Known Member

    Joined:
    May 24, 2006
    Messages:
    401
    Likes Received:
    19
    Trophy Points:
    168
    Location:
    USA
    cPanel Access Level:
    Root Administrator
    cPanelMichael, I know I've told you this before, but thank you for the awesome help you provide here! Thank you!

    Indeed, sitting hidden (from me anyway) in /opt/cpanel/ea-php56/root/etc/php.d/02-pecl.ini was sitting extension="imagick.so"

    So I've just commented that out, checked phpInfo, and it turned off imagick (but still shows my workaround file for parsing at /opt/cpanel/ea-php56/root/etc/php.d/02-pecl.ini ) so I'm going to now try uncommenting imageick in just that file and bring my helpdesk piping back online to see if things will work without the errant emails being sent to users... I'll report back in case my peculiar situation might help anyone else.
     
  18. Metro2

    Metro2 Well-Known Member

    Joined:
    May 24, 2006
    Messages:
    401
    Likes Received:
    19
    Trophy Points:
    168
    Location:
    USA
    cPanel Access Level:
    Root Administrator
    Thanks to everyone in this thread, and especially SkipperHosting for posting the workaround from tech and cPanelMichael for providing the last missing piece of the puzzle (which I would have probably not found for days, if ever) , here's the work-around that works for me on WHM 68 / CloudLinux / EA4 ...

    I had to...

    1. Make sure extension="imagick.so" is commented-out from these:

    /usr/lib/php.ini
    /usr/local/lib/php.ini
    /opt/cpanel/ea-php56/root/etc/php.ini
    /opt/cpanel/ea-php56/root/etc/php.d/02-pecl.ini

    2. Make sure extension="imagick.so" is not commented out in:

    /opt/cpanel/ea-php56/root/etc/php.d/imagick.ini

    3. Run

    /usr/sbin/cagefsctl --force-update

    4. Restart Apache

    Now my users can send email to my support addresses at all my helpdesk scripts without receiving a "could not deliver, PHP Warning: Module 'imagick' already loaded in Unknown on line 0" message back to them, and I've re-opened normal operation of my helpdesks.

    Thank you guys so much! You guys have no idea how grateful I am right now... the sleep depravation and holiday support overload was already taking a toll, and this was really putting a hurt on me. Wow, maybe I can go get a couple hours of sleep now. THANK YOU!
     
    cPanelMichael likes this.
Loading...

Share This Page