I am trying to install Image Magick on Fedora machine. I have successfully installed imagick before using yum without any problems encountered. But on this particular server, yum did not successfully install image magick because 'PHP and Apache were not installed with Yum' in the first place. This was the reply I got from the admin who installed Fedora on this machine.
When I was installing using yum, this was the error I got when I typed pecl install imagick:
php: relocation error: php: symbol SSLeay_version, version OPENSSL_1.0.1 not defined in file libcrypto.so.10 with link time reference
The instruction from this (http://jhalog.wordpress.com/2010/11/09/install-imagemagick-in-fedora-with-yum/) link usually works for me but not this time.
Then I tried to install imagick from source, I did not get any error but still PHP is unable to recognize it. I tried to run 'make test' and again the error above displayed.
Running 'php -m | grep imagick' also displays the above error message.
I don't have any advanced knowledge in Linux so I will appreciate any help.
I am not getting what you problem really is, but this may help you. you dont have to download source file, extract, configure, make , make install, make test, install magick wand etc etc. Just follow the commands below,
First of all remove everything you have tried to make it work. Uninstall ImageMagick with the following command:
sudo apt-get remove imagemagick
Remove ImageMagick and all its dependencies with the following command:
sudo apt-get remove auto-remove imagemagick
Purge the config file of ImageMagick with the following command:
sudo apt-get purge imagemagick
Or similarly, like this:
sudo apt-get purge auto-remove imagemagick
Well, all your previous installation files are just gone. Now Install it purely and perfectly without any conflict or file modification. Enter the following two commands:
sudo apt-get install imagemagick
sudo apt-get install php5-imagick
That was way too easy a thanks interwebs! Remember to restart/reload your webserver..
sudo service apache2 graceful
That's all. Check your php.ini or test with any simple script. For simple scripts to test ImageMagick you can refer to this post.
Related
Trying to install ssh2 onto a litespeed server and using the traditional install methods are not working for me. I have successfully installed ssh2 into the /etc/php/cli and it works from the command line. However my litespeed server is using the php.ini from the directory /usr/local/lsws/lsphp74/etc/7.4/litespeed/php.ini. I confirmed that by running phpinfo() from the browser and looking at the Loaded Configuration File entry which shows /usr/local/lsws/lsphp74/etc/php/7.4/litespeed/php.ini. No matter what I try and what examples or steps provided to me, I cannot get it to install in an area that I can use via the browser. I do see this line "/usr/local/lsws/lsphp74/etc/php/7.4/mods-available/50-ssh2.ini," in the Additional .ini files parsed section of the phpinfo() page however no matter what I have tried, I cannot get it so show up like its installed when I view the phpinfo() page.
This works for LSPHP81 with SSH2, feel free to replace the PHP version with your current version.
1 - Install necessary PHP packages and ssh2 lib
apt-get update
apt-get install lsphp81-pear lsphp81-dev -y
apt-get install libssh2-1 libssh2-1-dev -y
2 - Download SSH2 package from pecl
wget https://pecl.php.net/get/ssh2-1.3.1.tgz
tar -zxvf ssh2-1.3.1.tgz
cd ssh2-1.3.1
3 - Compile ssh2 package
/usr/local/lsws/lsphp81/bin/phpize
./configure --with-ssh2=/usr/local/lsws/lsphp81 --with-php-config=/usr/local/lsws/lsphp81/bin/php-config
make
make install
echo "extension=ssh2.so" >> /usr/local/lsws/lsphp81/etc/php/8.1/mods-available/ssh2.ini
4 - Reload lsws and PHP
systemctl restart lsws
killall lsphp
5 - Result
I need to add curl to my PHP, I read multiple articles which recommended just sudo apt-get install php5-curl
But when I try it I get error as below
Error:
The following packages have unmet dependencies:
dropbox : Depends: python-gtk2 (>= 2.12) but it is not going to be
installed
php5-curl : Depends: php5-common (= 5.4.45-1~dotdeb+6.1) but
5.4.31-1~dotdeb.0 is to be installed
So I go a bit deeper and try to install it manualy, so I basicly download curl from curl website with: wget http://curl.haxx.se/download/curl-7.36.0.tar.gz
and then just unpack it and just ./configure and sudo make and after that sudo make install
Dispite the fact i didnt get any error It also didnt help.
From error I see that I have older version of my PHP than one in repository but I really have no clue what I can do now.
Is here anyone who can help me?
If you're stuck with that version of PHP, you can build the cURL extension yourself and then activate it with PHP. Normally, cURL is compiled into the PHP binary but you can also run it as a dynamic extension.
When you downloaded, compiled, and installed cURL, this installed the curl program and libraries but has nothing to do with PHP.
You can follow these steps to build a cURL PHP extension for your system:
Go to http://php.net/releases and download the source code for the version of PHP you are currently running
Extract to a temporary location
From the command line, cd to php-5.x.x/ext/curl
Run the following commands:
phpize
./configure --with-curl=/usr/local (/usr/local should be correct, but you can try leaving it blank, or specify the --prefix you used when you installed cURL.
make && make install
After make install runs, it should say something like:
Installing shared extensions: /usr/lib/php5/20121212/
This is where it will place curl.so
Now, edit your php.ini file that PHP uses and add:
extension=curl.so
Restart your webserver &/or PHP, check that cURL is loaded.
Note: If you don't have the phpize (it should have come with PHP) you might need to just build PHP to a temporary location and copy phpize to /usr/bin so you have it.
Hope that helps.
You need to update your PHP version and then install curl.
Do apt-get update to get the latest definitions, then apt-get upgrade to upgrade all packages, then apt-get install php5-curl.
My operating system is:Mac OSX 10.11
I'm trying to install Phabricator on my Mac, when I execute the command of
phabricator cpopt$ ./bin/phd start
I got an error:
"ERROR: The PHP extension 'pcntl' is not installed. You must install it to run daemons on this machine."
I've search this problem on google and I got lots of solutions,but they all don't work to me,I'm almost in despair.
How can I achieve that?
Do you have brew installed (read here to install http://brew.sh/)?
Try:
brew install php
or if you need to install PHP 5.6 with brew you could do this:
brew install php#5.6
Then to include it in your PATH (if it is not automatically added), it may be necessary to run the commands in the CLI you may need to update your path, e.g. (this is the case if you were to brew install php#7.1 but was not the case when I just tested with brew install php - if you are using bash instead of zsh, change .zshrc to .bashrc.
echo 'export PATH="/usr/local/opt/php#7.1/bin:$PATH"' >> ~/.zshrc
echo 'export PATH="/usr/local/opt/php#7.1/sbin:$PATH"' >> ~/.zshrc
If that doesn't work, I wonder if phabricator is calling the right version of php.
Out of curiosity, what is the output you get from this? That is what phabricator is using to determine your php version.
/usr/bin/env php -v
Also... is your php.ini updated to have the pcntl extension? Run this to see your modules and look for pcntl:
php -i | grep pcntl
Double-check the php.ini that the php-cli is running:
php -i | grep php.ini
I had to do this to install the platform.sh command line tool. This was the top hit in Google so I'm adding this information. The process I followed was as below.
In Terminal:
Add yourself to the 'wheel' user group.
sudo dscl . append /Groups/wheel GroupMembership <username>
Grant group write access to /usr/local/bin
sudo chmod -R g+w /usr/local/bin
Link libpng for brew
brew link libpng
Install pcntl for php (5.6 in my case)
brew install homebrew/php/php56-pcntl
Just in case anyone else uses MAMP, I recently updated it to the latest version. Then I was getting the error
"ERROR: The PHP extension 'pcntl' is not installed. You must install it to run daemons on this machine."
I had not restarted my terminal since I updated it. After reloading the session everything worked fine.
I have installed ImageMagick using brew install imagemagick. This all worked fine and I can run any ImageMagick command from the Terminal / Command line.
Now when I try to use the ImageMagick classes in PHP, I get an error Class 'Imagick' not found in .... I guess this is because the ImageMagick module is not loaded.
Could anyone help me to get this thing working in PHP? Thanks!
Additional info:
Mac OS X Version: 10.8: Mountain Lion
PHP Version: 5.3.13
I just did this after a lot of experimenting. For now, this seems to be the way to do it for php 5.3:
brew tap josegonzalez/php
brew tap homebrew/dupes
brew install php53-imagick
No idea who Jose Gonzalez is but apparently we are in his debt....
php72-imagick is now deprecated as imagick is part of php binary itself. Use pecl to install imagick e.g.:
brew install php
brew install imagemagick
brew install pkg-config
pecl install imagick
Your ImageMagick installation is not enough. You also need the Imagick package (possibly called php72-imagick or similar for home brew).
Imagick doesn't do the work itself, it is a native PHP extension for creating and modifying images using the ImageMagick API.
Try to search for the exact name of the package via brew search imagick.
I'm using Yosemite. For me, the solution is a combination of the answer and comment already listed here.
brew install imagemagick
brew install php55-imagick
Edit /etc/php.ini to include imagick
extension=/usr/local/Cellar/php55-imagick/{version of php55-imagick}/imagick.so
Example:
extension = /usr/local/Cellar/php55-imagick/3.1.2_1/imagick.so
I had the same issue. These are the steps that worked for me if you are using php 5.6
brew install php56-imagick
brew install imagemagick
find /usr/local/Cellar -name "imagick.so"
copy the path from the output of this command into your php.ini file
e.g. extension=/usr/local/Cellar/php56-imagick/3.3.0_2/imagick.so
save your file. Now to double check that the imagemagick class exists type
php -r "print(class_exists('imagick'));"
Brew symlinking wasn't working for me so I had to put the full pathname into the php.ini file to get it to work.
Hope this helps
this one worked for me:
brew install imagemagick # If it's not already installed
mkdir /usr/local/lib/php/pecl # On my system this dir didn't exist and this caused pecl install to fail
pecl install imagick
here
Try:
brew install homebrew/php/php53-imagick
I've looking for correct way to install imagick on Mojavie and found solution that fully worked.
brew install imagemagick#6
brew install php#7.1
Install headers (Xcode-select --install)
Download imagick source code from: https://pecl.php.net/package/imagick
Open terminal and enter unzipped folder imagick-3.4.3/imagick-3.4.3 (in my case)
Run command phpize
./configure
make
And now if error occurs like MagicWand not found, edit file Makefile and look for CPPFLAGS = -I/usr/local/opt/imagemagick#6/include/. Inspect if in include folder there is no other folder. In my case it should be like this:
CPPFLAGS = -I/usr/local/opt/imagemagick#6/include/ImageMagick-6
save and return to terminal and type make (after finished)
sudo make install
imagick.so is located in imagick-3.4.3/imagick-3.4.3/modules
Ok after 1 hour at this I have figured it out. The mac is not giving the pecl script permissions to make a PHP directory. To resolve do as follows.
brew install imagemagick
Sudo pecl install imagick .
php --ini | grep "Loaded Configuration File"
Add extension=imagick.so under extensions.
The install will be complete. Then, to test run:
php -r "print(class_exists('imagick'));"
From: php error: Class 'Imagick' not found
Did you add extension=imagick.so to your php.ini (or /etc/php.d/imagick.ini) file?
I had the same error having already installed imagemagick and php71-imagick.
brew upgrade imagemagick - did the trick for me.
You may need sudo:
sudo brew upgrade imagemagick
You may need to restart apache / php-fpm / <other webserver>.
I cannot add comments because of reputation, but to add to this anwser:
answered Apr 12 at 16:52
Grzegorz Miśkiewicz
I was getting a missing php.h file, so as per Installing xdebug on MacOs Mojave - 'php.h' file not found I installed the necessary file via the below command:
sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /
I need to install imagick extension for php. I have already installed Image Magick. Then I did "sudo pecl install imagick". After this I had such output in console:
Installing '/usr/include/php/ext/imagick/php_imagick.h'
Installing
'/usr/include/php/ext/imagick/php_imagick_defs.h'
Installing
'/usr/include/php/ext/imagick/php_imagick_shared.h'
Installing
'/usr/lib/php/extensions/no-debug-non-zts-20090626/imagick.so'
but as I'm using XAMPP, my extension dir( as I understand ) is /Applications/XAMPP/xamppfiles/lib/php/php-5.3.1/extensions/no-debug-non-zts-20090626. So what should I do to make this working, I tried to put .so file in extensions dir and to add extension=imagick.so record in php.ini and to restart apache, unfortunately this didn't work. Forgot to mention, I'm using osX and XAMPP
I followed #Nodashi link:
http://www.imagemagick.org/script/download.php#macosx
Here are steps you can to follow since I'm same Mac developer.
To install imagemagick:
brew install imagemagick
Successfully:
🍺 /usr/local/Cellar/imagemagick/7.0.10-0: 1,487 files, 24.3MB
To install ghostscript:
brew install ghostscript
Successfully:
🍺 /usr/local/Cellar/ghostscript/9.51_1: 671 files, 87.4MB
Find the magick:
which magick
Then:
/usr/local/bin/magick
Try to run it to test a image then you will find it works:
magick origin.jpg converted.png
So let's do it by PHP way
Create a new php file:
sudo touch magick.php
Enter the code which we will use the 'exec' function to run the magick program:
<?php
shell_exec('magick origin.jpg converted_php.png');
?>
After that we run it by:
sudo /Applications/XAMPP/xamppfiles/bin/php magick.php
Great, we can see there is a image file converted_php.png !!
Did you install ImageMagick that is required to use imagick : ImageMagick for MacOSx