Home > Article > Backend Development > Solution to cloneable Trying to clone an uncloneable object of class Imagic
After installation under windows, the prompt is:
Fatal error: Trying to clone an uncloneable object of class Imagick in C:wwwhxpdf_to_png.php on line 17
This prompt will appear when using IIS and Apache. After many tests, two solutions were found:
1.php.ini; Enable compatibility mode with Zend Engine 1 (PHP 4.x)
zend.ze1_compatibility_mode = Off
The default is On, after changing it to Off , can be solved.
2. Use imagick::... to call.
That is, $im->setResolution(120, 120); can be rewritten as:
imagick::setResolution(120, 120);
If this kind of error occurs in other extensions, these two methods can generally be used to solve it. .
Attached is the program code snippet for converting pdf to png:
Copy the code The code is as follows:
'imagick') ) {
exit('no imagick'); return false; (120, 120); '); I $ im-& gt; writeImage ($ filename); Czos, 1);, $ im ->writeImage($filename);
return $filename;
The above introduces the solution to cloneable Trying to clone an uncloneable object of class Imagic, including cloneable content. I hope it will be helpful to friends who are interested in PHP tutorials.