简体   繁体   English

PHP 警告:模块“imagick”已加载到第 0 行的未知中

[英]PHP Warning: Module 'imagick' already loaded in Unknown on line 0

I have a simple test file where the only php codes are:我有一个简单的测试文件,其中唯一的 php 代码是:

if (isset($_REQUEST['back']) && ($back != '')) { $back = $_REQUEST['back']; }
$filename = 'images/'.$back.'.jpg';
$file = (file_exists($filename)) ? $back : 'back1';

Now each time I run the file, I get this line added PHP Warning: Module 'imagick' already loaded in Unknown on line 0 in my error log.现在每次运行该文件时,都会添加此行PHP Warning: Module 'imagick' already loaded in Unknown on line 0 in my error log。 Any suggestion please?有什么建议吗?

open your php.ini file and comment this打开您的 php.ini 文件并对此发表评论

;extension=imagick.so

this resolved my problem这解决了我的问题

extension=imagick.so did not exist in my php.ini, so I solved it by re-installing imagick (3.4.4) using WHM under Home >> Software >> Module Installers - "PHP Pecl" Installer. extension=imagick.so在我的 php.ini 中不存在,所以我通过在 Home >> Software >> Module Installers - "PHP Pecl" Installer 下使用 WHM 重新安装imagick (3.4.4)解决了这个问题。

No more errors (so far).没有更多的错误(到目前为止)。

Just for the record as it might help others who are on shared hosting (cPanel).仅作记录,因为它可能会帮助使用共享主机 (cPanel) 的其他人。

I had error on shared hosting php7.2: Module 'imagick' already loaded in Unknown on line 0我在共享主机 php7.2 上遇到错误:模块 'imagick' 已经加载到第 0 行的未知中

In the beginning hosting provider said it was my bad configuration (running Yii2.16).一开始托管服务提供商说这是我的错误配置(运行 Yii2.16)。 But after I showed them, that all Internet related this issue to server configuration -they started to listen to me.但在我向他们展示之后,所有互联网都将这个问题与服务器配置相关联——他们开始听我的。 After I proved, that there was no error on php7.1 they started to search for the error.在我证明了php7.1没有错误之后,他们开始搜索错误。

They confirmed, that they updated (before error) 7.2 to new version (7.2.14), what fixed some other bugs, but Imagick error started to appear.他们确认,他们将(错误之前)7.2 更新到新版本(7.2.14),修复了一些其他错误,但 Imagick 错误开始出现。 Now they found fix to that also.现在他们也找到了解决办法。 As they told to me - the error was in configuration of PERL modules or PEAR package, but they did not tell me the real issue.正如他们告诉我的那样 - 错误出现在 PERL 模块或 PEAR package 的配置中,但他们没有告诉我真正的问题。

Solution, if you are on shared hosting - talk to you provider and experiment with PHP versions (if you can change them).解决方案,如果您在共享主机上 - 与您的提供商交谈并试用 PHP 版本(如果您可以更改它们)。

make sure you just actived imagick just once.确保您只激活了一次 imagick。
if windows:如果 windows:
active extension=php_imagick.dll and comment/remove like ;extension=imagick活动extension=php_imagick.dll和评论/删除喜欢;extension=imagick
follow this tutorial 按照本教程

After installing the imagick extension for PHP.安装 PHP 的 imagick 扩展后。 When i perform php-fpm -v , I had the same problem, as follows:当我执行php-fpm -v时,我遇到了同样的问题,如下:

[root@localhost]# php-fpm -v
[10-Oct-2018 16:00:33] NOTICE: PHP message: PHP Warning:  Module 'imagick' already loaded in Unknown on line 0

Because i created echo extension=imagick.so >> php.ini and echo extension=imagick.ini manually when i installed the imagick extension for PHP.因为我在安装 PHP 的 imagick 扩展时手动创建了echo extension=imagick.so >> php.iniecho extension=imagick.ini imagick.ini。 I will delete imagick.ini now, restart php.我现在将删除imagick.ini ,重新启动php。 It's solve!解决了!

These libraries may also be loaded using ini files in /etc/php.d.这些库也可以使用 /etc/php.d 中的 ini 文件加载。 Be sure it is not in a file here AND in php.ini.确保它不在此处和 php.ini 中的文件中。

By tedious moments about this problem, I've found a solution that might be able to repair a system if you tried to uninstall and install ImageMagick with PECL and also having sort of problems here with the imagick.so file.通过关于这个问题的乏味时刻,我找到了一个解决方案,如果您尝试使用 PECL 卸载和安装 ImageMagick 并且在 imagick.so 文件中也有一些问题,则该解决方案可能能够修复系统。 . . Because of dumbly "source installing" on a server with CPanel to actually get WebP support.因为在带有 CPanel 的服务器上愚蠢地“安装源代码”才能真正获得 WebP 支持。

But you don't need to replicate my way down below maybe all you only need to do:但是您不需要在下面复制我的方法,也许您只需要做所有事情:

Is actually to reinstall this module in EasyApache 4 as of speaking:实际上是在EasyApache 4中重新安装这个模块:

mod_lsapi mod_lsapi

After you reinstall the mod you will be able to reset the php.ini files by that module in the system.重新安装该模块后,您将能够通过系统中的该模块重置 php.ini 文件。 Then it is easy to wait for another full error_log which likely wouldn't happen from now.然后很容易等待另一个完整的 error_log 从现在开始可能不会发生。

Option 2:选项 2:

I've tried to remove all rpm with yum and even PECL uninstall and used ImageMagick as source files that installed the whole system wrong at the beginning.我尝试使用 yum 甚至卸载 PECL 删除所有 rpm,并使用 ImageMagick 作为源文件,一开始就安装了整个系统错误。 It's hard for the ImageMagick source to find the right place to put the imagick.so file in the extension folder. ImageMagick 源代码很难找到将 imagick.so 文件放入扩展文件夹的正确位置。 As it is in another directory with CPanel:因为它在另一个带有 CPanel 的目录中:

/opt/cpanel/ea-php74/root/usr/lib64/php/modules

You might want to uninstall all.rpm with ".Important that only if you already made that from source in your Cpanel system."您可能希望使用“.Important that only if you have been made from source in your Cpanel system.”来卸载 all.rpm。 That is only when you have tried source install.仅当您尝试过源安装时。

yum remove ImageM* 

And install from source Imagick.并从源代码安装。 If you can't do it make ImageMagick from source with enabling shared.如果你不能这样做,请从源代码中制作 ImageMagick 并启用共享。 Also, you will have to remove the module ImageMagick from PECL after making a source install.此外,在进行源代码安装后,您必须从 PECL 中删除模块 ImageMagick。 And make sure imagick.so is still in this directory when the module is still installed with PECL before you uninstall and use source version of ImageMagick:在卸载并使用 ImageMagick 的源版本之前,请确保 imagick.so 仍然在此目录中,而该模块仍使用 PECL 安装:

cp /opt/cpanel/ea-php74/root/usr/lib64/php/modules/imagick.so /root/tmp
cp /root/tmp/imagick.so /opt/cpanel/ea-php74/root/usr/lib64/php/modules

To find your own module folder use:要查找您自己的模块文件夹,请使用:

php -i | grep extension_dir

Remember I've used the php74 version and with CPanel, as this problem only exists for these users of CPanel or users with php74 in a different location.请记住,我使用的是 php74 版本和 CPanel,因为这个问题只存在于这些 CPanel 用户或在不同位置使用 php74 的用户。 And use the right PHP version instead of php74.并使用正确的PHP版本代替php74。

To make the shared enable install ImageMagick source correctly by:要使共享启用正确安装 ImageMagick 源代码:

./configure --enable-shared
make 
make install

I don'n know why, but I had two imagick.ini files in /etc/php.d/我不知道为什么,但我在 /etc/php.d/ 中有两个 imagick.ini 文件

    # ls -l /etc/php.d/*imag*
    -rw-r--r--. 1 root root  21 15. Aug 11:46 /etc/php.d/20-imagick.ini
    -rw-r--r--. 1 root root 530 12. Jan 2022  /etc/php.d/40-imagick.ini

I commented out one我注释掉了一个

extension=imagick.so

line in one of these files and the error was gone.这些文件之一中的行,错误消失了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 PHP 警告:模块已在第 0 行的未知中加载 - PHP Warning: Module already loaded in Unknown on line 0 接收PHP警告:模块'[模块名称]'已在第0行的未知中加载 - Receiving PHP Warning: Module '[module name]' already loaded in Unknown on line 0 PHP警告:模块“ zip”已在第0行的Unknown中加载 - PHP Warning: Module 'zip' already loaded in Unknown on line 0 Symfony 3 PHP警告:模块'intl'已在第0行的Unknown中加载 - Symfony 3 PHP Warning: Module 'intl' already loaded in Unknown on line 0 PHP警告:模块'modulename'已在第0行的Unknown中加载 - PHP Warning: Module 'modulename' already loaded in Unknown on line 0 PHP警告:模块“ soap”已在第0行的Unknown中加载 - PHP Warning: Module 'soap' already loaded in Unknown on line 0 PHP 警告:模块“memcached”已加载到第 0 行的未知中 - PHP Warning: Module 'memcached' already loaded in Unknown on line 0 PHP 警告:模块“oci8”已加载到第 0 行的“未知”中 - PHP Warning: Module 'oci8' already loaded in Unknown on line 0 遇到 PHP 错误严重性:核心警告消息:模块“ffmpeg”已加载文件名:未知行号:0 回溯 - A PHP Error was encountered Severity: Core Warning Message: Module 'ffmpeg' already loaded Filename: Unknown Line Number: 0 Backtrace PHP 模块已加载警告 - PHP module is already loaded warning
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM