PHP7.1 / Xdebug在MacOs

时间:2016-10-13 09:24:49

标签: php macos xdebug

我最近重新安装了MacBook。安装MacOs之前一切正常。在安装MacOs之后,我在macos上安装了php7.1和xdebug(sierra 10.12(16A323))并使用brew。

brew install homebrew/php/php71
brew install homebrew/php/php71-xdebug

安装完成后,我配置了nginx,php.ini(php-fpm)和PhpStorm。请参阅:https://www.jetbrains.com/help/phpstorm/2016.2/configuring-xdebug.html

#ext-xdebug.ini
[xdebug]
zend_extension="/usr/local/opt/php71-xdebug/xdebug.so"
xdebug.default_enable = 0 
xdebug.remote_autostart = 0 
xdebug.remote_enable = 1
xdebug.remote_handler="dbgp"
xdebug.remote_host="127.0.0.1"
xdebug.idekey="PHPStorm"
xdebug.remote_port = 9001

的信息:

macbook:Install shranet$ php -m | grep -i xdebug
xdebug
Xdebug
macbook:Install shranet$ php --version
PHP 7.1.0RC3 (cli) (built: Oct  5 2016 14:17:16) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.1.0-dev, Copyright (c) 1998-2016 Zend Technologies
    with Xdebug v2.4.0, Copyright (c) 2002-2016, by Derick Rethans
macbook:Install shranet$ 

没有调试,一切正常。当我想调试php-fpm崩溃时。

在syslog中:

...
Oct 13 13:51:09 macbook ReportCrash[32952]: Saved crash report for php-fpm[23776] version 0 to /Users/shranet/Library/Logs/DiagnosticReports/php-fpm_2016-10-13-135109_macbook.crash
...

崩溃文件:

Process:               php-fpm [23776]
Path:                  /usr/local/Cellar/php71/7.1.0-rc.3_8/sbin/php-fpm
Identifier:            php-fpm
Version:               0
Code Type:             X86-64 (Native)
Parent Process:        php-fpm [23693]
Responsible:           php-fpm [23776]
User ID:               501

Date/Time:             2016-10-13 13:51:09.251 +0500
OS Version:            Mac OS X 10.12 (16A323)
Report Version:        12
Anonymous UUID:        03175328-17C1-1699-D293-CBE89EE06B26

Sleep/Wake UUID:       CE27B595-2027-4FE0-BEAB-5EC3D82E03C5

Time Awake Since Boot: 210000 seconds
Time Since Wake:       8400 seconds

System Integrity Protection: enabled

Crashed Thread:        0  Dispatch queue: com.apple.main-thread

Exception Type:        EXC_BAD_ACCESS (SIGSEGV)
Exception Codes:       KERN_INVALID_ADDRESS at 0x0000000200000010
Exception Note:        EXC_CORPSE_NOTIFY

Termination Signal:    Segmentation fault: 11
Termination Reason:    Namespace SIGNAL, Code 0xb
Terminating Process:   exc handler [0]

VM Regions Near 0x200000010:
    __LINKEDIT             000000010fadd000-000000010faf3000 [   88K] r--/rwx SM=COW  /usr/lib/dyld
--> 
    MALLOC_TINY            00007fdd91c00000-00007fdd92000000 [ 4096K] rw-/rwx SM=COW  

Application Specific Information:
crashed on child side of fork pre-exec

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   libsystem_c.dylib               0x00007fffa8c13b92 strlen + 18
1   xdebug.so                       0x0000000102c593b9 check_evaled_code + 39
2   xdebug.so                       0x0000000102c591fd xdebug_dbgp_breakpoint + 430
3   xdebug.so                       0x0000000102c54078 xdebug_statement_call + 324
4   php-fpm                         0x0000000101d2742a zend_llist_apply_with_argument + 31
5   php-fpm                         0x0000000101d973aa ZEND_EXT_STMT_SPEC_HANDLER + 47
6   php-fpm                         0x0000000101d704cb execute_ex + 44
7   php-fpm                         0x0000000101d23bd1 dtrace_execute_ex + 238
8   xdebug.so                       0x0000000102c531ff xdebug_execute_ex + 1996
9   php-fpm                         0x0000000101d70743 zend_execute + 551
10  php-fpm                         0x0000000101d32fb6 zend_execute_scripts + 307
11  php-fpm                         0x0000000101cdb102 php_execute_script + 770
12  php-fpm                         0x0000000101dd7e2b main + 6295
13  libdyld.dylib                   0x00007fffa8bdd255 start + 1

Thread 0 crashed with X86 Thread State (64-bit):
rax: 0x00007fdd91da5d00  rbx: 0x000000020000001e  rcx: 0x000000020000001e  rdx: 0x000000020000001e
rdi: 0x0000000200000010  rsi: 0x00007fff5e249fc0  rbp: 0x00007fff5e249f50  rsp: 0x00007fff5e249f50
r8: 0x0000000000000030   r9: 0x00007fdd91da5d00  r10: 0x00000000fff80000  r11: 0x0000000000000007
r12: 0x00007fdd91d9a6d0  r13: 0x00007fdd91da5d00  r14: 0x00007fff5e249fc0  r15: 0x0000000102c75618
rip: 0x00007fffa8c13b92  rfl: 0x0000000000010202  cr2: 0x0000000200000010

Logical CPU:     0
Error Code:      0x00000004
Trap Number:     14


Binary Images:
    0x1019b5000 -        0x102323ff3 +php-fpm (0) <5E39E45F-C0F5-3B7B-8D4C-EDA207F6038F> /usr/local/opt/php71/sbin/php-fpm
    0x1024d0000 -        0x1024d8ff3 +libintl.8.dylib (0) <9A1967E0-AC59-3EF6-B14F-643AF08A6B4F> /usr/local/opt/gettext/lib/libintl.8.dylib
    0x1024e3000 -        0x102506ffb +libpng16.16.dylib (0) <01088AC2-5BF8-3B05-AD2D-29A5DA7DD88C> /usr/local/opt/libpng/lib/libpng16.16.dylib
    0x10250f000 -        0x10253aff7 +libjpeg.8.dylib (0) <F058D36A-6433-3380-A15D-BF1B2C7CCC5B> /usr/local/opt/jpeg/lib/libjpeg.8.dylib
    0x102542000 -        0x1026b4af7 +libcrypto.1.0.0.dylib (0) <BA2A57BB-4346-303E-A1E8-7862E6752057> /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib
    0x102732000 -        0x102771ff7 +libssl.1.0.0.dylib (0) <E105E614-7546-3784-975F-C5278723D08C> /usr/local/opt/openssl/lib/libssl.1.0.0.dylib
    0x102790000 -        0x102880fff +libxml2.2.dylib (0) <2452DC63-673D-361E-BEB7-90091006445A> /usr/local/opt/libxml2/lib/libxml2.2.dylib
    ... 

External Modification Summary:
Calls made by other processes targeting this process:
    task_for_pid: 488
    thread_create: 0
    thread_set_state: 0
Calls made by this process:
    task_for_pid: 0
    thread_create: 0
    thread_set_state: 0
Calls made by all processes on this machine:
    task_for_pid: 241766
    thread_create: 0
    thread_set_state: 4430

VM Region Summary:
ReadOnly portion of Libraries: Total=205.1M resident=0K(0%) swapped_out_or_unallocated=205.1M(100%)
Writable regions: Total=51.6M written=0K(0%) resident=0K(0%) swapped_out=0K(0%) unallocated=51.6M(100%)

                                VIRTUAL   REGION 
REGION TYPE                        SIZE    COUNT (non-coalesced) 
===========                     =======  ======= 
Kernel Alloc Once                    8K        2 
MALLOC                            37.3M       11 
MALLOC guard page                   16K        4 
STACK GUARD                       56.0M        2 
Stack                             8192K        2 
VM_ALLOCATE                       6348K        9 
__DATA                            10.2M      158 
__LINKEDIT                       112.9M       15 
__TEXT                            92.2M      158 
__UNICODE                          556K        2 
shared memory                       12K        4 
===========                     =======  ======= 
TOTAL                            323.4M      356 

我搜索了互联网,但一无所获。对不起,我的英语很糟糕所以我正在使用谷歌翻译。

更新

我降级到php5.6并且调试器正常工作。

2 个答案:

答案 0 :(得分:1)

我遇到了同样的问题。现在我安装了php70和php70-xdebug

brew install php70 --with-apache
brew install homebrew/php/php70-xdebug

现在使用phpstorm进行调试再次正常工作。

答案 1 :(得分:1)

通过“brew install php71-xdebug”安装xdebug后,我有类似的经历。在试图解决这个问题时,我通过“brew install php70-xdebug”交叉检查了之前安装的xdebug版本,该版本当时正常工作。我发现后者安装了更新版本的xdebug(2.4.1),而前者报告xdebug版本2.4.0作为最新更新。这给了我一个需要的提示,我必须从源代码编译一个更新版本的xdebug。

以下是我采取的步骤。

首先,您需要知道系统中phpize和php-config的路径并安装了git brew install git。 php的默认brew安装将phpize和php-config放在“bin”文件夹中的“php version only”命名文件夹和位于“/ usr / local / Cellar”的php **文件夹中。例如/usr/local/Cellar/php71/7.1.0-rc.5_9/bin/phpize和/usr/local/Cellar/php71/7.1.0-rc.5_9/bin/php-config

cd /tmp
git clone git://github.com/xdebug/xdebug.git
cd xdebug

然后运行phpsize并使用php-config配置

/{your path to phpize}/phpize
./configure --enable-xdebug --with-php-config=/{your path to php-config}/php-config
make
cp modules/xdebug.so {path to preferred location. e.g /usr/local/opt/php71-xdebug}

重启php和你的网络服务器