CentOS 7 安裝 cmake 3.5.2, OpenCC, opencc4php

cmake 的部份

sudo su
cd
yum remove cmake -y
wget https://cmake.org/files/v3.6/cmake-3.6.2.tar.gz
tar -zxvf cmake-3.6.2.tar.gz
cd cmake-3.6.2
./bootstrap --prefix=/usr/local
make
make install
vi ~/.bash_profile
PATH=/usr/local/bin:$PATH:$HOME/bin
source ~/.bash_profile
cmake --version

OpenCC 的部份

cd
wget https://github.com/BYVoid/OpenCC/archive/refs/tags/ver.1.1.0.tar.gz
tar zxvf ver.1.1.0.tar.gz
cd OpenCC-ver.1.1.0/
yum -y install doxygen doxygen-latex doxygen-doxywizard
make
make install

64位元系統再加入以下這指令

ln -s /usr/lib/libopencc.so.2 /usr/lib64/libopencc.so.2

opencc4php 的部份

cd
git clone https://github.com/NauxLiu/opencc4php.git --depth 1
cd opencc4php/
phpize

php 7.1:

./configure --with-opencc=/usr/local/OpenCC --with-php-config=/www/server/php/71/bin/php-config

php 8.0:

./configure --with-opencc=/usr/local/OpenCC --with-php-config=/www/server/php/80/bin/php-config
make test
make
make install

修改 php 設定檔

php 7.1:

extension = /www/server/php/71/lib/php/extensions/no-debug-non-zts-20160303/opencc.so

php 8.0:

extension = /www/server/php/80/lib/php/extensions/no-debug-non-zts-20200930/opencc.so

重啟 php