Menu ▾ ▴

Tree [b6fa20] master /
 History

HTTPS access


File Date Author Commit
 .qwen 5 days ago Sergey Galin Sergey Galin [fe5121] Add .qwen/.htaccess
 dumps 5 days ago Sergey Galin Sergey Galin [2f8a12] Normalize whitespace across the sources
 util 4 days ago Sergey Galin Sergey Galin [8cf80d] Rename the project to phpMyLingo
 .gitignore 5 days ago Sergey Galin Sergey Galin [22f670] Ignore .qwen/tmp
 .htaccess 5 days ago Sergey Galin Sergey Galin [d7fddf] Block the version-control metadata over web
 AGENTS.md 4 days ago Sergey Galin Sergey Galin [8cf80d] Rename the project to phpMyLingo
 DESIGN.md 4 days ago Sergey Galin Sergey Galin [8cf80d] Rename the project to phpMyLingo
 LICENSE.md 5 days ago Sergey Galin Sergey Galin [031f51] License the docs under the GPL the sources alre...
 README.md 4 days ago Sergey Galin Sergey Galin [8cf80d] Rename the project to phpMyLingo
 WDBlur.jpg 2015-04-12 Sergey A. Galin Sergey A. Galin [d20c72] Add version 1.2.1
 abstract_db.php 4 days ago Sergey Galin Sergey Galin [8cf80d] Rename the project to phpMyLingo
 admin.php 4 days ago Sergey Galin Sergey Galin [8cf80d] Rename the project to phpMyLingo
 admin_dictinstall.php 4 days ago Sergey Galin Sergey Galin [8cf80d] Rename the project to phpMyLingo
 admin_dumpdictionary.php 4 days ago Sergey Galin Sergey Galin [8cf80d] Rename the project to phpMyLingo
 admin_installdump.php 5 days ago Sergey Galin Sergey Galin [0e1fab] Extend the copyright range to 2026
 charset_functions.php 5 days ago Sergey Galin Sergey Galin [0e1fab] Extend the copyright range to 2026
 config-sample.php 4 days ago Sergey Galin Sergey Galin [8cf80d] Rename the project to phpMyLingo
 config.php 4 days ago Sergey Galin Sergey Galin [b6fa20] Default config.php - change included file name
 dictionaryinfo.php 4 days ago Sergey Galin Sergey Galin [8cf80d] Rename the project to phpMyLingo
 favicon.ico 2015-04-12 Sergey A. Galin Sergey A. Galin [d20c72] Add version 1.2.1
 formvars.php 5 days ago Sergey Galin Sergey Galin [0e1fab] Extend the copyright range to 2026
 functions.php 4 days ago Sergey Galin Sergey Galin [8cf80d] Rename the project to phpMyLingo
 help-ptkdic-format.html 4 days ago Sergey Galin Sergey Galin [8cf80d] Rename the project to phpMyLingo
 history.html 4 days ago Sergey Galin Sergey Galin [8cf80d] Rename the project to phpMyLingo
 index.php 4 days ago Sergey Galin Sergey Galin [8cf80d] Rename the project to phpMyLingo
 opensearch.php 5 days ago Sergey Galin Sergey Galin [2f8a12] Normalize whitespace across the sources
 readme.html 4 days ago Sergey Galin Sergey Galin [8cf80d] Rename the project to phpMyLingo
 style.css 5 days ago Sergey Galin Sergey Galin [0e1fab] Extend the copyright range to 2026
 version.txt 5 days ago Sergey Galin Sergey Galin [2f8a12] Normalize whitespace across the sources
 welcome.inc.html 4 days ago Sergey Galin Sergey Galin [8cf80d] Rename the project to phpMyLingo

Read Me

phpMyLingo

phpMyLingo is a Web-based dictionary/glossary application: one more
front-end to PtkDic-style dictionaries, installed on a LAN or Internet
Web server with PHP + MySQL support. Users just open one more browser tab
to access the dictionary - no program has to run on their workstations.

The project was renamed from phpMyLingvo at 2.0 - see
Version history. File and directory names, repository
names and Web links below keep the old spelling.

What is phpMyLingo?

Features:

  • 100% free and shipped with sources. Change design, embed into your
    website, etc. at your will.
  • Uses a MySQL server via the mysqli extension (PostgreSQL, MS-SQL and
    SQLite support was dropped in 2.0).
  • Includes administrator interface to install/remove dictionaries.
  • Can be installed under any OS capable to run any Web server with PHP 8
    support and MySQL - Linux, Windows, BSD, MacOS...
  • Can be installed on one computer on local network or Internet and serve
    to all workstations or your site visitors.
  • SQL server doesn't have to be open to local network (better and easier
    security then when using a GUI front-end like JaLingo with a
    network-shared database).
  • Dictionary format is fully compatible with PtkDic, GtkDic, JaLingo and
    some other applications.
  • Full UTF support for Western European languages and Russian, even mixed
    on one output page.
  • Appearance can be modified by changing the stylesheet (CSS) file and the
    custom Welcome message (welcome.inc.html).
  • Configuration options to limit server load.
  • Dictionary can be used from very low-end workstations without any
    trouble. You can even use JaLingo with the newest version of Links from
    text-only terminals.

If you need a usual GUI application instead, those exist too - see
Links. All existing dictionary software, including phpMyLingo,
can share one dictionary database.

Requirements

  • Web server capable to work with PHP (Apache is highly recommended).
  • PHP (https://www.php.net) version 8.0 or higher (the port targets PHP
    8.5), with the mysqli and mbstring extensions. Both are bundled with
    PHP; mbstring is required for the UTF-8 output mode.
  • MySQL server (https://www.mysql.org) accessed through the mysqli
    extension. Since 2.0 phpMyLingo uses mysqli directly; PostgreSQL,
    MS-SQL and SQLite support (PEAR::DB era) was dropped. The last version
    with PHP 4-5, PostgreSQL and MS-SQL support remains available in the git
    repository under tag php-5.
  • bzip2 or the PHP bz2 extension (usually bundled with PHP) - needed by
    the dump/installer pages.

For most open-source OSes all of this is already packaged with the
operating system. On Microsoft Windows install the components separately;
Russian users may use the Denwer package
(http://www.dklab.ru/chicken/web/) that bundles Apache, PHP and MySQL.

Installation

  1. Unpack the source code into a directory accessible from the Web.
  2. Edit the configuration. In the repository config.php is only
    require_once("../phpMyLingvo-config.php"); - the real config lives
    above the project root, is not tracked in git and holds the credentials.
    Copy config-sample.php and adjust it; all options there are well
    commented.
  3. If mysqli seems to be missing, enable it in your PHP installation
    (since PHP 8 mysqli is bundled with PHP on most platforms). A MySQL
    server is required: PostgreSQL, MS-SQL and SQLite are no longer
    supported.
  4. Create the database and install dictionaries (both ways below); the
    database itself always has to be created manually.

Manual dictionary installation into MySQL

Assume a default MySQL installation with user root and an empty
password; otherwise replace -u root with
-u valid-mysql-username -p valid-mysql-password in all samples. The
database name ptkdic is an example - use any other name you like.

Create the database (via phpMyAdmin, MySQL GUI/Admin, or from the command
prompt):

$ mysql -u root
mysql> create database ptkdic;
Query OK, 1 row affected (0.06 sec)
mysql> bye

Install a dictionary dump. In the directory where the compressed MySQL
dump (for example english2.bz2) is located:

$ bzcat english2.bz2 | mysql -u root ptkdic

For a gzip dump (*.gz) replace bzcat with zcat. If you have only
bzip2 and no bzcat (e.g. bzip2 under Windows), use:

$ bzip2 -dc english2.bz2 | mysql -u root ptkdic

Installation using the phpMyLingo Admin interface

With newer versions you can install, dump and delete dictionaries through
the Web interface: configure phpMyLingo, then follow the "Admin
Interface" link. Note that installation via the installer is much slower
than the mysqldump way.

Converting original PtkDic dumps to UTF-8

Since 1.3.0 phpMyLingo outputs dictionary text exactly as it is stored in
the database: $process_charset - the option that used to recode the mixed
8-bit PtkDic text into UNICODE while serving a page - defaults to false,
and the MySQL connection charset is set to utf8. Dictionaries have to be
stored in UTF-8.

Original PtkDic/GtkDic/JaLingo dumps keep Cyrillic in KOI8-R, Western
European characters in their usual ISO encoding and transcription characters
in IPA codes (see Dictionary format). Installed
without conversion, such a dump is unreadable: its bytes are treated as
UTF-8. Convert it first with util/converters/convert_ptkdic_to_utf8.php,
which applies the same heuristics as charset_functions.php and repairs the
KOI8-R &#NN; entities the conversion leaves behind:

$ cd util/converters
$ mkdir -p dumps out
$ bzcat /path/to/english2.bz2 > dumps/english2   # the script reads plain dumps
$ php convert_ptkdic_to_utf8.php                 # converted dump appears in out/
$ mysql -u root ptkdic < out/english2

The script is a command-line tool - like everything under util/, it is
closed to the Web server - and needs a copy of charset_functions.php next
to itself (the repository already ships one in util/converters/). Its
$dict_options list mirrors the disable_transcription tuning options of
the configuration: dictionaries whose square brackets are ordinary text
rather than IPA transcription (the english* and eng_eng* ones) must be
listed there, otherwise their brackets are recoded as transcription; adjust
the list for the dictionaries being converted. Compress the result with
bzip2 when it is going to be installed through the Admin interface.

Old dumps can still be used unconverted: set $process_charset=true in the
configuration. That selects the KOI8-R output branch, which recodes articles
on the fly the way phpMyLingo 1.2.1 and earlier did.

Repository layout

  • Root directory - application pages and the DB layer: index.php,
    functions.php, abstract_db.php, dictionaryinfo.php, the
    admin*.php pages, style.css, welcome.inc.html (the customizable
    Welcome block shown on the main page).
  • util/converters/, util/tests/ - CLI-only conversion scripts and
    tests; util/.htaccess closes the whole util/ directory to the web
    server.
  • AGENTS.md, DESIGN.md, README.md, LICENSE.md - documentation,
    closed to the web server by the root .htaccess.

Tests

Pure-PHP logic and syntax are checked locally (see AGENTS.md §4 for the
mandatory run); real SQL queries, the UTF-8 branch with mbstring and the
bzip2 pipes need a real server:

for f in $(find . -name '*.php' | sort); do php -l "$f" || exit 1; done
php util/tests/charset_regression.php charset_functions.php
php util/tests/charset_regression.php util/converters/charset_functions.php
php util/tests/db_layer_test.php
php util/tests/encoding_test.php

Dictionary format (PtkDic)

Each dictionary is stored in one SQL table:

Field Meaning
art_id Unique integer record ID. Articles use art_id >= 10; rows 0..9 are special records holding information about the dictionary. Must be indexed.
word Article title; VARCHAR(255) is enough for all known dictionaries. Must be indexed for sorting and search.
art_txt Article body. Some articles are longer than 64K, so the largest text type is reasonable (LONGTEXT for MySQL).

phpMyLingo uses the improved, compatible table structure (bigger
articles, explicitly unique art_id):

CREATE TABLE dictionary-name (
  art_id    INT UNSIGNED NOT NULL DEFAULT 0,
  word      VARCHAR(255) NOT NULL,
  art_txt   LONGTEXT NOT NULL,
  UNIQUE dictionary-name_art_id_idx (art_id),
  INDEX dictionary-name_word_idx (word)
);

Row art_id=3 must be defined for every dictionary: word holds the
dictionary title, art_txt the languages in a five-line form - table
name, source language, l, destination language, r (the table-name and
l/r lines are never used, but kept for compatibility):

INSERT INTO fineng VALUES (3, 'Finnish-English dictionary', 'fineng\nSuomea\nl\nEnglish\nr');

Dictionary dumps are plain SQL text: CREATE TABLE in MySQL format, each
INSERT INTO dictionary-name VALUES (art_id, word, art_txt); on exactly
one (unwrapped) line, no blank or comment lines between INSERT queries,
additional empty lines at the end. Dumps may be compressed - bzip2 is
recommended.

Character sets: the original PtkDic format uses a mixed 8-bit codepage -
Western European characters in their usual ISO encoding (ISO-8859-5),
Cyrillic in KOI8-R, transcription characters as IPA codes. The codes
overlap, so determining which codepage a byte belongs to requires
heuristics; the implementation is in charset_functions.php. Since 1.3.0
this codepage is not recoded while serving a page by default: dumps are
expected to be stored in UTF-8, see
Converting original PtkDic dumps to UTF-8.

The full specification is in help-ptkdic-format.html.

Version history

2.0 - 2026-11-28

  • Renamed the project to phpMyLingo. The old name kept suggesting a link
    to ABBYY Lingvo / Content AI Lingvo, which this project has nothing to do
    with; the new spelling restores the connection to JaLingvo, which had been
    renamed JaLingo for the same reason. Releases before 2.0 were published as
    phpMyLingvo. File and directory names, repository names and Web links keep
    the old spelling, so existing checkouts and URLs keep working.
  • Ported to PHP 8.x (tested with PHP 8.5): PEAR::DB replaced with a
    mysqli-based DB layer (abstract_db.php). PostgreSQL, MS-SQL and SQLite
    support dropped.
  • All sources are valid UTF-8 now; KOI8-R byte tables are kept as \xNN
    escapes with explanatory comments.
  • CLI-only scripts and tests live under util/ and are closed to the web
    server.

1.3.0 - 2015-04-14

  • Dictionary storage moved to UTF-8: $process_charset defaults to false
    from now on, so original PtkDic dumps have to be converted before
    installation - see
    Converting original PtkDic dumps to UTF-8.
    This closed the long-standing "UTF-8 dictionary support" wishlist item.
  • util/converters/convert.php became util/converters/convert_ptkdic_to_utf8.php,
    merged with the script that repairs KOI8-R entities left by the conversion;
    its charset layer moved to util/converters/charset_functions.php (formerly
    SG.Charset.php).
  • Fixed UTF-8 dictionary import, query processing, search word highlighting
    and case-insensitive search in UTF-8 mode.
  • admin_checknewversion.php and the release-packaging scripts removed.
  • The last version that runs on PHP 4.x-5.x; kept in the git repository under
    tags 1.3.0 and php-5.

1.2.1 - 2009-06-08

  • Open Search support: phpMyLingo can be added to the Firefox search bar
    (and to other browsers supporting Open Search).

1.2.0 - 2004-10-09

  • Documentation updated; documentation for the PtkDic format added.

Earlier

  • 1.2.0-CVS1..CVS6 (2004): PHP 5 and SQLite support, PEAR::DB abstraction
    (PostgreSQL, MS SQL), PHP dump installer and dump maker in Admin,
    bzip2 handling.
  • 1.0.0 - 2004-06-10: bugfixes, register_globals=off compatibility,
    uploading dumps via HTTP POST, deleting dictionaries via Admin.
  • 0.1 - 0.9.3 (2003-2004): the original releases.

Full update history, known issues and grayed "in progress" items are in
history.html.

To Do (wishlist)

  • Allow to change dictionary DB name when dumping or installing.
  • Web configuration editor. Article editor. Ability to create new
    dictionaries. Dictionary properties editor.
  • Case-insensitive search should ignore diacritic marks (ä == a);
    case-insensitive highlighting.
  • Formatted (HTML, XML) articles support.
  • Option to hide/show dictionary bar; configuration options to show
    always/hide always. Option to open results in new window.
  • Printer-friendly version of output.
  • Remove JavaScript links and buttons if the browser doesn't support
    JavaScript.
  • Dictionary filters: join dictionaries, kill duplicated articles, merge
    articles with identical titles, change square brackets to normal.
  • Improve documentation and homepage.
  • Scripts to create and configure dictionary database.

phpMyLingo pages

Other free dictionary software

Credits, contributors, thanks

  • Project creator and maintainer: Sergey A. Galin,
    http://sageshome.net/
  • Code contributors:
  • Alexander Goriachev AKA Thorn - DSL to PTK converter (and a
    number of converted DSL dictionaries), PEAR::DB patch and more.
  • Pa Scvortsov (pantey at volgogradcity dot ru) - patch for
    automatic search query focusing.
  • Thanks to:
  • Alexander Kuprin (ru_classic at mail dot ru) - countenance and
    project promotion.
  • Alexey Semenov (swaj at softhome dot net) - PtkDic, GtkDic and
    many dictionaries.
  • Alexander Shishko (jaesar at users dot sourceforge dot net) -
    JaLingo and countenance.
  • Eugeny Cymbaluk (mueller_dic at koi dot chat dot ru) and
    "Palek" - their electronic version of the Mueller dictionary.
  • Konstantin Potapov AKA Kep - support.

License

Copyright © Sergey A. Galin, 2003-2026. All rights reserved.

  • phpMyLingo - code and documentation (this README, readme.html,
    history.html, help-ptkdic-format.html) - is free software distributed
    under the GNU General Public License (GPL), version 2 or higher (at
    your option), published by Free Software Foundation; the source file
    headers state "GNU General Public License, ver. 2". The full text of
    GPL version 2 is carried in the repository: LICENSE.md,
    online at http://sageshome.net/GPL.php.
  • For more information about free licenses, see
    http://www.fsf.org/ and http://www.opensource.org/.

Warning: this license may not apply to the dictionaries (dictionary
databases) themselves. Most dictionaries available for download on the
phpMyLingo page are converted or copied from other open-source products
and are believed to be free for use and any modifications. If you know
anything about legal limitations for any of the dictionaries, please
inform the author.