]> git.mxchange.org Git - friendica-addons.git/blob - cld/README.md
Dateien nach "invidious/templates" hochladen
[friendica-addons.git] / cld / README.md
1 Compact Language Detector
2 ===
3 CLD2 is an advanced language dectection library with a high reliability.
4
5 This addon depends on the CLD PHP module which is not included in any Linux distribution.
6 It needs to be built and installed by hand, which is not totally straightforward.
7
8 Prerequisite
9 ---
10 To be able to build the extension, you need the CLD module and the files for the PHP module development.
11 On Debian you install the packages php-dev, libcld2-dev and libcld2-0.
12 Make sure to have installed the correct PHP version.
13 Means: When you have got both PHP 8.0 and 8.2 on your system, you have to install php8.0-dev as well.
14
15 Installation
16 ---
17 The original PHP extension is https://github.com/fntlnz/cld2-php-ext.
18 However, it doesn't support PHP8.
19 So https://github.com/hiteule/cld2-php-ext/tree/support-php8 has to be used.
20
21 Download the source code:
22 ```
23 wget https://github.com/hiteule/cld2-php-ext/archive/refs/heads/support-php8.zip
24 ```
25
26 Unzip it:
27 ```
28 unzip support-php8.zip
29 ```
30
31 Change into the folder:
32 ```
33 cd cld2-php-ext-support-php8/
34 ```
35
36 Configure for the PHP Api version:
37 ```
38 phpize
39 ```
40 (if you have got several PHP versions on your system, execute the command with the version that you run Friendica with, e.g. `phpize8.0`)
41
42 Create the Makefile:
43 ```
44 ./configure --with-cld2=/usr/include/cld2
45 ```
46
47 Have a look at the line `checking for PHP includes`.
48 When the output (for example `/usr/include/php/20220829` doesn't match the API version that you got from `phpize`, then you have to change all the version codes in your `Makefile` afterwards)
49
50 Create the module:
51 ```
52 make -j
53 ```
54
55 Install it:
56 ```
57 sudo make install
58 ```
59
60 Change to the folder with the available modules. When you use PHP 8.2 on Debian it is:
61 ```
62 cd /etc/php/8.2/mods-available
63 ```
64
65 Create the file `cld2.ini` with this content:
66 ```
67 ; configuration for php cld2 module
68 ; priority=20
69 extension=cld2.so
70 ```
71
72 Enable the module for all versions and all sapi:
73 ```
74 phpenmod -v ALL -s ALL cld2
75 ```
76
77 Then restart the apache or fpm (or whatever you use) to load the changed configuration.
78
79 Call `/admin/phpinfo` on your webserver.
80 You then see the PHP Info.
81 Search for "cld2".
82 The module is installed, when you find it here.
83 **Only proceed when the module is installed**
84
85 Now you can enable the addon.