1.安装 doxygen
yum install doxygen -y
# 编译安装opencc
git clone https://github.com/BYVoid/OpenCC.git
cd OpenCC/
make -j 2 && make install
=== > 这个安装在/usr/share/opencc/目录下
修改 c++=11 ==>
https://github.com/BYVoid/OpenCC/commit/8cfee2627146d1912655fb70b413ae27b1b5c026
修改部分如下 -std=c++14 ==> -std=c++11
-DVERSION="${OPENCC_VERSION}"
add_definitions(
-std=c++11
-Wall
)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pthread")
if (CMAKE_BUILD_TYPE MATCHES Debug)
add_definitions(-O0 -g3)
endif ()
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
add_definitions(
-std=c++11
-Wall
)
2.安装opencc4php
git clone https://github.com/nauxliu/opencc4php.git
cd opencc4php
/usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config --with-opencc=/usr/share/opencc/
make -j 2 && sudo make install
3.修改配置
# vim /etc/profile
export LD_LIBRARY_PATH=/usr/lib/:$LD_LIBRARY_PATH
# ldd /usr/local/php-7.2.24_fpm/lib/php/extensions/no-debug-non-zts-20170718/opencc.so
linux-vdso.so.1 => (0x00007ffe62da4000)
libopencc.so.1.1 => /usr/lib/libopencc.so.1.1 (0x00007f2a8748a000)
libc.so.6 => /lib64/libc.so.6 (0x00007f2a870bc000)
libstdc++.so.6 => /lib64/libstdc++.so.6 (0x00007f2a86db5000)
libm.so.6 => /lib64/libm.so.6 (0x00007f2a86ab3000)
libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007f2a8689d000)
/lib64/ld-linux-x86-64.so.2 (0x00007f2a87904000)
修改php.ini配置,并重启php-fpm
# vim /usr/local/php/etc/php.ini
# extension=opencc.so
# 验证是否有opencc模块
php -m|grep opencc
opencc
centos7.6环境的php7.2.24环境安装opencc4php模块
最新推荐文章于 2024-08-20 09:52:02 发布