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.
*.md files are closed to the web.htaccess, so this file is meant for the gitFeatures:
welcome.inc.html).If you need a usual GUI application instead, those exist too - see
Links. All existing dictionary software, including phpMyLingo,
can share one dictionary database.
php-5.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.
config.php is onlyrequire_once("../phpMyLingvo-config.php"); - the real config livesconfig-sample.php and adjust it; all options there are wellAssume 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
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.
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.
index.php,functions.php, abstract_db.php, dictionaryinfo.php, theadmin*.php pages, style.css, welcome.inc.html (the customizableutil/converters/, util/tests/ - CLI-only conversion scripts andutil/.htaccess closes the whole util/ directory to the webAGENTS.md, DESIGN.md, README.md, LICENSE.md - documentation,.htaccess.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
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.
abstract_db.php). PostgreSQL, MS-SQL and SQLite\xNNutil/ and are closed to the web$process_charset defaults to falseutil/converters/convert.php became util/converters/convert_ptkdic_to_utf8.php,util/converters/charset_functions.php (formerlySG.Charset.php).admin_checknewversion.php and the release-packaging scripts removed.1.3.0 and php-5.register_globals=off compatibility,Full update history, known issues and grayed "in progress" items are in
history.html.
Copyright © Sergey A. Galin, 2003-2026. All rights reserved.
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.