I have a problem with a Symfony project that I have to work on, when I try a 'composer install' on my bash, I have this message :
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for ocramius/package-versions 1.5.1 -> satisfiable by ocramius/package-versions[1.5.1].
- ocramius/package-versions 1.5.1 requires php ^7.3.0 -> your PHP version (7.2.24) does not satisfy that requirement.
Problem 2
- ocramius/package-versions 1.5.1 requires php ^7.3.0 -> your PHP version (7.2.24) does not satisfy that requirement.
- ocramius/proxy-manager 2.2.3 requires ocramius/package-versions ^1.1.3 -> satisfiable by ocramius/package-versions[1.5.1].
- Installation request for ocramius/proxy-manager 2.2.3 -> satisfiable by ocramius/proxy-manager[2.2.3].
It seems obvious that my php version isn't up-to-date and I have to upgrade to the 7.3.0 version minimum, but when I make an 'apt search php', the latest version that I have is 7.2 and the 'php -v' command return this message :
PHP 7.2.24-0ubuntu0.18.04.3 (cli) (built: Feb 11 2020 15:55:52) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.2.24-0ubuntu0.18.04.3, Copyright (c) 1999-2018, by Zend Technologies
Did anyone how can I force the upgrade of my php version ? It will be very helpfull.
Thanks & have a great day
You can upgrade your PHP version, depending of your OS but you can also "fix" the PHP version in your project with composer.json. In your composer.json you may have a "config" key, add "platform" with your PHP version, 7.2 in your case:
{
"name": "xxxx",
...
"config": {
"platform": {
"php": "7.3"
}
},
...
}
It's recommended to fix the version that you have in production :
Official doc: https://getcomposer.org/doc/06-config.md#platform
Check also this blog article : https://blog.martinhujer.cz/17-tips-for-using-composer-efficiently/ (Tip #15)
To update PHP version to 7.3 on linux, here is steps :
sudo apt-get update
sudo apt -y install software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt -y install php7.3
If you need to install additional packages:
sudo apt-get install -y php7.3-{bcmath,bz2,intl,gd,mbstring,mysql,zip}
Related
I have installed PHP on Ubuntu 22.04 using the command: apt-get install php libapache2-mod-php
When I tried to install a Composer package, I got a message saying
The zip extension and unzip command are both missing, skipping
I took the advice of the top answer to an SO question (PHP error: "The zip extension and unzip command are both missing, skipping.") and ran: apt install zip unzip php-zip. The result of that is shown below:
ubuntu#ip<..>:/var/www/html$ sudo apt install zip unzip php-zip
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
php8.1-zip : Depends: php8.1-common (= 8.1.2-1ubuntu2.2) but 8.1.2-1ubuntu2.3 is to be installed
E: Unable to correct problems, you have held broken packages.
ubuntu#ip-<...>:/var/www/html$ php -v
PHP 8.1.2 (cli) (built: Aug 15 2022 12:24:10) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.2, Copyright (c) Zend Technologies
with Zend OPcache v8.1.2, Copyright (c), by Zend Technologies
ubuntu#ip-<...>:/var/www/html$
I really have no idea how to react to this. Is there some way I can install php-zip without these dependency related problems?
I am trying to add a package via composer on OS X to my CakePHP Application...
└──╼ composer require nbobtc/bitcoind-php
Using version ^2.1 for nbobtc/bitcoind-php
./composer.json has been updated
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
- The requested linked library lib-icu ^62.1 has the wrong version installed, try upgrading the intl extension.
I have installed php 7.3 with brew install php#7.3 and linked with brew link php#7.3 --force
└──╼ php --version
PHP 7.3.9 (cli) (built: Sep 8 2019 14:56:33) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.9, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.3.9, Copyright (c) 1999-2018, by Zend Technologies
I have the intl extension installed...
└──╼ php -m | grep intl
intl
I have the icu4c library installed
└──╼ brew install icu4c
Warning: icu4c 64.2 is already installed and up-to-date
I have also linked the icu4c library
└──╼ brew link icu4c --force
How can I upgrade the intl package?
i've had a similar problem with intl, icu, composer and cake. it's not simple but i think i could help you with some information.
First, I think you have composer ponting to native php, not that one installed with homebrew, because of that you still getting this wrong version of icu.
Second, i wanted to use native php and apache that came with macOS Mojave. Besides official php site informs that intl, since PHP 5.3.0, it's bundled with PHP.
But, it's missing on native instalation of PHP 7.1.24 on Mac OS Mojave.
Then i downloaded PHP 7.1 from php.net, installed XCode Command Line Tools, ICU (http://site.icu-project.org/), Autoconf, reinstalled the developer tools header files, and finally installed Intl extension using phpize.
Important: you'll have to disable SIP. Let me know if worked for you, ok?
I install laravel 5.8 on new Ubuntu 16 instance under Digital Ocean.
I need to install php 7.2 and for this I run commands:
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get remove php7.0
sudo apt-get install php7.2
I was very surprosed that I found php 7.3:
# php -v
PHP 7.3.5-1+ubuntu16.04.1+deb.sury.org+1 (cli) (built: May 3 2019 10:00:05) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.5, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.3.5-1+ubuntu16.04.1+deb.sury.org+1, Copyright (c) 1999-2018, by Zend Technologies
After that I got error on composer installing:
# composer install
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
[ErrorException]
"continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"?
Googling I found that it is some specific php7.3 error and I wonder which can be decision here?
To downgrade to php7.2(If yes how better to make it?)
Or some other decision ?
Thanks!
I upgraded to PHP 7.3, try,
sudo wget https://getcomposer.org/download/1.8.0/composer.phar -O /usr/local/bin/composer && sudo chmod 755 /usr/local/bin/composer
It's just the version dependency. PHP 7.3
and composer update works!
I tried many times to update PHP from 5.5 to 7 on CentOS 7 but always unsuccessful. The installation seems always going well but when I checked php-v it is always:
PHP 5.5.7 (cli) (built: Jul 5 2017 12:03:23)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2013 Zend Technologies
with Zend Guard Loader v3.3, Copyright (c) 1998-2014, by Zend Technologies
Any idea how can I update?
Base repository of CentOS has no php7 packages.
You can use remi repo to install php7 on your CentOS 7.
Why Remi?
PHP package installed from remi repo will work as drop-in replacement for your current php5 binaries.
Remi repo is managed by one of PHP internals
Why not?
To install the Remi repository, we need to enable the EPEL repository first.
sudo yum install epel-release yum-utils
sudo yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
Then Enable php 7.0 (You can use php 7.1+ too)
sudo yum-config-manager --enable remi-php70
Now it's time to install php7
yum install php php-common php-cli php-mysql
Great!!!
Now you have php7 on your system. You can confirm with :
php -v
Details Instruction on how to setup php on different OS : https://rpms.remirepo.net/wizard/
While trying to use Composer to create a Symfony 4 project I got the following error:
steve#laptop ~ $ php composer.phar create-project symfony/skeleton my-proj
Installing symfony/skeleton (v4.0.0)
- Installing symfony/skeleton (v4.0.0): Loading from cache
Created project in my-proj
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
- symfony/framework-bundle v4.0.1 requires ext-xml * -> the requested PHP extension xml is missing from your system.
- symfony/framework-bundle v4.0.0 requires ext-xml * -> the requested PHP extension xml is missing from your system.
- Installation request for symfony/framework-bundle ^4.0 -> satisfiable by symfony/framework-bundle[v4.0.0, v4.0.1].
To enable extensions, verify that they are enabled in your .ini files:
- /etc/php/7.2/cli/php.ini
- /etc/php/7.2/cli/conf.d/10-opcache.ini
- /etc/php/7.2/cli/conf.d/10-pdo.ini
- /etc/php/7.2/cli/conf.d/20-calendar.ini
- /etc/php/7.2/cli/conf.d/20-ctype.ini
- /etc/php/7.2/cli/conf.d/20-exif.ini
- /etc/php/7.2/cli/conf.d/20-fileinfo.ini
- /etc/php/7.2/cli/conf.d/20-ftp.ini
- /etc/php/7.2/cli/conf.d/20-gettext.ini
- /etc/php/7.2/cli/conf.d/20-iconv.ini
- /etc/php/7.2/cli/conf.d/20-json.ini
- /etc/php/7.2/cli/conf.d/20-phar.ini
- /etc/php/7.2/cli/conf.d/20-posix.ini
- /etc/php/7.2/cli/conf.d/20-readline.ini
- /etc/php/7.2/cli/conf.d/20-shmop.ini
- /etc/php/7.2/cli/conf.d/20-sockets.ini
- /etc/php/7.2/cli/conf.d/20-sysvmsg.ini
- /etc/php/7.2/cli/conf.d/20-sysvsem.ini
- /etc/php/7.2/cli/conf.d/20-sysvshm.ini
- /etc/php/7.2/cli/conf.d/20-tokenizer.ini
You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.
steve#laptop ~ $ php --ini
steve#laptop ~ $ php --version
PHP 7.2.0-2+ubuntu16.04.1+deb.sury.org+2 (cli) (built: Dec 7 2017 20:14:31) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2017 Zend Technologies
with Zend OPcache v7.2.0-2+ubuntu16.04.1+deb.sury.org+2, Copyright (c) 1999-2017, by Zend Technologies
steve#laptop ~ $ sudo apt-get install php-xml
[sudo] password for steve:
Reading package lists... Done
Building dependency tree
Reading state information... Done
php-xml is already the newest version (1:7.1+55+ubuntu16.04.1+deb.sury.org+1).
0 to upgrade, 0 to newly install, 0 to remove and 253 not to upgrade.
I did search in php.ini for ext-xml to see if I could uncomment it in order to enable it but I did not find any mention of ext-xml. I have not searched anywhere else because I am very unsure about what I am doing.
Any help would be very much appreciated, Steve
It looks like you're using ubuntu 16.04 with the ondrej/php ppa to get the latest version of php. In this case, the package names need to match the version of php you're using:
apt-get install php7.2-xml
You can see the different versions available with something like this:
apt-cache search php | grep xml
Depending on your configuration, you may need to prefix the installation command with sudo.
Try out
Step 1:
sudo apt install php-xml
Step 2:
Restart apache
Resolved my issue
On Amazon linux or Centos
sudo yum install php-xml
if you're running on nginx restarting is not needed
Remove all versions for php and install only one version