Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
2.2k views
in Technique[技术] by (71.8m points)

laravel - Error to Install xdebug on Mac OS with php 8

I just want to do phpunit --coveragefor my project first I got this error:

PHPUnit 9.5.0 by Sebastian Bergmann and contributors.

Warning:       No code coverage driver available

I just check my php to make sure I have xdebug via php -v

PHP 8.0.0 (cli) (built: Nov 30 2020 13:51:52) ( NTS )
Copyright (c) The PHP Group
Zend Engine v4.0.0-dev, Copyright (c) Zend Technologies
with Zend OPcache v8.0.0, Copyright (c), by Zend Technologies

seems I do not have it then I just install it via pecl install xdebug Homebrew I got this error at the end of installation:

........

Build process completed successfully
Installing '/usr/local/Cellar/php/8.0.0_1/pecl/20200930/xdebug.so'

Warning: mkdir(): File exists in System.php on line 294

Warning: mkdir(): File exists in /usr/local/Cellar/php/8.0.0_1/share/php/pear/System.php on line 294
ERROR: failed to mkdir /usr/local/Cellar/php/8.0.0_1/pecl/20200930
question from:https://stackoverflow.com/questions/65834853/error-to-install-xdebug-on-mac-os-with-php-8

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

You can step by step debug this problem with starting to check what it is inside the /usr/local/Cellar/php/8.0.0_1 folder running

$ cd /usr/local/Cellar/php/8.0.0_1
$ la -la

I tend to say that there is a pecl symlink already existing which is why pecl cannot create a folder there.

Then you should check where pecl is installed by running which pecl which ideally gives you /usr/local/bin/pecl which should point to somewhere /usr/local/Cellar/php/8.0.0_1/bin/pecl.

If that is the case you can remove the /usr/local/Cellar/php/8.0.0_1/pecl symlink with

$ rm /usr/local/Cellar/php/8.0.0_1/pecl

and try to reinstall xdebug.

Now fixing the image not found issue

This comes from an incorrect configuration during the xdebug installation.

First, check what the path to your php.ini file is by running ˋphp —-iniˋ. Then open the file and check the First line if there is your xdebug Extension loaded. If yes, remove it there. Then add a file xdebug.conf in the conf.d folder and add the following:

;XDebug
zend_extension="/usr/local/Cellar/php/8.0.0/pecl/CHANGEME/xdebug.so"
xdebug.remote_autostart=1
xdebug.remote_port=9000
xdebug.remote_enable=1
xdebug.profiler_enable=1
xdebug.profiler_output_dir="/tmp"

Please check that you have the correct path to your xdebug.so file and that the output dir exists.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

Just Browsing Browsing

[3] html - How to create even cell spacing within a

1.4m articles

1.4m replys

5 comments

57.0k users

...