Dependency install errors in composer - php

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

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.

How do I install PHP Statistics extension in my Laravel Project?

I want to invoke the stats_rand_gen_exponential() function but apparently to do so I need to install the Statistics extension.
How do I install extensions using Composer?
UPDATE
I cannot understand what could possibly be wrong.
PHP extensions can't be installed using Composer. You can require them, but all that does is tell Composer that they need them to run, so that they will fail explicitly when someone installs the dependencies for your package. See https://getcomposer.org/doc/01-basic-usage.md#platform-packages for details.
There are a number of ways to install PHP extensions and the best will often depend on your platform. On Linux, there may be packages available for that extension via your package manager, and if so that's the easiest method. PECL looks to be the recommended installation method for this extension, so that would be my second choice if it's not available via a package manager. Or if you're using phpbrew you can probably use phpbrew ext install to install the extension you need.

Travis - Require PHP ext-simplexml in Composer

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.

Error in installing Symfony4

I am new to Symfony skeleton. Can anyone please help to get out from this error for installation of Symfony? I had searched a lot on the internet but cannot find any working solutions. Composer is working well. I am using PHP7 and XAMP server.
Error is Could not find package Symfony/skeleton with stability Stable in a version installable using your PHP version 7.0.2.
Cerad's answer is correct. Please check Requirements for Running Symfony
It states the following:
Symfony 4.0 requires PHP 7.1.3 or higher to run, in addition to other minor requirements.
If you have to live with php7.0, you are able to install the symfony demo project via symfony installer, see how to install symfony installer for sf3.4.
After you have installed sf installer, you can install the demo project with old symfony version by doing:
$ symfony new blog 3.0.1
As mentioned by Cerad, you need have php7.1 or newest php version to install latest symfony demo project. But you can also have a try to install the demo project with older version by doing:
$ composer create-project symfony/website-skeleton:3.3
you can find the the release version which you need here
You just need to change your Php version from 7.02 to upper version.
I had the same issue, my path variable was pointing at php7.0., change it to php7.2. and the problem solved immediatly.
Important : Don't forget to restart you terminal.
I had a similar problem not being able to find 4.4 without php version part.
In case some one comes in contact with this (As I did), installing Symfony CLI and using it instead of direct composer, might solve the problem.
I was actually able to install Symfony 4.4 project as below
composer create-project symfony/website-skeleton:"^6.0" yourProjetName
try to specify the version 6.0
It solved my problem
I encountered this error while installing Symfony Demo App (Symfony 6). If your PHP runtime has passed symfony check:requirements, you may want to enable PDO-SQLite PHP extension or other project requirements such as the supported PHP version - Symfony Demo's Requirements.
Assuming that OP's goal is to setup and install Symphony, according to Synfony's Official Docs there are various ways one can go about doing it.
First of all, make sure one is satisfying all the requirements. For my example I will be using the most recent versions of Symphony and PHP:
Install PHP 8.1 or higher and these PHP extensions (which are
installed and enabled by default in most PHP 8 installations): Ctype,
iconv, PCRE, Session, SimpleXML, and Tokenizer;
Install Composer, which is used to install PHP packages.
Optionally, you can also install Symfony CLI. This creates a binary called symfony that provides all the tools you need to develop and run your Symfony application locally.
In this case, it seems that OP has already installed both PHP and composer, however OP might have to update the PHP version (as Cerad mentioned).
Now, depending on one's goals, there are different ways to move one:
If one is building a traditional web application open the CMD or Git Bash, and run
composer create-project symfony/skeleton:"6.1.*" my_project_directory
Then
cd my_project_directory
And
composer require webapp
If one is building a microservice, console application or API, then open the CMD or Git Bash and run
composer create-project symfony/skeleton:"6.1.*" my_project_directory
Notes:
In both cases, by specifying the version shouldn't give us the error that OP is facing.
If error keeps on appearing, would recommend using CMD or Git Bash as I've tried here and worked fine with both.
you forgot to specify the installation folder. Use a dot to install in the current folder.

How to install phpwkhtmltopdf without composer?

On our production server we are still running PHP 5.3.1.
Composer (https://getcomposer.org/) needs PHP 5.3.2 - so close and still so far...
The only documented way to install phpwkhtmltopdf (https://github.com/mikehaertl/phpwkhtmltopdf) is to use Composer.
So is there any way to install phpwkhtmltopdf without using Composer?
It's just a small wrapper for wkhtmltopdf(http://wkhtmltopdf.org/), so i think it should be possible.
thanks for any help!
Even if your sever doesn't have the required PHP version to run composer you can run/install components locally and then upload them to your server ... with the caveat that the package you are installing doesn't have the same PHP version requirements that composer does.

Categories