How do I install Imagick for PHP without PEAR? - php

I've downloaded and installed Imagick and Imagick-devel. I now want to use it with PHP but every guide I've found has the following steps:
pecl install imagick
echo "extension=imagick.so" > /etc/php.d/imagick.ini
The first step pecl is part of PEAR, a package that I don't need and don't want to install. How would I install and hook Imagick to PHP without that pecl command?
OS: CentOS 6

Either your package manager has a php-imagick package, or you simply have to install pear/pecl to install the php extension.
PEAR is the only php package manager that supports installing php/pecl extensions, so unless your linux distribution provides a package itself, you have to use it.
Alternatively, you can download the tgz, extract it, compile it, install it and activate it manually. You have to know what you're doing in this case, though.

Related

PECL install with --configureoptions not working - Memcache

Lately, I have been trying to install the pecl memcache PHP extension on OSX Catalina with brew memcached installed and I'm getting the following error every time I try the install process:
configure: error: memcache support requires ZLIB. Use --with-zlib-dir=<DIR> to specify prefix where ZLIB include and library are located
I have tried with pecl install memcache and with pecl install --configureoptions='with-zlib-dir="path"' memcache to no avail. It always gets the same point and it fails.
From what I have reviewed on different topics regarding the installation of the package the issue seems to be with the -D option in the pecl install command, because when I do a manual install from the source code passing the argument --with-zlib-dir=/usr/local/Cellar/zlib/1.2.11 to the ./configure command it works like a charm and installs the package but is now not listed in pecl list installed packages and as so it cannot be uninstalled.
The issue is I need pecl to manage the installation of the package to be able to uninstall it any time when the environment changes from project to protect.
A quick fix for this (found via https://bugs.php.net/bug.php?id=56522) is to use the PHP_ZLIB_DIR variable instead of --with-zlib-dir.
i.e. PHP_ZLIB_DIR=/usr/local/Cellar/zlib/1.2.11 pecl install memcache
I've struggled with the -D option before as well - near as I can tell it's completely broken.

How can I install PHP extensions to satisfy composer?

I am creating a app and am trying to install a library into my project though composer.
Composer has given me the error:
Problem 1
- The requested PHP extension ext-gmp * is missing from your system. Install or enable PHP's gmp extension.
Ok, it seems like I need to gmp extension.
I am using a Mac, and using a local test server with XAMPP.
Now this is where it starts getting confusing. I went to my XAMPP php.ini and remove the ";" from gmp extension like this:
xampp attempt
I retried composer installation with no luck. My next thought was that the extension needs to be installed on the global PHP Mac installation... I removed the ";" for gmp on that php.ini, but no luck. How can I solve this?
-if you need it for php 5 use
brew install homebrew/php/php55-gmp
-if you need it for php 7 use
brew install homebrew/php/php70-gmp
-and if you don't have homebrew, you can install it using this command
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
OR you can jsut run
brew install php#7.1
since it have all the packages you need for php 7.1

How to install PHP5 with pthreads on Ubuntu?

I have a server which has PHP5 installed. I need pthreads and found that link to install php5 with pthreads:
PHP5 installation with pthreads
I install all the packages I need with apt-get install. I have no idea about what a make file is, how to compile a source code etc. I am a web developer with limited OS knowledge.
I have followed the steps given in the link above. At the last command on step 4, I get an error because /opt/php-zts/modules.d/ does not exist.
I simply wanted to replace existing php with a new php installation that supports pthreads. Now, the server code does not work.
How can I install PHP5 with pthreads enabled so that it will replace existing PHP5 installation that I installed with sudo apt-get install php5 libapache2-mod-php5?
Also, I have another question. I need some other packages like php-curl. Can I install them with sudo apt-get install php-curl after I succesfully install PHP? Do these commands work with custom builds?
Edit: how-to-install-pthread-in-ubuntu-12-10 This is not a solution for my problem because I don't want an isolated installation. I want the installation to replace already existing php installation.

Cannot Install any PHP PECL through Cpanel (WHM) or SSH

When I try to install a module through PHP PECL through cpanel or whm (CENTOS 6.3 x86_64 / WHM 11.34.0 (build 7) ) I always get this result:
ERROR: `/root/tmp/pear/imagick/configure --with-imagick' failed The
Imagick.so object is not in
/usr/local/lib/php/extensions/no-debug-non-zts-20090626
Here in another example with html_parse:
ERROR: `/root/tmp/pear/html_parse/configure --with-ekhtml' failed The
html_parse.so object is not in
/usr/local/lib/php/extensions/no-debug-non-zts-20090626
I have googled it, done the suggestions and always the same result.
What library are you trying to install?
I've found mixed results using pecl on Redhat, centos, or fedora machinces if I've ever used yum to install their versions of PHP libs. The easiest way around your issue would be to look to see if it's in the Yum repo and install it that way:
yum search 'modulename'
yum install 'packagename'
I usually just do a yum search php and scan down the list of modules.
If you want to use pecl or can't because the libraries aren't part of yum, I'd remove the natively included version and build your PHP from scratch. You can remove PHP and related libraries installed with the distro via yum as well.
I have a similar server setup and I needed pecl_http. Instead of using WHM (Home »
Software » Module Installers) I used command line. Simply typed: pecl install pecl_http
It should be the same for other modules like the html_parse, just change the module name, like: pecl install html_parse
Figured I'd add this for anyone else looking for this info.

Will using PECL to install an extension warn me of any changes it will make?

I'm using some PHP 5.1 code that won't work with a newer version of PHP, but I would like to use the memcache extension with it. I'm not sure if PECL will install additional packages, upgrade packages, or remove packages if I use it--and if it does I'd like to have a warning if I run the pecl install memcache command. Will PECL warn me of the specific change it's going to make? Do I have to worry about it upgrading my PHP version? Rudimentary questions, I know, but I'm just trying to be cautious; I've never used it before.
If you run pecl install memcache I don't believe it'll install any dependencies. It definitely can't upgrade your php install/version, the pecl command only works with extensions and not with the core PHP files.
If you find that you need to install an older version of a PECL extension you can install specific versions (there's a full list of memcache releases here) by specifying the version number e.g. pecl install memcache-2.2.5

Categories