nauxliu / opencc4php

简繁体转换 PHP 扩展
MIT License
458 stars 85 forks source link

安装成功,调用失败 #44

Closed thatseason closed 5 years ago

thatseason commented 5 years ago

[root@localhost ~]# opencc --version

Open Chinese Convert (OpenCC) Command Line Tool Version: 1.0.5

[root@localhost ~]# echo '嚴格區分「一簡對多繁」和「一簡對多異」' | opencc -c t2s 严格区分「一简对多繁」和「一简对多异」

php-fpm日志 WARNING: [pool www] child 42340 exited on signal 11 (SIGSEGV) after 0.842551 seconds from start

phpinfo里也有opencc扩展,但是在传入配置文件的时候就会直接502,PHP版本7.2

pkujhd commented 5 years ago

php的error info是啥?

thatseason commented 5 years ago

php的error info是啥?

什么也没有,直接502,xdebug也是在第一行就卡住了,没任何信息

pkujhd commented 5 years ago

系统中有core的信息么?

thatseason commented 5 years ago

系统中core的信息么?

version: 1 creator: xdebug 2.7.2 (PHP 7.2.6) cmd: /home/wwwroot/www.xxx.com/test.php part: 1 positions: line

events: Time Memory

fl=(1) php:internal fn=(1) php::opencc_open 2 15488 24

只有这些

pkujhd commented 5 years ago

我的意思是看下是否有php coredump了,你上面贴的日志是在cli模式下运行的么?

thatseason commented 5 years ago

我的意思是看下是否有php coredump了,你上面贴的日志是在cli模式下运行的么?

Missing separate debuginfo for /lib/libjpeg.so.62 Try: yum --enablerepo='debug' install /usr/lib/debug/.build-id/16/e593c00b05d25f61db68c4e1554cad370da0c0.debug [Thread debugging using libthread_db enabled] Using host libthread_db library "/usr/lib64/libthread_db.so.1". Core was generated by `/usr/local/php7.2/bin/php /home/wwwroot/www.xxx.com/test.php'. Program terminated with signal 11, Segmentation fault.

0 0x00007f5b1aeaaf8f in __strlen_sse42 () from /usr/lib64/libc.so.6

Missing separate debuginfos, use: debuginfo-install bzip2-libs-1.0.6-13.el7.x86_64 cyrus-sasl-lib-2.1.26-23.el7.x86_64 glibc-2.17-260.el7_6.3.x86_64 keyutils-libs-1.5.8-3.el7.x86_64 krb5-libs-1.15.1-37.el7_6.x86_64 libcom_err-1.42.9-13.el7.x86_64 libcurl-7.29.0-51.el7.x86_64 libgcc-4.8.5-36.el7.x86_64 libgcrypt-1.5.3-14.el7.x86_64 libgpg-error-1.12-3.el7.x86_64 libicu-50.1.2-17.el7.x86_64 libidn-1.28-4.el7.x86_64 libselinux-2.5-14.1.el7.x86_64 libssh2-1.4.3-10.el7_2.1.x86_64 libstdc++-4.8.5-36.el7.x86_64 libxml2-2.9.1-6.el7_2.3.x86_64 libxslt-1.1.28-5.el7.x86_64 nspr-4.19.0-1.el7_5.x86_64 nss-3.36.0-7.1.el7_6.x86_64 nss-softokn-freebl-3.36.0-5.el7_5.x86_64 nss-util-3.36.0-1.1.el7_6.x86_64 openldap-2.4.44-13.el7.x86_64 openssl-libs-1.0.2k-16.el7.x86_64 pcre-8.32-17.el7.x86_64 xz-libs-5.2.2-1.el7.x86_64 zlib-1.2.7-18.el7.x86_64 (gdb) (gdb) (gdb) (gdb) (gdb) (gdb) (gdb) (gdb) bt

0 0x00007f5b1aeaaf8f in __strlen_sse42 () from /usr/lib64/libc.so.6

1 0x00007f5b10241299 in zif_opencc_convert (execute_data=, return_value=0x7f5b1721c0c0)

at /root/opencc4php/opencc.c:152

2 0x00007f5b10aa2cc5 in xdebug_execute_internal (current_execute_data=0x7f5b1721c0f0, return_value=0x7f5b1721c0c0)

at /root/xdebug-2.7.2/xdebug.c:2050

3 0x00000000008adc40 in ZEND_DO_FCALL_SPEC_RETVAL_USED_HANDLER () at /root/lnmp1.5/src/php-7.2.6/Zend/zend_vm_execute.h:1034

4 0x000000000090a725 in execute_ex (ex=0x0) at /root/lnmp1.5/src/php-7.2.6/Zend/zend_vm_execute.h:59812

5 0x00007f5b10aa2311 in xdebug_execute_ex (execute_data=0x7f5b1721c030) at /root/xdebug-2.7.2/xdebug.c:1928

6 0x0000000000912ba3 in zend_execute (op_array=op_array@entry=0x7f5b1727d2a0, return_value=return_value@entry=0x0)

at /root/lnmp1.5/src/php-7.2.6/Zend/zend_vm_execute.h:63760

7 0x000000000086d7d4 in zend_execute_scripts (type=type@entry=8, retval=retval@entry=0x0, file_count=file_count@entry=3)

at /root/lnmp1.5/src/php-7.2.6/Zend/zend.c:1496

8 0x000000000080d580 in php_execute_script (primary_file=primary_file@entry=0x7ffd3caa5e80)

at /root/lnmp1.5/src/php-7.2.6/main/main.c:2590

9 0x0000000000914ec5 in do_cli (argc=2, argv=0x2210ad0) at /root/lnmp1.5/src/php-7.2.6/sapi/cli/php_cli.c:1011

10 0x000000000044a41f in main (argc=2, argv=0x2210ad0) at /root/lnmp1.5/src/php-7.2.6/sapi/cli/php_cli.c:1404

thatseason commented 5 years ago

我不会用这个工具,这是现从网上搜索过来的,你看是不是需要这些信息?

pkujhd commented 5 years ago

能把你的测试的php代码发出来么?

thatseason commented 5 years ago

能把你的测试的php代码发出来么?

`<?php $od = opencc_open("s2t.json"); //传入配置文件名

$text = opencc_convert("我鼠标哪儿去了。", $od); echo $text; opencc_close($od);`

pkujhd commented 5 years ago

你的文本是GB2312编码的?这个会导致core

thatseason commented 5 years ago

你的文本是GB2312编码的?这个会导致core

是的 GB2312,以前我也安装过一次 那会也是这个编码 当时使用没问题啊 现在怎么办?

已经知道问题了,我还是先把文件编码转成UTF8好了,谢谢~~

nauxliu commented 5 years ago

@thatseason 使用 iconv 先转换下编码 https://www.php.net/manual/zh/function.iconv.php

Thanks @pkujhd