So, your installation in general works so that you can display the output from a PHP script-- even phpinfo(); works. Great start. If not, you likely have bigger problems or are compiling imagick into PHP. Best of luck.
But, back to where we are; PHP in general works, except the imagick extension isn't working or needs installed or something.
There is some very helpful information in the phpinfo(); output blocks.
(If phpinfo(); means nothing to you, hit the google. We'll wait.)
Notably the php.ini that PHP is using can be found there, very important. --Many instructions will tell you to put "extension=imagick" into it.
Better would be to create an imagick.ini file (that has "extension=imagick" inside) in the directory scanned for additional .ini files.
This is nice when the machine you are working on has multiple php.ini files and unused configurations littered about. phpinfo(); will tell you where the resources being used can be located in the file system.
Helpful to me, thought I'd share...