Error in installing Symfony4 - php

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.

Related

Does Laravel 8 require PHP 8.1?

So.. I developed a project with Laravel 9, then I had to upload it to my client's server by FTP ( which was slow and painful ) to find out only afterwards that my client's server PHP version could not go over 8.0. I tried to open the project live link ( to where I uploaded ) and the composer platform check was telling me my project had dependencies on PHP 8.1 and that my version is 8.0.
So I tried tweaking the platform check php file to disable this check, to see if it would work anyways but no, the project was throwing errors.
So I decided to downgrade to laravel 8, because after searching around I read that laravel 8 did not need php 8.1.
I guess I read some wrong information because after tweaking my project to downgrade to laravel 8 and uploading again (painfully by ftp), the platform check was again telling me that my project needed PHP 8.1.
So I disabled again this platform check by editing/tweaking the platform check php file, to see if it would work anyway, and it did work. So all good. but then today I was learning how to check which composer packages had dependencies on a specific php version, and in the process I found out (if I'm not wrong) that laravel 8 has package dependencies that depend on PHP 8.1 ?
Is there a table somewhere I can check which Laravel versions depend on which PHP versions or do I have to run some commands on each project to check these dependencies?
Like in the images below:
Thanks !
Laravel 9 does not require PHP 8.1 it requires PHP 8.0.2
If this a shared project and someone else with PHP 8.1 generated the composer.lock file (or indeed you locally have PHP 8.1 but the server has 8.0) you might end up with packages that require PHP 8.1. Composer resolves and installs packages based on the locally installed PHP version.
You can override this behaviour and ensure everyone gets package deps based on the PHP version you expect to have on production if you use the platform config option in your composer.json e.g. add this to your composer.json
"config": {
"platform": {
"php": "8.0.2"
}
}
Then run
composer update
this should try to fix your package versions to ones that work with PHP 8
Short response no, Laravel 8 requires PHP >= 7.3
From Server Requirements
But, since you downgraded it is possible that some php packages require newer php versions no matter the version chosen for Laravel.
Some hints:
Change dependencies (packages) version, probably downgrade them.
Delete the vendor folder.
Delete composer.lock
Run composer install
Checking your screenshot: with symfony the downgrade will not break anything.
But, check the other package/s ie: tojsverkoyen/css-to-inline-styles requirements.

Composer reading wrong PHP version (ACQUIA DEV DESKTOP on WINDOWS)

I am trying to install a library https://github.com/thephpleague/csv via composer but getting following errors i.e
'This package requires php >= 5.5.9 but your php version <5.4.45> does not satisfy that requirement.'
My current PHP version is 5.6.30 but for some reason composer is showing <5.4.45> which is strange.
I am using ACQUIA DEV DESKTOP on WINDOWS and can switch between PHP versions easily and can check PHP version either by a) dpm(phpinfo()); or b) drush php which is showing same version as set in ACQUIA DEV DESKTOP.
This leads to an issue linked with the composer as it's reading a wrong PHP version.
Steps I have followed to install this library i.e
Copied composer.phar file from 'DevDesktop/tools' folder onto my Drupal project root and then via drush used 'composer require league/csv' which gives me this error ....
'This package requires php >= 5.5.9 but your php version <5.4.45> does not satisfy that requirement.'
'drush php' gives me this... 'Psy Shell v0.8.3 by Justin Jileman'
I have checked online resources for the similar errors but none of the solution out there matches my situation hence posting this question.
Not sure if this is linked to the issue but I have noticed 'DevDesktop\tools\drush.bat' have first line i.e
IF "%PHP_ID%"=="" (SET PHP_ID=php5_5)
which I changed to
IF "%PHP_ID%"=="" (SET PHP_ID=php5_6)
Stack stop/start and tried to download 'composer require lease/csv' but no change (same results).
Thanks in advance.
Found a solution for this error and wanted to share so as it helps anyone else having same problem and possibly improve the solution as it seems to be a quick fix while it should be a universal fix :)
If you install Acquia DevDesktop software, composer comes with this by default.
From Acquia DevDesktop software, we can easily switch between php versions and can also set a default php version but that was not helpful when I try to download library via composer which kept on reading version 5.4.
As Acquia DevDesktop supports different PHP versions i.e 5.3, 5.4, 5.5, 5.6, 7. By default composer was reading php version 5.4 and I still need to find the file which needs to be modified so as default php version can be changed for composer.
In my case what I did was...
Go to Program Files > DevDesktop > tools folder.
There are 4 files having different extensions but same name i.e 'composer'. Remove these all files will remove composer from your system.
Download composer.exe from https://getcomposer.org/ and give it a target folder i.e 'Program Files > DevDesktop > php5_6' and install.
Once installed, now go to your project and by using command prompt or drush console, type 'composer require league/csv' which should download all files in your projects 'vendor' folder.

Unable to install phalcon 2.x on VPS from 1and1 hosting

I ran into a troublesome issue.
I'm using 1 and 1 virtual private server redhat linux. The server's default PHP version is PHP 5.3.
I do have installed PHP 5.5 on the server. I switch to PHP 5.5 using alias php='path to php'.
I run command php -v to see if the version has changed, indeed it has - the PHP version is now 5.5.
However I am still unable to install phalcon, when I run the command ./install -i I get this error message:
Php 5.3 is not supported.
Any ideas how to resolve this problem?
Alias will not work in your case because it changes php path only for your terminal, not globally.
I'm not a redhat user so can't give you exact steps but a kinda dirty solution is to find your php binary (on debian is in /usr/bin/, /bin/ or /usr/local/bin), rename it to for example php5.3 and in this place make a symbolic link to new php.
Remember that your php webserver (apache, nginx or whatever you use) should also have an updated php! What is more, to compile phalcon you'll need also an updated phpize and other dependencies. I'm not a linux expert so cannot tell you exactly which parts of php5-dev did changed between PHP 5.3 and 5.5 and which did not.
Alternatively you can just clone from github and install an old phalcon 2.x which is also great. The new 3.0 doesn't have that much breaking features. It's killing feature is PHP7 which it seems that you're not going to use. Phalcon 2.x requires PHP5.4+
I belive there are better ways how a php update should be performed but I don't know them.

Windows 10 can't use AWS SDK for PHP v3 with Composer

I'm a student and pretty new to web development so forgive me if I'm missing something obvious. I recently attended a hackathon and was on a team with experienced developers who were building an app for deployment on AWS using the the Silex framework. Everyone else was using a Mac, while I have a PC running Windows 10. When they integrated AWS PHP SDK v3 from packagist I was unable to run the composer update function from the command line - I kept getting the following message:
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- aws/aws-sdk-php 3.3.5 requires php >=5.5 -> your PHP version (5.4.24) or "
config.platform.php" value does not satisfy that requirement.
Because I was unable to run the composer update function, I wasn't able to update my app code and I couldn't continue to work on the project. This was frustrating, but I'm also just very confused about how to update PHP on my computer... I downloaded the zip file for PHP 5.6.13-nts and followed all the instructions I could find online for placing it in a folder structure, I also updated IIS so I can run phpinfo() on localhost and see that I have version 5.6.13 - yet when I try to run the composer update it still says I have PHP 5.4.24.
If anyone has any advice on this issue I'd appreciate it. Here's the version of the AWS SDK that's referenced above:
https://packagist.org/packages/aws/aws-sdk-php-silex
Welcome to StackOverflow, Blake!
It seems that you have multiple PHP versions installed and the CLI command php composer.phar ... uses php.exe from the old version. My guess is that the old version is still on the env path.
I suggest to check your environment path to find out, if the path to the old version of PHP is still added there. If so, simply replace it by the path to the new PHP version. And then execute a simple php -v on the CLI to see, if the new version is used. After that Composer should run fine.
You reach the dialog to change the environment variables by pressing WinBreak, then select "Advanced system settings", then "Environment Variables", then "Path".
(Sidenote and shameless plug: there are pre-configured web development stacks for Windows out there: WPN-XM or XAMPP, just to name a few. They are made to save developers some time, instead of doing software installation and configuration. Some of them ship Composer and other tools relevant for development with PHP right out of the box.)

All-in-one PHP bundle for Ubuntu

I need to deploy Zend Framework app on Ubuntu.
I've downloaded Ubuntu desktop, installed using apt-get apache+php+mysql,
but PHP turned out to be not the latest 5.3, but 5.2.1 and even
mysql extension is missing.
I understand I can get somewhere a fresh php installation, get dependent libs (like curl or libxml2) compile them one by one and then I get full-features latest PHP bundle.
But is there anywhere already full PHP bundle with latest version and all libs to get
ZF app running very quickly?
One of the downsides of package management is that you're at the mercy of the package maintainers. Ubuntu has opted not to update to PHP 5.3 in this version, so you'll have to either wait until 2010 for it or compile PHP yourself.
Most of the PHP extensions that arent in a default source build directly from PHP are in seperate apt packages. If you do a search for PHP5 in you package manager youll see packages like:
PHP5
PHP5-Mysql
PHP5-cli
PHP5-SQLite
etc..
Im going to assume that there are also packages specifically for php 5.3 - most likely labeled as php53-* or something similar. You may need to adda repo for this as im not sure its in the crore repos.
Anyhow you need to isntall all these packages that you need to use.
I ran into similar issues getting the latest PHP on my CentOS server. I installed Zend Server Community Edition, which sets up it's own Apache/PHP5.3 stack in /usr/local/zend. And here's a Getting Started article.
It's a full PHP bundle.
If you need other packages for Ubuntu, check the ubuntu repository for PHP5 at http://bg.archive.ubuntu.com/ubuntu/pool/main/p/php5/

Categories