致命错误:找不到“想象力”类

时间:2022-10-31 08:55:59

I am trying to install imagemagic php extension under WampServer 2.

我想在WampServer 2下安装imagemagic php扩展。

  • I've downloaded and installed ImageMagick . I've chosen ImageMagick-6.8.8-10-Q16-x86-dll.exe

    我已经下载并安装了ImageMagick。我选择了ImageMagick-6.8.8-10-Q16-x86-dll.exe

  • I've downloaded the php extension.

    我已经下载了php扩展程序。

  • I've moved the dll extension I just downloaded to C:\wamp\bin\php\php5.4.16\ext\

    我已经将我刚刚下载的dll扩展名移到了C:\ wamp \ bin \ php \ php5.4.16 \ _分机

  • I've altered php.ini (accessed it through wamp tray icon > right-click > PHP > php.ini) and added "extension=php_imagick.dll", without the quotes, to the extensions lists.

    我已经改变了php.ini(通过wamp tray icon>右键单击> PHP> php.ini访问它)并将“extension = php_imagick.dll”(不带引号)添加到扩展名列表中。

  • I restarted Apache. Not noticing the extension displayed on the PHP extensions list from the tray icon, I restarted the wampserver. ImageMagick extensions now shows enabled on the list.

    我重新启动了Apache。没有注意到托盘图标上PHP扩展列表上显示的扩展名,我重新启动了wampserver。 ImageMagick扩展现在显示在列表上启用。

However, I cannot use it. Doing a quick test returns "Fatal error: Class 'Imagick' not found". In the phpinfo() shows only that the imagemagick has been added to env variables.

但是,我无法使用它。快速测试会返回“致命错误:未找到类'Imagick'”。在phpinfo()中只显示了imagemagick已添加到env变量中。

when I try to test the imagick :

当我试图测试想象力时:

$im = new imagick( 'test.jpg' );
// resize by 200 width and keep the ratio
$im->thumbnailImage( 200, 0);
 // write to disk
$im->writeImage( 'test_thumbnail.jpg' );

I get the error:Fatal error: Class 'imagick' not found What am I doing wrong? I'm working with win7 32 bit, phph 5-4-16 and apache2

我收到错误:致命错误:没有找到“想象力”类我做错了什么?我正在使用win7 32位,phph 5-4-16和apache2

5 个解决方案

#1


8  

  • Try: php -m | grep imagick.
  • 试试:php -m | grep imagick。

  • If the result is empty do: sudo apt-get remove --purge php5-imagick && sudo apt-get install php5-imagick
  • 如果结果为空,请执行:sudo apt-get remove --purge php5-imagick && sudo apt-get install php5-imagick

Regards

#2


1  

The only way that I make it works is by using an older version of imagick:php_imagick-3.2.0b1-5.4-nts-vc9-x86.

我使它工作的唯一方法是使用旧版本的imagick:php_imagick-3.2.0b1-5.4-nts-vc9-x86。

#3


0  

do a <?php phpinfo(); ?> in any page. This will show all the services running on the service. If it is running then it will show you in which directory.

做一个 在任何页面中。这将显示服务上运行的所有服务。如果它正在运行,那么它将显示在哪个目录中。

If you are using WHM panel you might have to install imageMagick there

如果您使用的是WHM面板,则可能需要在那里安装imageMagick

#4


-1  

Did you try using the proper casing for the class, starting with capital "i"?

你是否尝试过使用合适的套管,从资本“i”开始?

$im = new Imagick( 'test.jpg' );

In php, class and files names and not case-sensitive, but classloaders are.

在php,类和文件名中并不区分大小写,但类加载器是。

#5


-1  

apt-get install pkg-config libmagickwand-dev -y
cd /tmp
wget https://pecl.php.net/get/imagick-3.4.0.tgz
tar xvzf imagick-3.4.0.tgz
cd imagick-3.4.0
phpize
./configure
make install
rm -rf /tmp/imagick-3.4.0*
echo extension=imagick.so >> /etc/php/7.0/cli/php.ini
echo extension=imagick.so >> /etc/php/7.0/fpm/php.ini
service php7.0-fpm restart
service nginx restart

from Install Imagick 3.4.0 on PHP 7

在PHP 7上安装Imagick 3.4.0

#1


8  

  • Try: php -m | grep imagick.
  • 试试:php -m | grep imagick。

  • If the result is empty do: sudo apt-get remove --purge php5-imagick && sudo apt-get install php5-imagick
  • 如果结果为空,请执行:sudo apt-get remove --purge php5-imagick && sudo apt-get install php5-imagick

Regards

#2


1  

The only way that I make it works is by using an older version of imagick:php_imagick-3.2.0b1-5.4-nts-vc9-x86.

我使它工作的唯一方法是使用旧版本的imagick:php_imagick-3.2.0b1-5.4-nts-vc9-x86。

#3


0  

do a <?php phpinfo(); ?> in any page. This will show all the services running on the service. If it is running then it will show you in which directory.

做一个 在任何页面中。这将显示服务上运行的所有服务。如果它正在运行,那么它将显示在哪个目录中。

If you are using WHM panel you might have to install imageMagick there

如果您使用的是WHM面板,则可能需要在那里安装imageMagick

#4


-1  

Did you try using the proper casing for the class, starting with capital "i"?

你是否尝试过使用合适的套管,从资本“i”开始?

$im = new Imagick( 'test.jpg' );

In php, class and files names and not case-sensitive, but classloaders are.

在php,类和文件名中并不区分大小写,但类加载器是。

#5


-1  

apt-get install pkg-config libmagickwand-dev -y
cd /tmp
wget https://pecl.php.net/get/imagick-3.4.0.tgz
tar xvzf imagick-3.4.0.tgz
cd imagick-3.4.0
phpize
./configure
make install
rm -rf /tmp/imagick-3.4.0*
echo extension=imagick.so >> /etc/php/7.0/cli/php.ini
echo extension=imagick.so >> /etc/php/7.0/fpm/php.ini
service php7.0-fpm restart
service nginx restart

from Install Imagick 3.4.0 on PHP 7

在PHP 7上安装Imagick 3.4.0