Solved

Php Access to Imagick extension

Posted on 2014-07-22
14
232 Views
Last Modified: 2014-07-23
Hi E's,
I have installed imagemagick in my server, and for I access to imagemagick I use this code (one example):
exec("/usr/local/bin/convert $cmd $imfinal"); 

Open in new window

The problem is, I want to start to use Imagick class, and try to run scripts like this (one example):
$im = new imagick( $input ); 
$distort = array( 180.0, 0.0 );
$im->setImageVirtualPixelMethod( Imagick::VIRTUALPIXELMETHOD_TRANSPARENT );
$im->setImageMatte( TRUE );
$im->distortImage( Imagick::DISTORTION_ARC, $distort, TRUE ); 
$im->writeImage( $imfinal ); 
$im->destroy(); 

Open in new window

When I execute the above code, I receive this error:Fatal error: Class 'imagick' not found in /home/saidia/public_html/controle/teste.php on line. The error is from this line:
$im = new imagick( $input ); 

Open in new window

So my question is, what I have to do for start to work with the imagick class? or what I have to say in my VPN support for the install that for me?
Note: my system is linux.

The best regards, JC
0
Comment
Question by:Pedro Chagas
  • 9
  • 5
14 Comments
 
LVL 58

Accepted Solution

by:
Gary earned 500 total points
ID: 40212801
Do you have the imagemagick module in your php.ini file

extension=imagick.so
0
 
LVL 3

Author Comment

by:Pedro Chagas
ID: 40212859
Hi Gary,
no!

~JC
0
 
LVL 3

Author Comment

by:Pedro Chagas
ID: 40212871
In some part of the text in php.ini I have this text:
;;;;;;;;;;;;;;;;;;;;;;
; Dynamic Extensions ;
;;;;;;;;;;;;;;;;;;;;;;
; if you wish to have an extension loaded automaticly, use the
; following syntax:  extension=modulename.extension
; for example, on windows,
extension = "pdo.so"
extension = "pdo_sqlite.so"
extension = "sqlite.so"
extension = "pdo_mysql.so"
extension = "stemmer.so"
; or under UNIX,
; Note that it should be the name of the module only, no directory information
; needs to go here.  Specify the location of the extension with the extension_dir directive above.

Windows Extensions
;Note that MySQL and ODBC support is now built in, so no dll is needed for it.
;
0
 
LVL 58

Expert Comment

by:Gary
ID: 40212888
Just add that line to the end of your php.ini
0
 
LVL 3

Author Comment

by:Pedro Chagas
ID: 40212921
Hi Gary:
I did in this way:php.iniI try to execute the script and I receive the same fatal error, when I try to call the class Imagick.
Also I try in this two ways:
extension="imagick.so"
and
extension=imagick.so
Maybe I have to do a reboot of the server?

~JC
0
 
LVL 58

Expert Comment

by:Gary
ID: 40212928
You'll need to restart Apache, not the server
0
 
LVL 3

Author Comment

by:Pedro Chagas
ID: 40212955
Hi again Gary,
I have try first with commas
extension="imagick.so"
, and restart apache, not work.
Later I try without commas
extension=imagick.so
, and restart again and not work.
After that I open the advance mode of php.ini, and I can see the imagick extension, like you can see in this image:php.ini advanced modeWhat is wrong?

~JC
0
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 58

Expert Comment

by:Gary
ID: 40212971
What do you mean with commas?
What version of linux are your running?
If you load a phpinfo page in your browser does it show in the extensions?
0
 
LVL 3

Author Comment

by:Pedro Chagas
ID: 40212991
I'm sorry, is not commas, was quotation marks "".
The linux is:
Linux host.fotosdeportugal.net 2.6.18-028stab101.1 #1 SMP Sun Jun 24 19:50:48 MSD 2012 i686
The phpinfo not show the extension!!!

You think I should ask for support of my server, why does not appear the extension in the phpinfo?

Also, I try to execute some scripts from php.net, and the error still the same. So the code is well written.

~JC
0
 
LVL 3

Author Comment

by:Pedro Chagas
ID: 40212993
php version:
5.3.20
0
 
LVL 58

Expert Comment

by:Gary
ID: 40213027
Do you have shell access? Can you restart apache from the command line - do you get any error messages, or check the apache error log.

How did you install imagemagick?

Is this Centos, Ubuntu...?
0
 
LVL 3

Author Comment

by:Pedro Chagas
ID: 40213040
I request to support for they install imagemagick.

I have access to the shell, but I'm not used to working.

I send a support ticket to the VPN support, and asked why the extension not appear in phpinfo. I'm waiting for a answer, I give you feedback when I have a answer from them.
0
 
LVL 3

Author Comment

by:Pedro Chagas
ID: 40213657
Hi Garry,
The answer from VPN support:
Hello,

I can verify that imagick is installed current:

---
cP/vz37-tx/2489 root@67.222.1.227 [~]# convert --version
Version: ImageMagick 6.2.8 05/07/12 Q16 file:/usr/share/ImageMagick-6.2.8/doc/index.html
Copyright: Copyright (C) 1999-2006 ImageMagick Studio LLC
---


Have you attempted to modify your script as previously noted?

Can you provide the guide you have been using for the changes you made to the php.ini?
What you need to know from the server to help me?
~JC
0
 
LVL 3

Author Closing Comment

by:Pedro Chagas
ID: 40214934
Thank you Gary for your time.
The support of my VPS resolve the problem, I have now access to the Imagick Class.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

One of the typical problems I have experienced is when you have to move a web server from one hosting site to another. You normally prepare all on the new host, transfer the site, change DNS and cross your fingers hoping all will be ok on new server…
When it comes to showing a 404 error page to your visitors, you do not want that generic page to show, and you especially do not want your hosting provider’s ad error page to show either. In this article, I will show you how to enable the custom 40…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now