Install Xdebug extension only for PHP7.1

我怕爱的太早我们不能终老 提交于 2019-12-24 02:33:40

问题


I have PHP 7.1 on Ubuntu 16.04 installed. When I'm trying to install Xdebug by using apt-get install php-xdebug, I'm getting xdebug.ini in directories 5.6, 7.0 and 7.1.

I don't need /php/5.6/mods-available/xdebug.ini and /php/7.0/mods-available/xdebug.ini extensions, because I'm using only PHP 7.1 version.

Any ideas?

Thanks.


回答1:


It's because php-xdebug is ambiguous and will download the default package which will contain multiple versions for php compatibility, try going to xdebug site and download the code, then make/build it https://xdebug.org/




回答2:


I used these commands to get xdebug installed and running on 7.2

git clone git://github.com/xdebug/xdebug.git && cd xdebug 
apt-get install -y php7.2-dev && ./rebuild.sh
service php7.2-fpm restart



回答3:


try:

apt install php7.1-xdebug

If I good understood, you don't want to have many xdebug ini files. Ubuntu supports many php versions, which you can switch if you need. If you want to have single xdebug configuration file, I recommend to create catalog mods-available in /etc/php, move xdebug.ini there and make symbolic link from all required paths (for apache2, cli for every php version you need) - for example, for PHP 7.1 with Apache

ln -s /etc/php/mods-available/xdebug.ini /etc/php/7.1/apache2/conf.d/20-xdebug.ini




回答4:


Xdebug has an awesome wizard(form) where you can just paste the content of your php.ini or results of php -i command and get step by step instructions on how to go about setting it up.

In my experience, it's the most reliable and error-free method and I have used in vagrant instances with both mod-php and php-fpm 7.1 & 7.2 versions without any issues.

https://xdebug.org/wizard.php



来源:https://stackoverflow.com/questions/43545327/install-xdebug-extension-only-for-php7-1

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!