How can i install imagick so that it can work in XAMPP?
hello i m using UBUNTU 10.04 and i want to use(install) imagick in XAMPP.i have installed imagick from synaptic package manager but when i m trying to use this in XAMPP,its not working and giving an error like"no class imagick found".开发者_高级运维 when i open phpinfo(),i didnt find imagick there. pls suggest me how can i install imagick so that it can work with XAMPP???
Try installing php5-imagick
. This is the package containing PHP bindings for Imagemagick.
You should use apt-get to install PHP the correct way since you're on a Linux based OS, using XAMPP (http://www.apachefriends.org/en/xampp.html) is not the way to go.
Depending on the version of PHP you need I would use a script like this to pin your version to 5.2.x, unless you want to use 5.3.x skip to below Apt-Get commands
#! /bin/sh
#check if running as ROOT
ROOTUSER_NAME=root
username=`id -nu` # Or... username=`whoami`
if [ "$username" = "$ROOTUSER_NAME" ]
then
echo "Running as ROOT!!!"
else
echo "Please run as Root as you are just an ordinary user (but mom loves you just the same)."
exit 0
fi
php_packages=`dpkg -l | grep php | awk '{print $2}'`
#check if PHP Packages are NULL
if [ -n php_packages ]
then
echo "Using Found PHP Packages"
echo $php_packages
else
echo "Nothing found, using defaults"
php_packages="libapache2-mod-php5 php-pear php5-cgi php5-cli php5-common php5-curl php5-gd php5-gmp php5-ldap php5-mcrypt php5-mhash php5-mysql php5-odbc php5-pgsql php5-pspell php5-recode php5-snmp php5-sqlite php5-sybase php5-tidy php5-xmlrpc php5-xsl"
fi
# Restart Apache Command
RESTART="/etc/init.d/apache2 restart"
#might need to run aptitude purge to remove all the config/ini files
#aptitude purge $php_packages
apt-get remove $php_packages
echo "Removed Packages\n"
sed s/lucid/karmic/g /etc/apt/sources.list | sudo tee /etc/apt/sources.list.d/karmic.list
echo "SED Command\n"
#Create the directory
mkdir -p /etc/apt/preferences.d/
echo "Make DIR: /etc/apt/preferences.d/\n"
# PINing the verion number so Ubuntu wont upgrade the package
for package in $php_packages;
do echo "Package: $package
Pin: release a=karmic
Pin-Priority: 991
" | sudo tee -a /etc/apt/preferences.d/php
done
echo "Finished with PIN\n"
#Update apt-get repos
apt-get update
echo "Updating Apt-Get\n"
#Just listing all the packages that should be installed
for package in $php_packages;
do echo "Package: $package "
done
echo "Starting PHP Install\n";
apt-get install $php_packages php5-mcrypt
echo "Finished Install.........\nRestarting Apache...........\n"
#Restart Apache
RESTART
#Autoclean, remove old files
apt-get autoclean
Here are the Apt-Get commands that you could run as well
# Add Repo
sudo add-apt-repository "deb http://archive.canonical.com/ lucid parnter"
sudo apt-get update
# install
sudo apt-get install apache2 imagemagick php5-imagick
# remove old files
sudo apt-get autoremove
精彩评论