diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 74bf4ff5..89b45bf7 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -9,6 +9,8 @@ ones are marked like "v1.0.0-fork". ### Added +* Support for Japanese with MeCab on Mac! This was added thanks to +[quopquai](https://github.com/quopquai) on [#135](https://github.com/HugoFara/lwt/issues/135). * `unloadformcheck.js` now declares a new object `lwt_form_check` that contains all the functions needed. * New globals ([#163](https://github.com/HugoFara/lwt/issues/163)): * On `inc/kernel_utility.php`: `LWT_APP_VERSION` and `LWT_RELEASE_DATE`. diff --git a/docs/faq.md b/docs/faq.md index b790e052..460a5a1c 100644 --- a/docs/faq.md +++ b/docs/faq.md @@ -6,33 +6,61 @@ If you see "The webpage is not available", "We have trouble finding that site". ![Image](../img/prob1.png) -Answer: Your local webserver (Apache) is not running. Please start it via EasyPHP or MAMP control program/panel. +Answer: Your local webserver (Apache) is not running. +Please start it via EasyPHP or MAMP control program/panel. + +## Blank page + +You PHP version is probably too low. Try to use PHP 8 at least. ## URL not found (404) ![Image](../img/prob2.png) -Answer: The server is running, but the application is not found. Maybe the Uniform Resource Identifier (URI) is wrong or misspelled. Please check/correct it. Or the URI is correct, and the application is installed, but not in the correct directory _lwt_ below _htdocs_. Please install/copy/move it into the correct directory. +Answer: The server is running, but the application is not found. +Maybe the Uniform Resource Identifier (URI) is wrong or misspelled. +Please check/correct it. Or the URI is correct, and the application is installed, +but not in the correct directory _lwt_ below _htdocs_. +Please install/copy/move it into the correct directory. ## Database connection error ![Image](../img/prob3.png) -Answer: Either the database (MySQL) is not running, or the database connection parameters in _../htlwt/connect.inc.php_ are wrong. Please check/correct the database connection parameters and/or start MySQL via the MAMP or EasyPHP control program/panel. +Answer: Either the database (MySQL) is not running, or the database connection +parameters in _../htlwt/connect.inc.php_ are wrong. +Please check/correct the database connection parameters and/or start MySQL via the MAMP or EasyPHP control program/panel. ## Cannot find connect.inc.php ![Image](../img/prob4.png) -Answer: The Webserver and the database is running, but the database connection parameter file _../htlwt/connect.inc.php_ is not found. Please rename one of the connection files (according to your server) to _../htlwt/connect.inc.php_. +Answer: The Webserver and the database is running, but the database connection parameter file _../htlwt/connect.inc.php_ is not found. +Please rename one of the connection files (according to your server) to _../htlwt/connect.inc.php_. ## Do not run on Linux after installation/update If LWT installed or updated LWT on Linux, but the application does not run as expected. -Answer 1: The Webserver does not have full access to all LWT files (insufficient rights). Open a terminal window, go to the directory where the directory "lwt" has been created with all LWT files, e. g. +Answer 1: The Webserver does not have full access to all LWT files (insufficient rights). +Open a terminal window, go to the directory where the directory "lwt" has been created with all LWT files, e. g. **cd /var/www/html** Now execute: **sudo chmod -R 755 lwt**. -Answer 2: The PHP "mbstring" extension is not installed. Please install it: [see this article](https://askubuntu.com/questions/491629/how-to-install-php-mbstring-extension-in-ubuntu). +Answer 2: The PHP "mbstring" extension is not installed. +Please install it: [see this article](https://askubuntu.com/questions/491629/how-to-install-php-mbstring-extension-in-ubuntu). + +## MeCab not detected! + +LWT cannot find MeCab, you can do the following steps: + + +On Linux or Mac: +1. Open a terminal. +2. Type `mecab -v` to get the current MeCab version. If nothing is displayed MeCab is not installed. +3. If MeCab is already installed, the path may be missing. If you are using MAMP type + +```bash +printf 'export PATH="/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"' >> /Applications/MAMP/Library/bin/envvars +``` \ No newline at end of file diff --git a/docs/info.html b/docs/info.html index 3fe2a481..baf344a7 100644 --- a/docs/info.html +++ b/docs/info.html @@ -1166,23 +1166,45 @@
If you see "The webpage is not available", "We have trouble finding that site".
-Answer: Your local webserver (Apache) is not running. Please start it via EasyPHP or MAMP control program/panel.
+Answer: Your local webserver (Apache) is not running. +Please start it via EasyPHP or MAMP control program/panel.
+You PHP version is probably too low. Try to use PHP 8 at least.
Answer: The server is running, but the application is not found. Maybe the Uniform Resource Identifier (URI) is wrong or misspelled. Please check/correct it. Or the URI is correct, and the application is installed, but not in the correct directory lwt below htdocs. Please install/copy/move it into the correct directory.
+Answer: The server is running, but the application is not found. +Maybe the Uniform Resource Identifier (URI) is wrong or misspelled. +Please check/correct it. Or the URI is correct, and the application is installed, +but not in the correct directory lwt below htdocs. +Please install/copy/move it into the correct directory.
Answer: Either the database (MySQL) is not running, or the database connection parameters in ../htlwt/connect.inc.php are wrong. Please check/correct the database connection parameters and/or start MySQL via the MAMP or EasyPHP control program/panel.
+Answer: Either the database (MySQL) is not running, or the database connection +parameters in ../htlwt/connect.inc.php are wrong. +Please check/correct the database connection parameters and/or start MySQL via the MAMP or EasyPHP control program/panel.
Answer: The Webserver and the database is running, but the database connection parameter file ../htlwt/connect.inc.php is not found. Please rename one of the connection files (according to your server) to ../htlwt/connect.inc.php.
+Answer: The Webserver and the database is running, but the database connection parameter file ../htlwt/connect.inc.php is not found. +Please rename one of the connection files (according to your server) to ../htlwt/connect.inc.php.
If LWT installed or updated LWT on Linux, but the application does not run as expected.
-Answer 1: The Webserver does not have full access to all LWT files (insufficient rights). Open a terminal window, go to the directory where the directory "lwt" has been created with all LWT files, e. g.
+
Answer 1: The Webserver does not have full access to all LWT files (insufficient rights).
+Open a terminal window, go to the directory where the directory "lwt" has been created with all LWT files, e. g.
cd /var/www/html
Now execute:
sudo chmod -R 755 lwt.
Answer 2: The PHP "mbstring" extension is not installed. Please install it: see this article.
+Answer 2: The PHP "mbstring" extension is not installed. +Please install it: see this article.
+LWT cannot find MeCab, you can do the following steps:
+On Linux or Mac:
+mecab -v
to get the current MeCab version. If nothing is displayed MeCab is not installed.printf 'export PATH="/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"' >> /Applications/MAMP/Library/bin/envvars
+
@@ -2197,6 +2219,8 @@▶ Changelog - [↑]
[Unreleased]
Added
+
- Support for Japanese with MeCab on Mac! This was added thanks to +quopquai on #135.
unloadformcheck.js
now declares a new objectlwt_form_check
that contains all the functions needed.- New globals (#163): diff --git a/inc/kernel_utility.php b/inc/kernel_utility.php index 7039af94..e1ffc884 100644 --- a/inc/kernel_utility.php +++ b/inc/kernel_utility.php @@ -258,18 +258,22 @@ function remove_spaces($s, $remove) * @return string OS-compatible command * * @since 2.3.1-fork Much more verifications added + * @since 2.10.0-fork Support for Mac OS added */ function get_mecab_path($mecab_args = ''): string { - $os = strtoupper(substr(PHP_OS, 0, 3)); + $os = strtoupper(PHP_OS); $mecab_args = escapeshellcmd($mecab_args); - if ($os == 'LIN') { + if (str_starts_with($os, 'LIN') || str_starts_with($os, 'DAR')) { if (shell_exec("command -v mecab")) { return 'mecab' . $mecab_args; } - my_die("MeCab not detected! Please install it and add it to your PATH."); + my_die( + "MeCab not detected! " . + "Please install it or add it to your PATH (see documentation)." + ); } - if ($os == 'WIN') { + if (str_starts_with($os, 'WIN')) { if (shell_exec('where /R "%ProgramFiles%\\MeCab\\bin" mecab.exe')) { return '"%ProgramFiles%\\MeCab\\bin\\mecab.exe"' . $mecab_args; } @@ -279,7 +283,10 @@ function get_mecab_path($mecab_args = ''): string if (shell_exec('where mecab.exe')) { return 'mecab.exe' . $mecab_args; } - my_die("MeCab not detected! Install it or add it to the PATH."); + my_die( + "MeCab not detected! " . + "Install it or add it to the PATH (see documentation)." + ); } my_die("Your OS '$os' cannot use MeCab with this version of LWT!"); }