Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP v8 support? #18

Open
dndeus opened this issue Nov 4, 2023 · 1 comment
Open

PHP v8 support? #18

dndeus opened this issue Nov 4, 2023 · 1 comment

Comments

@dndeus
Copy link

dndeus commented Nov 4, 2023

PHP v8 support?

I tried on php v8.0, v8.1, v8.2
It fails when I'm trying to run

RUN wget https://github.com/nihongodera/php-mecab/archive/master.zip \ && unzip master.zip \ && cd php-mecab-master/mecab \ && phpize \ && ./configure \ && make \ && make install

I'm getting these errors
php v8 errors.txt

@tranthaihoang
Copy link

tranthaihoang commented Oct 4, 2024

For those who are looking to install php-mecab on php8.0:

git clone https://github.com/ranvis/php-mecab.git \
    && cd php-mecab/mecab \
    && phpize \
    && ./configure --with-mecab=/usr/local/bin/mecab-config \
    && make \
    && make install

Exact steps to install this library:

1. Install mecab

curl -L https://github.com/taku910/mecab/archive/master.zip -o mecab.zip \
    && unzip mecab.zip \
    && cd mecab-master/mecab \
    && ./configure \
    && make \
    && make install

2. Install mecab-ipadic-utf8

curl -L https://drive.google.com/uc?id=0B4y35FiV1wh7MWVlSDBCSXZMTXM -o mecab-ipadic-utf8.tar.gz \
    && tar zxfv mecab-ipadic-utf8.tar.gz \
    && cd mecab-ipadic-2.7.0-20070801 \
    && ./configure --with-charset=utf8 \
    && make \
    && make install

3. Install php-mecab

git clone https://github.com/ranvis/php-mecab.git \
    && cd php-mecab/mecab \
    && phpize \
    && ./configure --with-mecab=/usr/local/bin/mecab-config \
    && make \
    && make install

4. Add mecab.so to php.ini

echo "extension=mecab.so" > /usr/local/etc/php/conf.d/mecab.ini

5. Install nihongodera/limelight

composer require nihongodera/limelight

6. Test:

$limelight = new \Limelight\Limelight();
$results = $limelight->parse('立命館大学农笠キャンパス前');
echo 'Romaji: ' . $results->string('romaji', ' ') . "\n"; 

Result: Romaji: Ritsumeikandaigaku kyanpasu mae

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants