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, changing it to Off will solve the problem.
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: