Apache / PHP / Imagick
-
- Posts: 7
- Joined: 2013-05-28T16:41:06-07:00
- Authentication code: 6789
Apache / PHP / Imagick
Hello, all,
I've written a significant bit of code in PHP to create an HTML-based GUI for the simple effects functions of ImageMagick available within PHP. However, this is complicated by the fact that it's incredibly difficult to get these three pieces of technology to work together: Apache, PHP, and ImageMagick. It works on a webhost, but not on a client PC. Even when I'm on a Linux system, like Kubuntu/Ubuntu, the system crashes upon trying to download ImageMagick through Applications Manager. On Windows, I'm able to get Apache and PHP functioning, but not in collaboration with ImageMagick.
Other things I've tried...
Downloading and installing every possible combination of Apache and PHP, in Linux and Windows, and then trying with ImageMagick. (Apache 2.0, 2.2; PHP version 5.2.3, 5.3, 5.4, and 5.5.) I've also tried various, different DLL's directly for the "ext" folder in PHP. One of them, 4mb, actually worked, but it couldn't do effects; it was limited to only opening images and resizing icons.
JQMagic: Doesn't work on Firefox, Chrome, or IE (tried with multiple versions).
This guide, and a thousand others like it : http://www.elxsy.com/2009/07/installing ... p-imagick/
It's been three days since I've started working on this problem. Does anyone have any solutions that they know work?
Thank you,
I've written a significant bit of code in PHP to create an HTML-based GUI for the simple effects functions of ImageMagick available within PHP. However, this is complicated by the fact that it's incredibly difficult to get these three pieces of technology to work together: Apache, PHP, and ImageMagick. It works on a webhost, but not on a client PC. Even when I'm on a Linux system, like Kubuntu/Ubuntu, the system crashes upon trying to download ImageMagick through Applications Manager. On Windows, I'm able to get Apache and PHP functioning, but not in collaboration with ImageMagick.
Other things I've tried...
Downloading and installing every possible combination of Apache and PHP, in Linux and Windows, and then trying with ImageMagick. (Apache 2.0, 2.2; PHP version 5.2.3, 5.3, 5.4, and 5.5.) I've also tried various, different DLL's directly for the "ext" folder in PHP. One of them, 4mb, actually worked, but it couldn't do effects; it was limited to only opening images and resizing icons.
JQMagic: Doesn't work on Firefox, Chrome, or IE (tried with multiple versions).
This guide, and a thousand others like it : http://www.elxsy.com/2009/07/installing ... p-imagick/
It's been three days since I've started working on this problem. Does anyone have any solutions that they know work?
Thank you,
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Apache / PHP / Imagick
IE is not a stable platform for JQMagick. But it should work on Firefox and Chrome if you have a current version of these browsers.JQMagic: Doesn't work on Firefox, Chrome, or IE (tried with multiple versions).
Perhaps you can tell us your platform and version of the browsers.
I have no trouble running it on my Mac with Safari, Firefox. Chrome or Opera. There were some recent changes to IM that may cause some of the filters to work incorrectly. I have not had time to review or update. However, the basic JqMagick should be working.
Imagick is not a product of the ImageMagick team. It has not been kept up well. But be sure to get the latest version. http://pecl.php.net/package/imagick/3.1.0RC2
-
- Posts: 7
- Joined: 2013-05-28T16:41:06-07:00
- Authentication code: 6789
Re: Apache / PHP / Imagick
I agree with you on the IE, absolutely. Was just listing it as another alternative. The firefox is a bit old -- 3.5, but it's the most updated one with appropriate javascript handling. Chromium 5.0.375.127, which isn't as recent as it should be.fmw42 wrote:IE is not a stable platform for JQMagick. But it should work on Firefox and Chrome if you have a current version of these browsers.JQMagic: Doesn't work on Firefox, Chrome, or IE (tried with multiple versions).
Perhaps you can tell us your platform and version of the browsers.
Also, the issues are standard Javascript issues: the effect performs fine, but the "performing effects" textbox never gets removed (in Firefox) and after performing effects, black boxes randomly float over the image (in Chromium). That's why I programmed my own version, which works, completely perfectly and without interruption.
I'm not looking for a replacement for something that already works. I'm looking for a replacement for ImageMagick's interaction with PHP, Linux, and Windows.
Do you know any client-side Linux distros that handle Imagick? Or do you know that any of these work? http://en.wikipedia.org/wiki/Comparison_of_WAMPs
Thanks,
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Apache / PHP / Imagick
Sorry I am not a Windows user. So cannot help. But others on the forum can probably make suggestions for you. Perhaps users Bonzo or Snibgo can help.Do you know any client-side Linux distros that handle Imagick? Or do you know that any of these work? http://en.wikipedia.org/wiki/Comparison_of_WAMPs
With respect to JqMagick it needs the most current browsers to work properly with jquery.
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Apache / PHP / Imagick
All my ImageMagick work is via the command-line interface. Sorry, I can't advise on other interfaces.
snibgo's IM pages: im.snibgo.com
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Apache / PHP / Imagick
From my colleague Jd on the JqMagick project:
"Indeed Wamp + Imagemagick on PC is not a love affair... I've tried for weeks and it doesn't work properly.
As for Jqmagick, he's using firefox 3+ when Firefox is at version 21..."
"Indeed Wamp + Imagemagick on PC is not a love affair... I've tried for weeks and it doesn't work properly.
As for Jqmagick, he's using firefox 3+ when Firefox is at version 21..."
Re: Apache / PHP / Imagick
I use XAMPP and have been using with Imagemagick for years with XP, Vista and now Windows 7. Every time I have just installed it and it works.
Imagick is a different problem and had it working for a while but when I formatted my PC last time I could not get it to work and to be honist I am not that interested in it.
Imagick is a different problem and had it working for a while but when I formatted my PC last time I could not get it to work and to be honist I am not that interested in it.
I assume this means Imagick is your problem and not Imagemagick.I've also tried various, different DLL's directly for the "ext" folder in PHP.
-
- Posts: 7
- Joined: 2013-05-28T16:41:06-07:00
- Authentication code: 6789
Re: Apache / PHP / Imagick
You are correct. I just tried CentOS. After installing Imagick, I can't boot anymore and I get the error "Could not update /var/lib/gdm/.ICEAuthority" upon attempts to do so. I'm curious how anyone gets it to work.I assume this means Imagick is your problem and not Imagemagick.
Re: Apache / PHP / Imagick
I think the main problem is it lacks support and is not developed or maintained by the Imagemagick developers.
From what I understand the Imagick dll is compiled with either Visual basic 9 or 12? You need the correct one of these and also the correct dll for your version of php.
I could not find a library of the different versions of the dll when I was looking before and after randomly trying all the dll's I could find I gave up.
From what I understand the Imagick dll is compiled with either Visual basic 9 or 12? You need the correct one of these and also the correct dll for your version of php.
I could not find a library of the different versions of the dll when I was looking before and after randomly trying all the dll's I could find I gave up.
-
- Posts: 7
- Joined: 2013-05-28T16:41:06-07:00
- Authentication code: 6789
Re: Apache / PHP / Imagick
I have a new strategy to get this working. Try to mimic any shared host reseller's configuration, particularly where I already have an account with perfectly functioning online PHP, hostgator. That means: PHP 5.2.17 along with Imagick 3.0.1. I'll try this today and see what happens.
I've spent quite a bit of time getting this to work, and I appreciate everyone's responses.
Specific Versions that somehow work for HostGator in getting Imagick running:
Apache: 2.2.23
CentOS: CentOS release 6.4 (Final)
cPanel: 11.34.1 (build 14)
Curl: 7.12.1
MySQL: 5.5.23
phpMyAdmin: 3.4.11.1
Python: 2.6.6
Perl: 5.8.8
PHP: 5.2.17
ionCube Loader: 4.2.2
Zend Optimizer: 3.3.9
Ruby: 1.8.7
Rails: 2.3.18
OpenSSL: 1.0.0-fips
I've spent quite a bit of time getting this to work, and I appreciate everyone's responses.
Specific Versions that somehow work for HostGator in getting Imagick running:
Apache: 2.2.23
CentOS: CentOS release 6.4 (Final)
cPanel: 11.34.1 (build 14)
Curl: 7.12.1
MySQL: 5.5.23
phpMyAdmin: 3.4.11.1
Python: 2.6.6
Perl: 5.8.8
PHP: 5.2.17
ionCube Loader: 4.2.2
Zend Optimizer: 3.3.9
Ruby: 1.8.7
Rails: 2.3.18
OpenSSL: 1.0.0-fips
-
- Posts: 7
- Joined: 2013-05-28T16:41:06-07:00
- Authentication code: 6789
Re: Apache / PHP / Imagick
Solved. I knew the solution would be really simple.
1. Install CentOS 6.4.
2. Install PHP, PHP-Common, PHP-extensions, etc., from standard Application Package Manager.
3. From admin mode ("su" command), command: yum install ImageMagick ImageMagick-devel
4. Command: pecl install imagick
5. Modify php.ini and include the line "extension=imagick.so".
6. Command: service httpd restart
Couldn't find one single guide to help me do it online. Everything else failed. Hope this helps someone out there.
1. Install CentOS 6.4.
2. Install PHP, PHP-Common, PHP-extensions, etc., from standard Application Package Manager.
3. From admin mode ("su" command), command: yum install ImageMagick ImageMagick-devel
4. Command: pecl install imagick
5. Modify php.ini and include the line "extension=imagick.so".
6. Command: service httpd restart
Couldn't find one single guide to help me do it online. Everything else failed. Hope this helps someone out there.
Re: Apache / PHP / Imagick
Congratulations and the instructions should help others
-
- Posts: 7
- Joined: 2013-05-28T16:41:06-07:00
- Authentication code: 6789
Re: Apache / PHP / Imagick
Decided to write out a more detailed guide, to post at the PHP.net page for those seeking resolve to this issue:
Guide to Building an Apache/PHP/Imagick Server with Linux/CentOS 6.4:::
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 ;
;;;;;;;;;;;;;;;;;;;;;;
--------------------------------
Use the "search" feature of gedit to find the text. 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 Apache/PHP/PHP's extensios now that you've installed ImageMagick. If this gives you an error, just try "service httpd start".
My favorite part about this method is that you can update your system with issuing the "yum update" command and then the "yum upgrade" command -- and the Apache/PHP/Imagick combo will still be working perfectly! Unlike some other guides out there for this, you don't need to rely on antiquated, unsupported versions that can be nearly impossible to find. Also, you don't need to worry about the MySQL, Hash, MBString, Exif packages, because they all seem to be installed and properly cooperating with PHP automatically after installing PHP from the Application Manager. This solution makes everything work well together.
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. Again, replace "[YOUR-USERNAME]" with your actual user name. (Warning: The first time I did this, I was lazy and entered the command for only the "/var/" folder, which prevented my system ever from booting. It would always freeze with the notorious and googleable erro-message: "Could not update ICEauthority file /var/lib/gdm/.ICEauthority". So, make sure to change ownership only for "/var/www/html/".)
To view your root directory files as compiled, resultant, PHP pages, open up a browser and enter "127.0.0.1" as the address. So, a file in your root directory would be accessed at the following URL in your browser: http://127.0.0.1/your.file.php . If you get a "could not connect" error message, try the command "service httpd start" at the terminal window from admin mode. (You have to start this service manually every time the machine boots, although there's plenty of ways to automate it.)
Guide to Building an Apache/PHP/Imagick Server with Linux/CentOS 6.4:::
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 ;
;;;;;;;;;;;;;;;;;;;;;;
--------------------------------
Use the "search" feature of gedit to find the text. 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 Apache/PHP/PHP's extensios now that you've installed ImageMagick. If this gives you an error, just try "service httpd start".
My favorite part about this method is that you can update your system with issuing the "yum update" command and then the "yum upgrade" command -- and the Apache/PHP/Imagick combo will still be working perfectly! Unlike some other guides out there for this, you don't need to rely on antiquated, unsupported versions that can be nearly impossible to find. Also, you don't need to worry about the MySQL, Hash, MBString, Exif packages, because they all seem to be installed and properly cooperating with PHP automatically after installing PHP from the Application Manager. This solution makes everything work well together.
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. Again, replace "[YOUR-USERNAME]" with your actual user name. (Warning: The first time I did this, I was lazy and entered the command for only the "/var/" folder, which prevented my system ever from booting. It would always freeze with the notorious and googleable erro-message: "Could not update ICEauthority file /var/lib/gdm/.ICEauthority". So, make sure to change ownership only for "/var/www/html/".)
To view your root directory files as compiled, resultant, PHP pages, open up a browser and enter "127.0.0.1" as the address. So, a file in your root directory would be accessed at the following URL in your browser: http://127.0.0.1/your.file.php . If you get a "could not connect" error message, try the command "service httpd start" at the terminal window from admin mode. (You have to start this service manually every time the machine boots, although there's plenty of ways to automate it.)