GithubHelp home page GithubHelp logo

nauxliu / opencc4php Goto Github PK

View Code? Open in Web Editor NEW
455.0 28.0 86.0 55 KB

简繁体转换 PHP 扩展

License: MIT License

PHP 8.91% C 72.54% Shell 0.85% M4 14.75% JavaScript 2.94%
opencc opencc-php simplified-chinese traditional-chinese chinese-translation

opencc4php's Introduction

opencc4php

Build Status LICENSE

opencc4php 是 OpenCC 的PHP扩展,能很智能的完成简繁体转换。

支持 PHP 版本: 7.1 - 8.0

转换效果:

你干什么不干我事 => 你幹什麼不干我事

地区词汇转换效果:
我鼠标哪儿去了 => 我滑鼠哪兒去了

安装

Linux | OS X

你需要先安装1.0.1 版本以上的OpenCC

Ubuntu:

apt-get install libopencc-dev -y

从源码安装

git clone https://github.com/BYVoid/OpenCC.git --depth 1
cd OpenCC
make
sudo make install

安装opencc4php:

git clone [email protected]:NauxLiu/opencc4php.git --depth 1
cd opencc4php
phpize
./configure
make && sudo make install

如果你的OpenCC安装目录不在/usr/usr/local,可在./configure时添加--with-opencc=[DIR]指定你的OpenCC目录

Windows

Windows 安装说明

使用

实例:

$od = opencc_open("s2twp.json"); //传入配置文件名
$text = opencc_convert("我鼠标哪儿去了。", $od);
echo $text;
opencc_close($od);

输出: 我滑鼠哪兒去了

函数列表:

opencc_open(string ConfigName) ConfigName:配置文件名,成功返回资源对象,失败返回false
opencc_close(resource ob) 关闭资源对象,成功返回true,失败返回false.
opencc_error() 返回最后一条错误信息,有错误信息返回String,无错误返回false
opencc_convert(string str, resource od) str:要转换的字符串(UTF-8),od:opencc资源对象

可用配置

  • s2t.json 简体到繁体
  • t2s.json 繁体到简体
  • s2tw.json 简体到**正体
  • tw2s.json **正体到简体
  • s2hk.json 简体到香港繁体(香港小学学习字词表标准)
  • hk2s.json 香港繁体(香港小学学习字词表标准)到简体
  • s2twp.json 简体到繁体(**正体标准)并转换为**常用词汇
  • tw2sp.json 繁体(**正体标准)到简体并转换为**大陆常用词汇

贡献列表

@刘相轩
@Kyle Tse
@Alliumcepa Triplef
@acgrid
@pkujhd
@bc

opencc4php's People

Contributors

acgrid avatar fffonion avatar ice6 avatar nauxliu avatar pkujhd avatar shtse8 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

opencc4php's Issues

添加模块后,启动php-fpm时出错

安装后修改php.ini加入extension=opencc.so。重启php-fpm,然后出现如下问题:

21-Jul-2016 11:08:57] NOTICE: PHP message: PHP Warning:  PHP Startup: opencc: Unable to initialize module
Module compiled with module API=20100525
PHP    compiled with module API=20131226
These options need to match
 in Unknown on line 0
<br />
<b>Warning</b>:  PHP Startup: opencc: Unable to initialize module
Module compiled with module API=20100525
PHP    compiled with module API=20131226
These options need to match
 in <b>Unknown</b> on line <b>0</b><br />

新版本是不是有什么BUG,死活安装不上

make test这部
PHP 7.1 7.3都 试过了,都 是这提示
`Build complete.
Don't forget to run 'make test'.

=====================================================================
PHP : /www/server/php/70/bin/php
PHP_SAPI : cli
PHP_VERSION : 7.0.33
ZEND_VERSION: 3.0.0
PHP_OS : Linux - Linux debian 4.9.0-13-amd64 #1 SMP Debian 4.9.228-1 (2020-07-05) x86_64
INI actual : /root/opencc4php/tmp-php.ini
More .INIs :

PHP : /www/server/php/70/bin/phpdbg
PHP_SAPI : phpdbg
PHP_VERSION : 7.0.33
ZEND_VERSION: 3.0.0
PHP_OS : Linux - Linux debian 4.9.0-13-amd64 #1 SMP Debian 4.9.228-1 (2020-07-05) x86_64
INI actual : /root/opencc4php/tmp-php.ini
More .INIs :

CWD : /root/opencc4php
Extra dirs :
VALGRIND : Not used

TIME START 2021-02-21 03:54:23

PASS Check for opencc presence [tests/001.phpt]
FAIL Test opencc4php [tests/002.phpt]

TIME END 2021-02-21 03:54:23

=====================================================================
TEST RESULT SUMMARY

Exts skipped : 0
Exts tested : 44

Number of tests : 2 2
Tests skipped : 0 ( 0.0%) --------
Tests warned : 0 ( 0.0%) ( 0.0%)
Tests failed : 1 ( 50.0%) ( 50.0%)
Expected fail : 0 ( 0.0%) ( 0.0%)
Tests passed : 1 ( 50.0%) ( 50.0%)

Time taken : 0 seconds

=====================================================================
FAILED TEST SUMMARY

Test opencc4php [tests/002.phpt]

You may have found a problem in PHP.
This report can be automatically sent to the PHP QA team at
http://qa.php.net/reports and http://news.php.net/php.qa.reports
This gives us a better understanding of PHP's behavior.
If you don't want to send the report immediately you can choose
option "s" to save it. You can then email it to [email protected] later.
Do you want to send this report now? [Yns]:
`

加载不上这个扩展,make test 错误

PHP : /usr/local/php74/bin/php
Warning: PHP Startup: Unable to load dynamic library 'opencc.so' (tried: /root/downloads/opencc4php/modules/opencc.so (libopencc.so.2: cannot open shared object file: No such file or directory), /root/downloads/opencc4php/modules/opencc.so.so (/root/downloads/opencc4php/modules/opencc.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0

PHP_SAPI : cli
PHP_VERSION : 7.4.1
ZEND_VERSION: 3.4.0
PHP_OS : Linux - Linux mit2 3.10.0-957.21.3.el7.x86_64 #1 SMP Tue Jun 18 16:35:19 UTC 2019 x86_64
INI actual : /root/downloads/opencc4php/tmp-php.ini
More .INIs :

PHP : /usr/local/php74/bin/phpdbg
PHP_SAPI : PHP Warning: PHP Startup: Unable to load dynamic library 'opencc.so' (tried: /root/downloads/opencc4php/modules/opencc.so (libopencc.so.2: cannot open shared object file: No such file or directory), /root/downloads/opencc4php/modules/opencc.so.so (/root/downloads/opencc4php/modules/opencc.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0

...


CWD : /root/downloads/opencc4php
Extra dirs :
VALGRIND : Not used

TIME START 2020-03-02 12:38:37

FAIL Check for opencc presence [tests/001.phpt]
FAIL Test opencc4php [tests/002.phpt]

TIME END 2020-03-02 12:38:37

=====================================================================
TEST RESULT SUMMARY

Exts skipped : 0
Exts tested : 50

Number of tests : 2 2
Tests skipped : 0 ( 0.0%) --------
Tests warned : 0 ( 0.0%) ( 0.0%)
Tests failed : 2 (100.0%) (100.0%)
Tests passed : 0 ( 0.0%) ( 0.0%)

Time taken : 0 seconds

=====================================================================
FAILED TEST SUMMARY

Check for opencc presence [tests/001.phpt]
Test opencc4php [tests/002.phpt]

You may have found a problem in PHP.

安装成功,调用失败

php -m和phpinfo打印都能看到opencc已经成功安装,
但是在调用opencc_open时,
image
image

$od返回false,加载不到资源,求问一下为是啥?

安装完成后无法打开opencc.php

安装完成后无法打开opencc.php
nginx log:
2015/10/25 09:00:48 [error] 28219#0: *1172 FastCGI sent in stderr: "PHP message: PHP Warning: dl(): Dynamically loaded extensions aren't enabled in /home/html/opencc4php/opencc.php on line 5
PHP message: PHP Warning: Invalid argument supplied for foreach() in /home/html/opencc4php/opencc.php on line 10
PHP message: PHP Fatal error: Call to undefined function opencc_error() in /home/html/opencc4php/opencc.php on line 14" while reading response header from upstream, client: 114.111.167.7, server: opencc4php.com, request: "GET /opencc.php HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "opencc4php.com"

fatal: Could not read from remote repository.

Cloning into 'opencc4php'...
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

多次调用php-fpm超时

$od = opencc_open("s2twp.json"); //传入配置文件名
$text = opencc_convert("我鼠标哪儿去了。", $od);
echo $text;
opencc_close($od);

一个页面多次调用,会出现php-fpm 超时。。。

PHP 5.4.30 (cli) (built: Jul 29 2014 23:43:29)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2014 Zend Technologies
with Xdebug v2.2.3, Copyright (c) 2002-2013, by Derick Rethans
with Zend Guard Loader v3.3, Copyright (c) 1998-2013, by Zend Technologies

安装成功,调用失败

[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

make 会出现 PHP_FE_END 的错误

[root@localhost opencc4php]# make
/bin/sh /var/www/html/opencc4php/libtool --mode=compile cc -I. -I/var/www/html/opencc4php -DPHP_ATOM_INC -I/var/www/html/opencc4php/include -I/var/www/html/opencc4php/main -I/var/www/html/opencc4php -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I/usr/include/opencc -DHAVE_CONFIG_H -g -O2 -c /var/www/html/opencc4php/opencc.c -o opencc.lo
libtool: compile: cc -I. -I/var/www/html/opencc4php -DPHP_ATOM_INC -I/var/www/html/opencc4php/include -I/var/www/html/opencc4php/main -I/var/www/html/opencc4php -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I/usr/include/opencc -DHAVE_CONFIG_H -g -O2 -c /var/www/html/opencc4php/opencc.c -fPIC -DPIC -o .libs/opencc.o
/var/www/html/opencc4php/opencc.c: In function 'zif_opencc_close':
/var/www/html/opencc4php/opencc.c:79:16: warning: initialization makes pointer from integer without a cast [enabled by default]
/var/www/html/opencc4php/opencc.c: In function 'zif_opencc_error':
/var/www/html/opencc4php/opencc.c:105:6: warning: assignment discards 'const' qualifier from pointer target type [enabled by default]
/var/www/html/opencc4php/opencc.c: At top level:
/var/www/html/opencc4php/opencc.c:212:2: error: 'PHP_FE_END' undeclared here (not in a function)
make: *** [opencc.lo] Error 1

make 会出现 PHP_FE_END 的错误
我在网上查到的资料都是屏蔽掉,如:
//PHP_FE_END
{NULL,NULL,NULL}

但还是无法正常运作,请问要如何排除,谢谢
CentOS 6.6
PHP 5.3.3

老是出现这个错误怎么搞。

mkdir -p build/rel
(cd build/rel; cmake
-DBUILD_DOCUMENTATION:BOOL=ON
-DENABLE_GTEST:BOOL=OFF
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_INSTALL_PREFIX=/usr
../..)
/bin/sh: line 1: cmake: command not found
make: *** [build] Error 127

make报错了,请帮忙解决

root@cust:/home/cust/opencc4php# make && make install
/bin/bash /home/cust/opencc4php/libtool --mode=compile cc  -I. -I/home/cust/opencc4php -DPHP_ATOM_INC -I/home/cust/opencc4php/include -I/home/cust/opencc4php/main -I/home/cust/opencc4php -I/usr/include/php/20160303 -I/usr/include/php/20160303/main -I/usr/include/php/20160303/TSRM -I/usr/include/php/20160303/Zend -I/usr/include/php/20160303/ext -I/usr/include/php/20160303/ext/date/lib -I/usr/include/opencc  -DHAVE_CONFIG_H  -g -O2   -c /home/cust/opencc4php/opencc.c -o opencc.lo 
libtool: compile:  cc -I. -I/home/cust/opencc4php -DPHP_ATOM_INC -I/home/cust/opencc4php/include -I/home/cust/opencc4php/main -I/home/cust/opencc4php -I/usr/include/php/20160303 -I/usr/include/php/20160303/main -I/usr/include/php/20160303/TSRM -I/usr/include/php/20160303/Zend -I/usr/include/php/20160303/ext -I/usr/include/php/20160303/ext/date/lib -I/usr/include/opencc -DHAVE_CONFIG_H -g -O2 -c /home/cust/opencc4php/opencc.c  -fPIC -DPIC -o .libs/opencc.o
/home/cust/opencc4php/opencc.c: In function ‘zif_opencc_error’:
/home/cust/opencc4php/opencc.c:121:8: error: expected expression before ‘opencc_error’
  msg = opencc_error();
        ^
Makefile:194: recipe for target 'opencc.lo' failed
make: *** [opencc.lo] Error 1

sudo apt-get install libopencc-dev -y
Reading package lists... Done
Building dependency tree       
Reading state information... Done
libopencc-dev is already the newest version (0.4.3-2build1).
0 upgraded, 0 newly installed, 0 to remove and 259 not upgraded.

类似的错误,请问这个怎么处理? ubuntu16.04 和 php7.1.3

Originally posted by @SamHz in #35 (comment)

opencc源码编译bug

问题1:在源码编译opencc时,默认cmakefile中指定的cmake版本是3.5,编译时实际上会遇到找不到依赖包的问题,如图:
image

解决: 需要手动下载一份最新的cmake,我用3.26版本就能正常编译

问题2:如果编译时遇到 c++14报错的问题,也需要改cmakefile,指定c++版本
解决:
g++ -std=c++11 -E - < /dev/null // 可检查本地gcc支持哪个版本的c++,可以试试c++11,都是向下兼容
sed -ri-bak 's#(.*-std=)c++14$#\1c++11#' CMakeLists.txt //非交互式修改配置文件

PHP 7.0.19 编译的时候报错

PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/opencc4php/modules/opencc.so' - libopencc.so.2: cannot open shared object file: No such file or directory in Unknown on line 0

Unable to load dynamic library 'opencc'

/var/www/html # php -v
PHP Warning: PHP Startup: Unable to load dynamic library 'opencc' (tried: /usr/local/lib/php/extensions/no-debug-non-zts-20190902/opencc (Error loading shared library /usr/local/lib/php/extensions/no-debug-non-zts-20190902/opencc: No such file or directory), /usr/local/lib/php/extensions/no-debug-non-zts-20190902/opencc.so (Error relocating /usr/lib/libopencc.so.1.1: _ZSt28__throw_bad_array_new_lengthv: symbol not found)) in Unknown on line 0
PHP 7.4.27 (cli) (built: Dec 16 2021 22:42:18) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with Zend OPcache v7.4.27, Copyright (c), by Zend Technologies

OpenCC安装时候出错是怎么回事儿?

/Users/jinchangli/Downloads/OpenCC/README.md:5: warning: Unexpected html tag <img> found within <a href=...> context
[ 58%] Built target apidoc
[100%] Built target Dictionaries
Install the project...
-- Install configuration: "Release"
-- Installing: /usr/lib/pkgconfig/opencc.pc
CMake Error at cmake_install.cmake:39 (file):
  file INSTALL cannot copy file
  "/Users/jinchangli/Downloads/OpenCC/build/rel/opencc.pc" to
  "/usr/lib/pkgconfig/opencc.pc".


make[1]: *** [install] Error 1
make: *** [install] Error 2

已经用了root权限了还报错,能帮我看一下吗?

无法编译通过啊。。。CentOS7.2+PHP7.1.0

OpenCC的安装方法是:yum install opencc
查了一下安装目录是:/usr/share/opencc

编译错误是:执行make时返回,make: *** 没有指明目标并且找不到 makefile。 停止。

请问要怎么编译啊?

安装失败

The system is: Linux - 3.16.0-4-amd64 - x86_64
Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" succeeded.
Compiler: /usr/bin/c++
Build flags:
Id flags:

The output was:
0

Compilation of the CXX compiler identification source "CMakeCXXCompilerId.cpp" produced "a.out"

The CXX compiler identification is GNU, found in "/root/OpenCC/build/rel/CMakeFiles/3.0.2/CompilerIdCXX/a.out"

Determining if the CXX compiler works passed with the following output:
Change Dir: /root/OpenCC/build/rel/CMakeFiles/CMakeTmp

Run Build Command:"/usr/bin/make" "cmTryCompileExec1854493236/fast"
make[1]: Entering directory '/root/OpenCC/build/rel/CMakeFiles/CMakeTmp'
/usr/bin/make -f CMakeFiles/cmTryCompileExec1854493236.dir/build.make CMakeFiles/cmTryCompileExec1854493236.dir/build
make[2]: Entering directory '/root/OpenCC/build/rel/CMakeFiles/CMakeTmp'
/usr/bin/cmake -E cmake_progress_report /root/OpenCC/build/rel/CMakeFiles/CMakeTmp/CMakeFiles 1
Building CXX object CMakeFiles/cmTryCompileExec1854493236.dir/testCXXCompiler.cxx.o
/usr/bin/c++ -o CMakeFiles/cmTryCompileExec1854493236.dir/testCXXCompiler.cxx.o -c /root/OpenCC/build/rel/CMakeFiles/CMakeTmp/testCXXCompiler.cxx
Linking CXX executable cmTryCompileExec1854493236
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTryCompileExec1854493236.dir/link.txt --verbose=1
/usr/bin/c++ CMakeFiles/cmTryCompileExec1854493236.dir/testCXXCompiler.cxx.o -o cmTryCompileExec1854493236 -rdynamic
make[2]: Leaving directory '/root/OpenCC/build/rel/CMakeFiles/CMakeTmp'
make[1]: Leaving directory '/root/OpenCC/build/rel/CMakeFiles/CMakeTmp'

Detecting CXX compiler ABI info compiled with the following output:
Change Dir: /root/OpenCC/build/rel/CMakeFiles/CMakeTmp

Run Build Command:"/usr/bin/make" "cmTryCompileExec1537843479/fast"
make[1]: Entering directory '/root/OpenCC/build/rel/CMakeFiles/CMakeTmp'
/usr/bin/make -f CMakeFiles/cmTryCompileExec1537843479.dir/build.make CMakeFiles/cmTryCompileExec1537843479.dir/build
make[2]: Entering directory '/root/OpenCC/build/rel/CMakeFiles/CMakeTmp'
/usr/bin/cmake -E cmake_progress_report /root/OpenCC/build/rel/CMakeFiles/CMakeTmp/CMakeFiles 1
Building CXX object CMakeFiles/cmTryCompileExec1537843479.dir/CMakeCXXCompilerABI.cpp.o
/usr/bin/c++ -o CMakeFiles/cmTryCompileExec1537843479.dir/CMakeCXXCompilerABI.cpp.o -c /usr/share/cmake-3.0/Modules/CMakeCXXCompilerABI.cpp
Linking CXX executable cmTryCompileExec1537843479
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTryCompileExec1537843479.dir/link.txt --verbose=1
/usr/bin/c++ -v CMakeFiles/cmTryCompileExec1537843479.dir/CMakeCXXCompilerABI.cpp.o -o cmTryCompileExec1537843479 -rdynamic
Using built-in specs.
COLLECT_GCC=/usr/bin/c++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.9/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 4.9.2-10' --with-bugurl=file:///usr/share/doc/gcc-4.9/README.Bugs --enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.9 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.9 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.9-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.9-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.9-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --with-arch-32=i586 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.9.2 (Debian 4.9.2-10)
COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/4.9/:/usr/lib/gcc/x86_64-linux-gnu/4.9/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/4.9/:/usr/lib/gcc/x86_64-linux-gnu/
LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/4.9/:/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-v' '-o' 'cmTryCompileExec1537843479' '-rdynamic' '-shared-libgcc' '-mtune=generic' '-march=x86-64'
/usr/lib/gcc/x86_64-linux-gnu/4.9/collect2 -plugin /usr/lib/gcc/x86_64-linux-gnu/4.9/liblto_plugin.so -plugin-opt=/usr/lib/gcc/x86_64-linux-gnu/4.9/lto-wrapper -plugin-opt=-fresolution=/tmp/ccP9Q2yj.res -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc --sysroot=/ --build-id --eh-frame-hdr -m elf_x86_64 --hash-style=gnu -export-dynamic -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o cmTryCompileExec1537843479 /usr/lib/gcc/x86_64-linux-gnu/4.9/../../../x86_64-linux-gnu/crt1.o /usr/lib/gcc/x86_64-linux-gnu/4.9/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/4.9/crtbegin.o -L/usr/lib/gcc/x86_64-linux-gnu/4.9 -L/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/4.9/../../.. CMakeFiles/cmTryCompileExec1537843479.dir/CMakeCXXCompilerABI.cpp.o -lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc /usr/lib/gcc/x86_64-linux-gnu/4.9/crtend.o /usr/lib/gcc/x86_64-linux-gnu/4.9/../../../x86_64-linux-gnu/crtn.o
make[2]: Leaving directory '/root/OpenCC/build/rel/CMakeFiles/CMakeTmp'
make[1]: Leaving directory '/root/OpenCC/build/rel/CMakeFiles/CMakeTmp'

Parsed CXX implicit link information from above output:
link line regex: [^( |.[/])(ld|([^/]+-)?ld|collect2)[^/\]*( |$)]
ignore line: [Change Dir: /root/OpenCC/build/rel/CMakeFiles/CMakeTmp]
ignore line: []
ignore line: [Run Build Command:"/usr/bin/make" "cmTryCompileExec1537843479/fast"]
ignore line: [make[1]: Entering directory '/root/OpenCC/build/rel/CMakeFiles/CMakeTmp']
ignore line: [/usr/bin/make -f CMakeFiles/cmTryCompileExec1537843479.dir/build.make CMakeFiles/cmTryCompileExec1537843479.dir/build]
ignore line: [make[2]: Entering directory '/root/OpenCC/build/rel/CMakeFiles/CMakeTmp']
ignore line: [/usr/bin/cmake -E cmake_progress_report /root/OpenCC/build/rel/CMakeFiles/CMakeTmp/CMakeFiles 1]
ignore line: [Building CXX object CMakeFiles/cmTryCompileExec1537843479.dir/CMakeCXXCompilerABI.cpp.o]
ignore line: [/usr/bin/c++ -o CMakeFiles/cmTryCompileExec1537843479.dir/CMakeCXXCompilerABI.cpp.o -c /usr/share/cmake-3.0/Modules/CMakeCXXCompilerABI.cpp]
ignore line: [Linking CXX executable cmTryCompileExec1537843479]
ignore line: [/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTryCompileExec1537843479.dir/link.txt --verbose=1]
ignore line: [/usr/bin/c++ -v CMakeFiles/cmTryCompileExec1537843479.dir/CMakeCXXCompilerABI.cpp.o -o cmTryCompileExec1537843479 -rdynamic ]
ignore line: [Using built-in specs.]
ignore line: [COLLECT_GCC=/usr/bin/c++]
ignore line: [COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.9/lto-wrapper]
ignore line: [Target: x86_64-linux-gnu]
ignore line: [Configured with: ../src/configure -v --with-pkgversion='Debian 4.9.2-10' --with-bugurl=file:///usr/share/doc/gcc-4.9/README.Bugs --enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.9 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.9 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.9-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.9-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.9-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --with-arch-32=i586 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu]
ignore line: [Thread model: posix]
ignore line: [gcc version 4.9.2 (Debian 4.9.2-10) ]
ignore line: [COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/4.9/:/usr/lib/gcc/x86_64-linux-gnu/4.9/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/4.9/:/usr/lib/gcc/x86_64-linux-gnu/]
ignore line: [LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/4.9/:/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../:/lib/:/usr/lib/]
ignore line: [COLLECT_GCC_OPTIONS='-v' '-o' 'cmTryCompileExec1537843479' '-rdynamic' '-shared-libgcc' '-mtune=generic' '-march=x86-64']
link line: [ /usr/lib/gcc/x86_64-linux-gnu/4.9/collect2 -plugin /usr/lib/gcc/x86_64-linux-gnu/4.9/liblto_plugin.so -plugin-opt=/usr/lib/gcc/x86_64-linux-gnu/4.9/lto-wrapper -plugin-opt=-fresolution=/tmp/ccP9Q2yj.res -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc --sysroot=/ --build-id --eh-frame-hdr -m elf_x86_64 --hash-style=gnu -export-dynamic -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o cmTryCompileExec1537843479 /usr/lib/gcc/x86_64-linux-gnu/4.9/../../../x86_64-linux-gnu/crt1.o /usr/lib/gcc/x86_64-linux-gnu/4.9/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/4.9/crtbegin.o -L/usr/lib/gcc/x86_64-linux-gnu/4.9 -L/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/4.9/../../.. CMakeFiles/cmTryCompileExec1537843479.dir/CMakeCXXCompilerABI.cpp.o -lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc /usr/lib/gcc/x86_64-linux-gnu/4.9/crtend.o /usr/lib/gcc/x86_64-linux-gnu/4.9/../../../x86_64-linux-gnu/crtn.o]
arg [/usr/lib/gcc/x86_64-linux-gnu/4.9/collect2] ==> ignore
arg [-plugin] ==> ignore
arg [/usr/lib/gcc/x86_64-linux-gnu/4.9/liblto_plugin.so] ==> ignore
arg [-plugin-opt=/usr/lib/gcc/x86_64-linux-gnu/4.9/lto-wrapper] ==> ignore
arg [-plugin-opt=-fresolution=/tmp/ccP9Q2yj.res] ==> ignore
arg [-plugin-opt=-pass-through=-lgcc_s] ==> ignore
arg [-plugin-opt=-pass-through=-lgcc] ==> ignore
arg [-plugin-opt=-pass-through=-lc] ==> ignore
arg [-plugin-opt=-pass-through=-lgcc_s] ==> ignore
arg [-plugin-opt=-pass-through=-lgcc] ==> ignore
arg [--sysroot=/] ==> ignore
arg [--build-id] ==> ignore
arg [--eh-frame-hdr] ==> ignore
arg [-m] ==> ignore
arg [elf_x86_64] ==> ignore
arg [--hash-style=gnu] ==> ignore
arg [-export-dynamic] ==> ignore
arg [-dynamic-linker] ==> ignore
arg [/lib64/ld-linux-x86-64.so.2] ==> ignore
arg [-o] ==> ignore
arg [cmTryCompileExec1537843479] ==> ignore
arg [/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../x86_64-linux-gnu/crt1.o] ==> ignore
arg [/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../x86_64-linux-gnu/crti.o] ==> ignore
arg [/usr/lib/gcc/x86_64-linux-gnu/4.9/crtbegin.o] ==> ignore
arg [-L/usr/lib/gcc/x86_64-linux-gnu/4.9] ==> dir [/usr/lib/gcc/x86_64-linux-gnu/4.9]
arg [-L/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../x86_64-linux-gnu] ==> dir [/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../x86_64-linux-gnu]
arg [-L/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../../lib] ==> dir [/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../../lib]
arg [-L/lib/x86_64-linux-gnu] ==> dir [/lib/x86_64-linux-gnu]
arg [-L/lib/../lib] ==> dir [/lib/../lib]
arg [-L/usr/lib/x86_64-linux-gnu] ==> dir [/usr/lib/x86_64-linux-gnu]
arg [-L/usr/lib/../lib] ==> dir [/usr/lib/../lib]
arg [-L/usr/lib/gcc/x86_64-linux-gnu/4.9/../../..] ==> dir [/usr/lib/gcc/x86_64-linux-gnu/4.9/../../..]
arg [CMakeFiles/cmTryCompileExec1537843479.dir/CMakeCXXCompilerABI.cpp.o] ==> ignore
arg [-lstdc++] ==> lib [stdc++]
arg [-lm] ==> lib [m]
arg [-lgcc_s] ==> lib [gcc_s]
arg [-lgcc] ==> lib [gcc]
arg [-lc] ==> lib [c]
arg [-lgcc_s] ==> lib [gcc_s]
arg [-lgcc] ==> lib [gcc]
arg [/usr/lib/gcc/x86_64-linux-gnu/4.9/crtend.o] ==> ignore
arg [/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../x86_64-linux-gnu/crtn.o] ==> ignore
remove lib [gcc_s]
remove lib [gcc]
remove lib [gcc_s]
remove lib [gcc]
collapse library dir [/usr/lib/gcc/x86_64-linux-gnu/4.9] ==> [/usr/lib/gcc/x86_64-linux-gnu/4.9]
collapse library dir [/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../x86_64-linux-gnu] ==> [/usr/lib/x86_64-linux-gnu]
collapse library dir [/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../../lib] ==> [/usr/lib]
collapse library dir [/lib/x86_64-linux-gnu] ==> [/lib/x86_64-linux-gnu]
collapse library dir [/lib/../lib] ==> [/lib]
collapse library dir [/usr/lib/x86_64-linux-gnu] ==> [/usr/lib/x86_64-linux-gnu]
collapse library dir [/usr/lib/../lib] ==> [/usr/lib]
collapse library dir [/usr/lib/gcc/x86_64-linux-gnu/4.9/../../..] ==> [/usr/lib]
implicit libs: [stdc++;m;c]
implicit dirs: [/usr/lib/gcc/x86_64-linux-gnu/4.9;/usr/lib/x86_64-linux-gnu;/usr/lib;/lib/x86_64-linux-gnu;/lib]
implicit fwks: []

Performing C++ SOURCE FILE Test COMPILER_HAS_HIDDEN_VISIBILITY succeded with the following output:
Change Dir: /root/OpenCC/build/rel/CMakeFiles/CMakeTmp

Run Build Command:"/usr/bin/make" "cmTryCompileExec1622732998/fast"
make[1]: Entering directory '/root/OpenCC/build/rel/CMakeFiles/CMakeTmp'
/usr/bin/make -f CMakeFiles/cmTryCompileExec1622732998.dir/build.make CMakeFiles/cmTryCompileExec1622732998.dir/build
make[2]: Entering directory '/root/OpenCC/build/rel/CMakeFiles/CMakeTmp'
/usr/bin/cmake -E cmake_progress_report /root/OpenCC/build/rel/CMakeFiles/CMakeTmp/CMakeFiles 1
Building CXX object CMakeFiles/cmTryCompileExec1622732998.dir/src.cxx.o
/usr/bin/c++ -DCOMPILER_HAS_HIDDEN_VISIBILITY -fvisibility=hidden -o CMakeFiles/cmTryCompileExec1622732998.dir/src.cxx.o -c /root/OpenCC/build/rel/CMakeFiles/CMakeTmp/src.cxx
Linking CXX executable cmTryCompileExec1622732998
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTryCompileExec1622732998.dir/link.txt --verbose=1
/usr/bin/c++ -DCOMPILER_HAS_HIDDEN_VISIBILITY CMakeFiles/cmTryCompileExec1622732998.dir/src.cxx.o -o cmTryCompileExec1622732998 -rdynamic
make[2]: Leaving directory '/root/OpenCC/build/rel/CMakeFiles/CMakeTmp'
make[1]: Leaving directory '/root/OpenCC/build/rel/CMakeFiles/CMakeTmp'

Source file was:
int main() { return 0; }
Performing C++ SOURCE FILE Test COMPILER_HAS_HIDDEN_INLINE_VISIBILITY succeded with the following output:
Change Dir: /root/OpenCC/build/rel/CMakeFiles/CMakeTmp

Run Build Command:"/usr/bin/make" "cmTryCompileExec3665659241/fast"
make[1]: Entering directory '/root/OpenCC/build/rel/CMakeFiles/CMakeTmp'
/usr/bin/make -f CMakeFiles/cmTryCompileExec3665659241.dir/build.make CMakeFiles/cmTryCompileExec3665659241.dir/build
make[2]: Entering directory '/root/OpenCC/build/rel/CMakeFiles/CMakeTmp'
/usr/bin/cmake -E cmake_progress_report /root/OpenCC/build/rel/CMakeFiles/CMakeTmp/CMakeFiles 1
Building CXX object CMakeFiles/cmTryCompileExec3665659241.dir/src.cxx.o
/usr/bin/c++ -DCOMPILER_HAS_HIDDEN_INLINE_VISIBILITY -fvisibility-inlines-hidden -o CMakeFiles/cmTryCompileExec3665659241.dir/src.cxx.o -c /root/OpenCC/build/rel/CMakeFiles/CMakeTmp/src.cxx
Linking CXX executable cmTryCompileExec3665659241
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTryCompileExec3665659241.dir/link.txt --verbose=1
/usr/bin/c++ -DCOMPILER_HAS_HIDDEN_INLINE_VISIBILITY CMakeFiles/cmTryCompileExec3665659241.dir/src.cxx.o -o cmTryCompileExec3665659241 -rdynamic
make[2]: Leaving directory '/root/OpenCC/build/rel/CMakeFiles/CMakeTmp'
make[1]: Leaving directory '/root/OpenCC/build/rel/CMakeFiles/CMakeTmp'

Source file was:
int main() { return 0; }
Performing C++ SOURCE FILE Test COMPILER_HAS_DEPRECATED_ATTR succeded with the following output:
Change Dir: /root/OpenCC/build/rel/CMakeFiles/CMakeTmp

Run Build Command:"/usr/bin/make" "cmTryCompileExec539274892/fast"
make[1]: Entering directory '/root/OpenCC/build/rel/CMakeFiles/CMakeTmp'
/usr/bin/make -f CMakeFiles/cmTryCompileExec539274892.dir/build.make CMakeFiles/cmTryCompileExec539274892.dir/build
make[2]: Entering directory '/root/OpenCC/build/rel/CMakeFiles/CMakeTmp'
/usr/bin/cmake -E cmake_progress_report /root/OpenCC/build/rel/CMakeFiles/CMakeTmp/CMakeFiles 1
Building CXX object CMakeFiles/cmTryCompileExec539274892.dir/src.cxx.o
/usr/bin/c++ -DCOMPILER_HAS_DEPRECATED_ATTR -o CMakeFiles/cmTryCompileExec539274892.dir/src.cxx.o -c /root/OpenCC/build/rel/CMakeFiles/CMakeTmp/src.cxx
/root/OpenCC/build/rel/CMakeFiles/CMakeTmp/src.cxx: In function ‘int main()’:
/root/OpenCC/build/rel/CMakeFiles/CMakeTmp/src.cxx:2:25: warning: ‘int somefunc()’ is deprecated (declared at /root/OpenCC/build/rel/CMakeFiles/CMakeTmp/src.cxx:1) [-Wdeprecated-declarations]
int main() { return somefunc();}
^
/root/OpenCC/build/rel/CMakeFiles/CMakeTmp/src.cxx:2:34: warning: ‘int somefunc()’ is deprecated (declared at /root/OpenCC/build/rel/CMakeFiles/CMakeTmp/src.cxx:1) [-Wdeprecated-declarations]
int main() { return somefunc();}
^
Linking CXX executable cmTryCompileExec539274892
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTryCompileExec539274892.dir/link.txt --verbose=1
/usr/bin/c++ -DCOMPILER_HAS_DEPRECATED_ATTR CMakeFiles/cmTryCompileExec539274892.dir/src.cxx.o -o cmTryCompileExec539274892 -rdynamic
make[2]: Leaving directory '/root/OpenCC/build/rel/CMakeFiles/CMakeTmp'
make[1]: Leaving directory '/root/OpenCC/build/rel/CMakeFiles/CMakeTmp'

Source file was:
attribute((deprecated)) int somefunc() { return 0; }
int main() { return somefunc();}

don't apply php7?

install php7, success create opencc.so file!
but not load success at php7.1.11。

安装成功,运行失败

OpenCC
OpenCC4php
都安装成功,但使用
$od = opencc_open("s2twp.json");
报错,直接就是Call to undefined function opencc_open(),
重启php-fpm、nginx都一样报这个错,这是什么原因?

New Official PHP7 Support ( Not the Nightly PHP7 )

For those who want to use opencc4php for php7 before this project is been updated.
I have added the support by myself, but I am new in this field.
So I don't know how to make it backward-compatible.
Here is my forked project. I have tested and am using it now.
Hope everything is fine and you would like it.
https://github.com/shtse8/opencc4php7-New

I hope this project can be updated soon so that everyone can benefit from it.
Thanks.

make报错。

image
请问有遇到相同问题的人么?
本地环境是PHP5.6,opencc也安装成功了。

当待翻译字符串包含某些特殊字符时,会导致返回502异常

当待翻译字符串包含某些特殊字符时,会导致返回502异常。 会导致异常的代码示例如下:
opencc_convert(urldecode('%E8'), $opencc);
无法通过try,catch捕获异常,php的异常日志为空,nginx的异常日志如下:

2017/01/03 02:01:43 [error] 3283#0: *1 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 10.0.2.2, server: 127.0.0.1, request: "XXXXX", upstream: "fastcgi://127.0.0.1:9000", host: "xxxxxxxxx"

我的本地环境是:visualbox虚拟机,CentOS release 6.5 (Final),PHP 5.3.28 ,nginx 1.5.10

如何检查有没有安装成功?

我这边显示的都成功了。昨天的编译问题也解决了。

但是我实例化时,提示我opencc_open函数不存在。

肯定的是编译好了。没有看见报错。opencc也是在usr目录下。不是在usr/local这个应该没影响吧?

opencc resource 为全局对象

opencc_open 方法返回的对象为全局对象, 不能同时打开2种类型的资源. 如下代码:

$od = opencc_open('t2s.json');
$od2 = opencc_open('s2t.json');
echo opencc_convert("嚴格區分", $od);
echo opencc_convert("严格区分", $od2);
echo opencc_error()."\n";
var_dump(opencc_close($od));
var_dump(opencc_close($od2));

简体 严格区分 并不能正确被转换为繁体.

编译错误 make: *** [opencc.lo] Error 1

请问make编译的时候,出现这个提示是什么原因呢?
/bin/sh /root/opencc4php/libtool --mode=compile cc -I. -I/root/opencc4php -DPHP_ATOM_INC -I/root/opencc4php/include -I/root/opencc4php/main -I/root/opencc4php -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib -I/usr/include/opencc -DHAVE_CONFIG_H -g -O2 -c /root/opencc4php/opencc.c -o opencc.lo
cc -I. -I/root/opencc4php -DPHP_ATOM_INC -I/root/opencc4php/include -I/root/opencc4php/main -I/root/opencc4php -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib -I/usr/include/opencc -DHAVE_CONFIG_H -g -O2 -c /root/opencc4php/opencc.c -fPIC -DPIC -o .libs/opencc.o
In file included from /root/opencc4php/php_opencc.h:24,
from /root/opencc4php/opencc.c:28:
/usr/include/opencc/opencc.h:66: error: expected '=', ',', ';', 'asm' or 'attribute' before 'opencc_t'
/usr/include/opencc/opencc.h:75: error: expected '=', ',', ';', 'asm' or 'attribute' before 'int'
/usr/include/opencc/opencc.h:91: error: expected '=', ',', ';', 'asm' or 'attribute' before 'size_t'
/usr/include/opencc/opencc.h:111: error: expected '=', ',', ';', 'asm' or 'attribute' before 'char'
/usr/include/opencc/opencc.h:122: error: expected '=', ',', ';', 'asm' or 'attribute' before 'void'
/usr/include/opencc/opencc.h:131: error: expected '=', ',', ';', 'asm' or 'attribute' before 'const'
/usr/include/opencc/opencc.h:143: error: expected '=', ',', ';', 'asm' or 'attribute' before 'opencc'
/root/opencc4php/opencc.c: In function 'zif_opencc_open':
/root/opencc4php/opencc.c:70: warning: assignment makes pointer from integer without a cast
/root/opencc4php/opencc.c: In function 'zif_opencc_error':
/root/opencc4php/opencc.c:143: warning: assignment makes pointer from integer without a cast
/root/opencc4php/opencc.c: In function 'zif_opencc_convert':
/root/opencc4php/opencc.c:176: warning: assignment makes pointer from integer without a cast
make: *** [opencc.lo] Error 1

编译报错 PHP 7.1.16

PHP : /opt/remi/php71/root/usr/bin/php
Warning: PHP Startup: Unable to load dynamic library '/usr/local/opencc4php/modules/opencc.so' - /usr/local/opencc4php/modules/opencc.so: undefined symbol: opencc_error in Unknown on line 0

libopencc.so.2: cannot open shared object file

确实不懂liunx太多
使用 php -m | grep open 看到没有开启

然后我在php.ini在加了这个模块 但是提示是这个
PHP Warning: PHP Startup: Unable to load dynamic library '/alidata/server/php/lib/php/extensions/no-debug-non-zts-20121212/opencc.so' - libopencc.so.2: cannot open shared object file: No such file or directory in Unknown on line 0

我用的是阿里云的ecs。向阿里云下工单他们说不管第三方插件。。

我已经搞了三天了,确实是须要你这个功能。所以才一直没放弃!

/alidata/server/php/lib/php/extensions/no-debug-non-zts-20121212/opencc.so这个文件是存在的。我是不是可能理解为编译功能的。可是为什么提示加载不了呢?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.