Travis - Require PHP ext-simplexml in Composer - php

I am trying to require "ext-SimpleXML": "^7.1" in my composer.json and I am using travis as my testing framework. Locally everything works fine but on travis (when using composer install) I always get the error message:
The requested PHP extension ext-simplexml ^7.1 has the wrong version (0.1) installed. Install or enable PHP's simplexml extension.
Does anyone know how I can update or tell travis to install/use the correct version? I already tried it with sudo apt-get install php-xml without success.

Try use the line below.
"ext-SimpleXML": "*"
https://getcomposer.org/doc/01-basic-usage.md#platform-packages
Most of PHP extensions do not have own versions. They are fixed to a specific PHP build. Few are a thin shims to system libraries and the shims versions are meaningless.

Related

How to downgrade PHP version (Your PHP version does not satisfy that requirement)?

After running sudo apt-get update && sudo apt-get dist-upgrade on my Laravel app, I'm getting this error on the next deployment:
- This package requires php ^7.1.3 but your PHP version (8.1.6) does not satisfy that requirement.
In my composer.json, ^7.1.3 is the specified version. This is my first time running the apt-get update and I don't know why the php version got updated as well.
On each deployment I run
composer install --no-interaction --prefer-dist --optimize-autoloader
How can I downgrade the version to 7.1.3? This happens on an existing app in production and I have to be very careful about it.
The php version installed on your environment should be compatible with your project.
If your project is based on composer package manager (as I see), it can help you to control which php version you need on the server.
In your case I would recommend to restore from the snapshot or just install php 7.1.3 version back.
If you want to use php 7.4/8/8.1 in your project, before you should upgrade your code and project dependencies and ensure, that everything working fine with the desired version of php.
Old topic, but for things like this, I recommend adding the flag to ignore requirements like this. So try:
composer install --no-interaction --prefer-dist --optimize-autoloader --ignore-platform-reqs
There may be incompatibilities with your project using 8.1 instead of 7.1.3, but I doubt it. But still, only do this if you feel confident the PHP version won't be an issue. It's usually better than downgrading, however.

Install PHP Extension xml

I installed phpmyadmin but when I go to myIP/phpmyadmin, I get this error:
Composer detected issues in your platform: Your Composer dependencies require the following PHP extensions to be installed: xml
I have tried to reinstall it but nothing changed
Maybe still important when I reinstall it, I get this output:
php8.0-xml is already the newest version (8.0.12-1+0~20211022.25+debian10~1.gbp06192c).
Have you do check your PHP version with phpinfo();?
Maybe you have more than one PHP version installed on your system and you are installing the XML in a different PHP installation.

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

Dependency install errors in composer

I've been a problem when i try to install any dependency using composer.
I tried to use the composer update or composer update. I need to install a chart dependency to my application in Laravel.
When i try to execute any action, show this message below.
This package requires php 7.2.18 but your HHVM version does not satisfy that requirement.
I cannot find a answer to this problem on the internet. I try to install a more recently version of HHVM but i didn't succeed.
Unfortunately HHVM no longer supports vanilla PHP. You should use the vanilla (Zend) PHP runtime, and should not install HHVM as php on your system.
More information on both PHP deprecation and Composer is here: https://hhvm.com/blog/2019/02/11/hhvm-4.0.0.html

Laravel project creation, Your requirements could not be resolved to an installable set of packages

I'm trying to create a project using a composer. I use the following command. My folder consist of another project but in a separate folder.
composer create-project --prefer-dist laravel/laravel blog
The error I get is,
Your requirements could not be resolved to an installable set of packages.
Some answers in Stackoverflow says to upgrade the PHP. But in my case it's already updated to newest version. php -v says,
Is there any solution? Any suggestion is warmly welcome.
Edit: I installed the php mbstring but I get the same error.
If you're running PHP 5
sudo apt-get install php5-mbstring
If you're running PHP 7
sudo apt-get install php7.0-mbstring
Also, read Laravel's requirements: https://laravel.com/docs/5.4/installation
There may be other dependencies you haven't installed:
PHP >= 5.6.4
OpenSSL PHP Extension
PDO PHP Extension
Mbstring PHP Extension
Tokenizer PHP Extension
XML PHP Extension

Categories