Unable to install Blackfire PHP on Codeship - php

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.

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.

I have face a problem to install maatwebsite/excel on laravel 8 | php 8?

I have face this problem to install maatwebsite/excel on laravel 8. How can I fix it?
NB: PHP version running 8.
I solved the problem with
I just enable PHP gd extension from php.ini file
installing PHP package PhpSpreadsheet
The problem is about Laravel Excel requirements. It seems PhpSpreadsheet: ^1.15 is not installed. Here is the list of requirements for Laravel-Excel 3.1,
PHP: ^7.2\|^8.0
Laravel: ^5.8
PhpSpreadsheet: ^1.15
PHP extension php_zip enabled
PHP extension php_xml enabled
PHP extension php_gd2 enabled
PHP extension php_iconv enabled
PHP extension php_simplexml enabled
PHP extension php_xmlreader enabled
PHP extension php_zlib enabled
Make sure these are installed and enabled on your php.ini. Also make sure your php version on composer.json is set like this:
"require": {
"php": "^7.2|^8.0",
},
Instead of something like this "php": ">=7.2". Check this out for more information. Please let me know if it worked.
I just want share another answer related here. If you run on unix (linux), try install php-gd using command line. Try check other answer related to your system.
sudo apt-get update
sudo apt-get install php8.0-gd
related:
How to install PHP GD in Ubuntu
install php-gd ext on Debian
Issue with enabling GD in PHP
If you using windows. Use this command.
composer require maatwebsite/excel --ignore-platform-reqs
This problem happen only on php 8.x! perhaps on lastest php 7. The problem same as above and still failed even php-gd is active. When type
composer require maatwebsite/excel
the error still the same. When checking using
php -i
(basicly same as phpinfo in console). We can see php gd is active. This answer is not recommended at the moment. Fixed still on the way related to this issue.
related link:
https://github.com/Maatwebsite/Laravel-Excel/discussions/3191
PHP8 is supported, make sure to use 3.1.30 of the package as mention above. To see other issue, please read this link.
https://github.com/Maatwebsite/Laravel-Excel/issues/2936
I solved using
Enable zip and gd extension in php.ini
or install using sudo apt-get install php8.0-gd
sudo apt-get install php8.0-zip
use composer require maatwebsite/excel:^3.1 -W
-W is for with-all-dependencies
I have just used composer require maatwebsite/excel -W --ignore-platform-req=ext-zip and this has worked for me on linux ubuntu 20 with php 8.1
delete composer.lock (json)
then run below command
composer require phpoffice/phpspreadsheet
composer require maatwebsite/excel
it is working

Telling Composer the location of a package

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

PHP pcntl module installation

Problems
d11wtq/boris v1.0.10 requires ext-pcntl * -> the requested PHP extension pcntl is missing from your system.
d11wtq/boris v1.0.10 requires ext-pcntl * -> the requested PHP extension pcntl is missing from your system.
Installation request for d11wtq/boris v1.0.10 -> satisfiable by d11wtq/boris[v1.0.10].
When I run command: composer install it creating error.
And also how to install extension on php.init.
extension=php_curl.dll
I know this is an old one, but I ran into the same problem and with this switch just solved it:
composer install --ignore-platform-reqs
I fixed this by running composer update before install.
Solved my problem updating and ignoring requested PHP extensions:
composer update --ignore-platform-reqs
http://php.net/manual/en/pcntl.installation.php
Process Control support in PHP is not enabled by default. You have to
compile the CGI or CLI version of PHP with --enable-pcntl
configuration option when compiling PHP to enable Process Control
support.
Note:
Currently, this module will not function on non-Unix platforms (Windows).
I had the same problem on my system (OpenSUSE, PHP7). Simply installing php7-pcntl solved my problem.
We can resolve this issue by following way.
Your options are as follows:
Install the required extensions (best option)
Run composer with the --ignore-platform-reqs flag (very hacky) like composer update --ignore-platform-reqs
Upgrade to Laravel 5 (we no longer user boris for the tinker command)

Problems with lib-icu dependency when installing Symfony 2.3.x via Composer

I've had no problems installing Symfony 2.2.x using Composer, I've always just copied the stable version at http://symfony.com/download.
composer create-project symfony/framework-standard-edition myproject/ 2.2.1
(I have Composer installed globally)
Curious about 2.3.0-RC1 I figured this would go smoothly:
composer create-project symfony/framework-standard-edition mynewerproject/ 2.3.0-RC1
But got shutdown by the following errors:
Your requirements could not be resolved to an installable set of packages.
Problem 1
- symfony/icu v1.2.0-RC1 requires lib-icu >=4.4 -> the requested linked library icu has the wrong version installed or is missing from your system, make sure to have the extension providing it.
- symfony/icu v1.1.0-RC1 requires lib-icu >=3.8 -> the requested linked library icu has the wrong version installed or is missing from your system, make sure to have the extension providing it.
- symfony/symfony v2.3.0-RC1 requires symfony/icu >=1.0,<2.0 -> satisfiable by symfony/icu[v1.1.0-RC1, v1.2.0-RC1].
- Installation request for symfony/symfony 2.3.* -> satisfiable by symfony/symfony[v2.3.0-RC1].
Do I need to tweak the composer.json file?
Solution Update
I was missing the php intl extension which provides lib-icu
So easy, install and configure the intl extension. As of PHP 5.3 the Intl extension is distributed by default, but some distributions, like MAMP, don't have Intl so you'll need to acquire it. I used PEAR:
My steps:
Install the Intl extension (maintained by PECL): $ pear install pecl/intl — you may have to add the pecl channel to pear first.
If you use MAMP and have never worked with pear/pecl check lullabot's helpful blog post; MAMP doesn't ship with the php source, so you have to download the source for your php version and move the source into /Applications/MAMP/bin/php/php[version]/include/php (as covered in the blog post)
PEAR couldn't find my php.ini, so I had to manually add extension=intl.so to php.ini. In MAMP you can edit php.ini easily by going to File > Edit Template > php.[version].ini
Command Line:
When using Composer or Symfony's Console CLI you'll also need Intl and since the php CLI usually uses a different php.ini you'll want to add the extension directive there too. To find your CLI's php.ini simply do $ php -i |grep php\.ini to discover the file path and add extension=intl.so to that php.ini as well.
To check if Intl is installed you can do $ php -m to check available modules.
update your php-intl extension, that's where the icu error comes from!
sudo aptitude install php5-intl // i.e. ubuntu
brew install icu4c // osx
check the extension is enabled and properly configured in php.ini aswell.
( hint: php-cli sometimes uses a different php.ini )
php.ini
extension=intl.so ; *nix
extension=php_intl.dll ; windows
[intl]
intl.default_locale = en_utf8
intl.error_level = E_WARNING
check your phpinfo() AND php -m from your terminal if the extension has been succesfully enabled.
Check your current intl versions from php with:
Intl::getIcuVersion();
Intl::getIcuDataVersion();
attention: not needed anymore ( symfony 2.3 has meanwhile been released )
add the minimum stability flag #dev or #rc to your dependency like this please:
composer create-project symfony/framework-standard-edition mynewerproject/ 2.3.*#dev
The default stability in composer is stable which symfony 2.3 branch is not currently ( it's #rc ). Read more an stability flags here.
Many applications will only be supporting "en" locale and will have no need for translation capabilities or php-intl. If this is you, or you can't install php-intl on your server, you can explicitly add symfony/icu ~1.0 to your composer.json. 1.0 does not require php-intl, whereas 1.1+ does.
If you don't need translation features:
$ php bin/composer.phar require symfony/icu ~1.0
Without this declaration and trying to install symfony/symfony 2.3 Composer may try to install symfony/icu ~1.2 which would require you to install php-intl.
This is explicitly covered more extensively in the Symfony Intl Component's docs under "ICU and Deployment Problems".
A solution regarding this or similar problems can be found here: ICU and Deployment Problems
The behavior of composer should be intelligent selecting the right icu-component:
symfony/icu 1.0.*: when the intl extension is not available
symfony/icu 1.1.*: when intl is compiled with ICU 4.0 or higher
symfony/icu 1.2.*: when intl is compiled with ICU 4.4 or higher
There should be (theoretically) no error installing symfony 2.3. with no intl-extension.
But you can be trapped when your development-environment differs from your production-server like mentioned in this article:
the development machines are compiled with ICU 4.4 or higher, but the server is compiled >with a lower ICU version than 4.4
the intl extension is available on the development machines but not on the server.
When you have no root-access to your production-server you can fix it as mentioned in this article. (tweaking composer.json)
Hope this additional information helped as it helped me for this special case with different environments.
Mac OS Mavericks comes with PHP 5.4.17 without intl. To get this, you'll have to follow those steps :
brew install icu4c
sudo pecl install intl
The path to the ICU libraries and headers is: /usr/local/opt/icu4c/
Edit /etc/php.ini and add extension=intl.so to the end.
I know that this answer may not be the correct answer to this person's problem, but it was the solution to my problem with the same title. I was able to fix this problem for myself by enabling the intl extension in php.ini and upgrading composer.
Upgrading composer.
php composer.phar self-update
Remove comment from this line (in php.ini):
extension=php_intl.dll
And also remove comment the these two lines below [intl] in (php.ini):
[intl]
intl.default_locale = en_utf8
intl.error_level = E_WARNING
And restart apache2 of course. :)
Additional Information:
If your using mac and installed php with Homebrew follow these steps:
(PHP 5.4)
$ brew install php54-intl
(PHP 5.5)
$ brew tap josegonzalez/php
$ brew tap homebrew/dupes
$ brew install josegonzalez/php/php55-intl
$ sudo apachectl restart
Restart apache.
A better solution is to fix your composer.json to the version required by the production server. First, determine the ICU version on the server:
1
2
$ php -i | grep ICU
ICU version => 4.2.1
Then fix the Icu component in your composer.json file to a matching version:
"require: {
"symfony/icu": "1.1.*"
}
Set the version to
"1.0." if the server does not have the intl extension installed;
"1.1." if the server is compiled with ICU 4.2 or lower.
Finally, run
php composer.phar update symfony/icu
on your development machine, test extensively and deploy again. The installation of the dependencies will now succeed.

Categories