Telling Composer the location of a package - php

In my Laravel application I am trying to install a package that depends on the Imagick PHP extension. The error is below:
spatie/pdf-to-image 1.8.2 requires ext-imagick * -> the requested PHP extension imagick is missing from your system.
However 1&1 explicitly states that this is already installed under /usr/bin/convert according to the following link:
https://www.ionos.co.uk/help/hosting/using-php-for-web-projects/using-imagemagick/
Is there a way to tell the composer.phar within my project thaat the package exists elsewhere?

Possible answer here:
Link
As a package consumer you can set or override the install path for a package that requires composer/installers by configuring the installer-paths extra. A useful example would be for a Drupal multisite setup where the package should be installed into your sites subdirectory. Here we are overriding the install path for a module that uses composer/installers:
{
"extra": {
"installer-paths": {
"sites/example.com/modules/{$name}": ["vendor/package"]
}
}
}

I was installing via brew (on mac) and had problems.
$ pecl install imagick did it for me

On Ubuntu (and other linux distros with apt), the command to install this extension is
sudo apt install php-imagick

Related

Unable to install Blackfire PHP on Codeship

I try to deploy my PHP application to Heroku through Codeship.
Heroku requires to add ext-blackfire to my composer.json and it results in a crash on Codeship at composer install.
The requested PHP extension ext-blackfire ~1.18 is missing from your system.
Install or enable PHP's blackfire extension.
How can I install Blackfire extension on Codeship?
You should be able to install your dependencies through composer install --ignore-platform-reqs, which ignores any missing extensions. See the docs (https://getcomposer.org/doc/03-cli.md) for more details.

How do I install Imagick for PHP without PEAR?

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.

The requested PHP extension intl is missing from your system (SonataAdminBundle) in Symfony2

I try to install the sandbox but I get the following error from composer:
Loading composer repositories with package information Installing
dependencies from lock file Your requirements could not be resolved to
an installable set of packages.
Problem 1
- Installation request for sonata-project/intl-bundle 2.1.0 -> satisfiable by sonata-project/intl-bundle 2.1.0.`
- sonata-project/intl-bundle 2.1.0 requires ext-intl * -> the requested PHP extension intl is missing from your system.`
Problem 2
- sonata-project/intl-bundle 2.1.0 requires ext-intl * -> the requested PHP extension intl is missing from your system.`
- sonata-project/news-bundle 2.1.x-dev requires sonata-project/intl-bundle 2.1.* -> satisfiable by sonata-project/intl-bundle 2.1.0.
- Installation request for sonata-project/news-bundle 2.1.
I had the same problem while I was installing new Magento 2.0, after different hit and trials, I manged to solve it by following these steps:
I copied all icu* files from php directory to Appache directory, and it worked.
Php direcotry:
WAMP\bin\php\php5.5.12
Appache Directory:
WAMP\bin\apache\apache2.4.9
Make sure to un-comment following line in php.ini file:
extension=ext/php_intl.dll
Linux user
yum install php-intl
Like #Hugehornet pointed out - you should enable this extension in php.ini by uncommenting this line: extension=ext/php_intl.dll
If you use wamp's interface for this task you are actually updating the php.ini file located in apache's directory.
Example: C:\wamp\bin\apache\Apache2.4.4\bin\php.ini
Composer is using the one located in the php's installation directory.
Example: C:\wamp\bin\php\php5.4.12\php.ini
You should manually edit the latter and restart the wamp server.
You need to enable the intl extension in php just as the error says.
In your php.ini file, uncomment the line extension=ext/php_intl.dll or something like this.
Edit : note that if you are using wamp or something like this, you should be aware of the fact that the php.ini file in the wamp config is not necessarily the one used by composer.
First of all be sure that your server is isung x86 build (intl not working with x64), then:
activate intl extension in php.ini directly
copy all icu*.dll form php directory to apache directory
make sure your console using the same php folder you just configured
source.
In my windows system I have two php.ini files at the flowing paths:
C:\wamp\bin\php\phpx.y.z
C:\wamp\bin\apache\Apachex.y.z\bin
I don't know which one is in your path. Just make sure to add the extension in both of them to eliminate any doubt.
I am on a Mac OS X Yosemite, and I fix this error
the requested PHP extension mcrypt is missing from your system
by running the following commands :
brew update
brew upgrade
brew tap homebrew/dupes
brew tap josegonzalez/homebrew-php
brew install php54-mcrypt
If intl has already been enabled and it doesn't works, add your PHP directory in the Path environment variable, then restart your server.
(for example C:\Program Files\wamp\bin\php\phpX.XXX.XXX for wamp)
It has worked for me!
On Ubuntu, Debian, and related Linux distributions
sudo apt-get install php-intl
to install the extension for the default PHP version.
For other versions a variation like apt-get install php7.3-intl will choose the correct extension if the version provided is correct.

Install libssh2-php on PHP 5.4.9 (x64)

I have a problem with the update on php 5.4.9 (i install it with the ppa "ppa:ondrej/php5")
Now i have the problem that i can't install libssh2-php (which is required on my project)
I found some .deb files, but it's only for 32-bit systems.
So when i'm trying to install libssh2-php i have a collision with "libssh2-php:i386" and i have the following dependiesmessage:
ucf:i386 libc6:i386 (>= 2.4) libssh2-1:i386 (>= 1.0) and phpapi-20090626+lfs:i386
System: Ubuntu Server 12.04 LTS x64 | PHP 5.4.9
I also got a warning on running "php -v"
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20100525/ssh2.so' - /usr/lib/php5/20100525/ssh2.so: cannot open shared object file: No such file or directory in Unknown on line 0
The problem is/was that the libssh2 is not aviable for PHP5.4.x AND a x64 system.
I have the same problem trying to use ondrej's ppa for ubuntu 10.04 LTS. It seams that he didn't include the sssh extension.
Apt-get tries to install the version from default package which runs into conflict (depends phpapi-20090626+lfs) with current installed version, isn't it?
Only my backup php cli script needs this extension to run. After trying to solve dependencies witout success, I switched to a shell_exec('ssh ...#...') solution as workaround.
I am only a developer with advanced admin knowledge, no apt-get or linux packaging admin professional. There maybe other solution to fix this via packaging management or maybe building the needed version from source?
EDIT:
There will be another nicer solution :-) you can use pecl to install / build the extension, here is what i have done:
$ sudo pecl install ssh2
Failed to download pecl/ssh2 within preferred state "stable", latest release is version 0.12, stability "beta", use "channel://pecl.php.net/ssh2-0.12" to install
install failed
$ sudo pecl install channel://pecl.php.net/ssh2-0.12
downloading ssh2-0.12.tgz ...
Starting to download ssh2-0.12.tgz (26,223 bytes)
[...]
Build process completed successfully
Installing '/usr/lib/php5/20100525+lfs/ssh2.so'
install ok: channel://pecl.php.net/ssh2-0.12
configuration option "php_ini" is not set to php.ini location
You should add "extension=ssh2.so" to php.ini
Afterwards I add extension=/usr/lib/php5/20100525+lfs/ssh2.so to php config.
Just do:
sudo aptitude purge php5-suhosin
It's described in detail here: bugs.debian.org

Magento's extension installation

i want to install magento extension but not from the magento connect how can i do this
i have the module(extension) code and i allready install the sample data in magento installtion
From magento wiki:
Alternatively, if you do not like to make all files and folders writable to the web service, it is possible to install and upgrade Magento from shell, using command line PEAR instructions, such as:
# all commands are to be ran from the root Magento folder.
# help on all available PEAR commands:
./pear help
# set preferred stability for installed/upgraded packages (alpha,beta,stable):
./pear config-set preferred_state beta
# initial installation from downloader package:
./pear mage-setup .
./pear install magento-core/Mage_All_Latest
# install additional extension:
./pear install magento-community/Some_Extension
# list available upgrades
./pear list-upgrades
# upgrade a package
./pear upgrade magento-core/Mage_Package
# uninstall a package
./pear uninstall magento-community/Unwanted_Package
The pear script should be located under magento/downloader/pearlib
Besides installing Magento extension via Magento Connect Manager, you can install manually by using the "Magento Extension Downloader" tool here: http://miragedesign.net/tools/download-magento-extension/
Basically, you just need to enter the key and click Get Extension button, then download the "ready to use" zip file, extract all the content of the extension folder to your Magento installation root, clear cache and that's all!!!
A more detail guide can be found here: http://miragedesign.net/newss/download-magento-extension-directly/
Hope it's useful for you!
For some reason i have better luck with the mage functions, such as
./pear upgrade-all
./mage sync-pear
./mage upgrade-all
if you get a conflicting error, then run
./mage upgrade-all --force
It's depend on how your extension was packaged(occurred), e.g. pear package(most likely you downloaded extension from magento website or purchased from professional vendor) or regular archive(purchased from some junior or amateurish vendor):
installing pear package:
./pear install Foo_FooBar-0.1.0.tgz
installing from regular archive: usually you just need to extract archive into the magento root, otherwise look for instruction inside archive or request from vendor
See also installing magento via ssh
Thanks.

Categories