note 112310 added to imagick.installation

From: Date: Thu, 30 May 2013 20:55:02 +0000
Subject: note 112310 added to imagick.installation
Groups: php.notes 
Request: Send a blank email to php-notes+get-195003@lists.php.net to get a copy of this message
There is a big disclaimer that should be made to all those about to venture on ImageMagick programming: the great, vast majority of WAMP do not support ImageMagick commands at all, since it is a "different package," and there appears to be no way to install ImageMagick through standard Add/Remove Applications within Linux (as far as standard Debian linux releases go). It's very easy to get Apache/PHP running in either Windows or Linux with pretty much any standard OS/distro supported so that you can run all of your own code on your own computer. But that's not the case with Apache/PHP/Imagick at all! It took me almost an entire week just to get Apache/PHP/ImageMagick working all together nice and happily so that I could run my own PHP code on my own machine (natively, too). So, I decided to simply write down the steps, to help anyone else out who could need help. 1. Install CentOS 6.4. (Theoretically, other versions of CentOS should work as well, but I simply chose the most recent one.) Also, you can very easily emulate CentOS within Windows (for instance, the unfree choice of VMWare). 2. Install PHP, PHP-Common, PHP-extensions, etc., from standard Application Package Manager ("Add/Remove Programs", usually in system tools somewhere). (You don't have to worry about Apache, because that comes with CentOS 6.4 anyway.) 3. Open up a terminal and enter admin mode with the command "su". You'll need a password for this. 4. Enter this command: yum install ImageMagick ImageMagick-devel 5. Enter this command: pecl install imagick 6. Modify php.ini and include the line "extension=imagick.so". This file is located at "/etc/php.ini" normally. The line must be exactly inserted in the section of "Dynamic Extensions", which begins with this commented out text: -------------------------------- ;;;;;;;;;;;;;;;;;;;;;; ; Dynamic Extensions ; ;;;;;;;;;;;;;;;;;;;;;; -------------------------------- Add the extension below the commented out note in this section so that the result looks like: -------------------------------- ;;;; ; Note: packaged extension modules are now loaded via the .ini files ; found in the directory /etc/php.d; these are loaded by default. ;;;; extension=imagick.so -------------------------------- Putting the extension directly at the top caused me serious permission issues in running Imagick code. Also, with CentOS, the permissions automatically disable user control for this php.ini. Enter the following terminal command: "chown [YOUR-USERNAME] -R /etc/php.ini", without the quotes to get control to modify it. Note to insert your username where it states "YOUR-USERNAME". 7. Enter this command: "service httpd restart", without quotes, from admin mode. This restarts everything now that you've installed ImageMagick. If this gives you an error, just try "service httpd start". The root directory of your public files is located at /var/www/html/. Normally, this folder is not owned by the user, so you'll get a permission error when trying to add files or folders to it. Correct that with entering admin mode in the terminal/command-line window ("su" command) and entering the following command: "chown [YOUR-USERNAME] -R /var/www/html/", without quotes. To view your root directory files as compiled, resultant, PHP pages, open up a browser and enter "127.0.0.1" as the address. If you get a "could not connect" error message, try the command "service httpd start" at the terminal window from admin mode. I hope this helps! I tried a hundred different guides on this and none of them worked. Don't give up! ImageMagick is a package of really neat imaging functions! ---- Server IP: 69.147.83.199 Probable Submitter: 68.14.150.111 ---- Manual Page -- http://php.net/manual/en/imagick.installation.php Edit -- https://master.php.net/note/edit/112310 Del: integrated -- https://master.php.net/note/delete/112310/integrated Del: useless -- https://master.php.net/note/delete/112310/useless Del: bad code -- https://master.php.net/note/delete/112310/bad+code Del: spam -- https://master.php.net/note/delete/112310/spam Del: non-english -- https://master.php.net/note/delete/112310/non-english Del: in docs -- https://master.php.net/note/delete/112310/in+docs Del: other reasons-- https://master.php.net/note/delete/112310 Reject -- https://master.php.net/note/reject/112310 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#195003) next »