Installing xdebug on php 5.6 Amazon Linux AMI

2019-05-15 04:29发布

问题:

I created an Elastic Beanstalk Environment

ID_LIKE="rhel fedora"
VERSION_ID="2016.03"
PRETTY_NAME="Amazon Linux AMI 2016.03"
ANSI_COLOR="0;33"
CPE_NAME="cpe:/o:amazon:linux:2016.03:ga"
HOME_URL="http://aws.amazon.com/amazon-linux-ami/"

I'm trying to install xdebug using

sudo yum install php-pecl-xdebug

But I keep get the following error

Loaded plugins: priorities, update-motd, upgrade-helper
Resolving Dependencies
--> Running transaction check
---> Package php-pecl-xdebug.x86_64 0:2.2.3-1.5.amzn1 will be installed
--> Processing Dependency: php(api) = 20090626-x86-64 for package: php-pecl-xdebug-2.2.3-1.5.amzn1.x86_64
--> Processing Dependency: php(zend-abi) = 20090626-x86-64 for package: php-pecl-xdebug-2.2.3-1.5.amzn1.x86_64
--> Running transaction check
---> Package php-common.x86_64 0:5.3.29-1.8.amzn1 will be installed
--> Processing Conflict: php56-common-5.6.21-1.124.amzn1.x86_64 conflicts php-common < 5.5.22-1.98
--> Finished Dependency Resolution
Error: php56-common conflicts with php-common-5.3.29-1.8.amzn1.x86_64
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles --nodigest

What should I be using instead? And for reference how do I figure out which packages are available? Thanks alot.

回答1:

The php-pecl-xdebug depends on the default version of PHP for Amazon Linux, 2.3. Since you have PHP 5.6 installed, you're getting a conflict.

Unfortunately, it looks like Amazon Linux only has packages for xdebug up to PHP 5.5:

[ec2-user@ip-xxx-xxx-xxx-xxx ~]$ sudo yum search xdebug
Loaded plugins: priorities, update-motd, upgrade-helper
============================= N/S matched: xdebug ==============================
php-pecl-xdebug.x86_64 : PECL package for debugging PHP scripts
php54-pecl-xdebug.x86_64 : PECL package for debugging PHP scripts
php55-pecl-xdebug.x86_64 : PECL package for debugging PHP scripts

  Name and summary matches only, use "search all" for everything.

Since there is a PECL package, you can install it through that:

[ec2-user@ip-xxx-xxx-xxx-xxx ~]$ sudo yum install php-pear php56-devel gcc
[ec2-user@ip-xxx-xxx-xxx-xxx ~]$ sudo mount -o remount,exec /var/tmp/
[ec2-user@ip-xxx-xxx-xxx-xxx ~]$ sudo pecl install xdebug
[ec2-user@ip-xxx-xxx-xxx-xxx ~]$ sudo mount -o remount,noexec /var/tmp/