About zphp

zphp is a re-implementation of the Z-machine written in PHP (5.3 or later). It is Z-code interpreter, or a virtual machine, for the old text adventure games by Infocom and also a few non-commercial games.

It only supports Z-code version 3 games (now usually found with file extension .z3 but originally had .DAT or .ZIP). There are many more games that are in version 5 or newer format and games has been re-released with a newer interpreter.

Z-code version 5 support should not be that hard to add in zphp. It was originally planned but I will probably never get around to actually implement it. And I have absolute no plans to support anything beyond version 5. Use some other interpreter which there are plenty.

The zcli.php uses the tput command to find out the size and some control codes for the terminal/console. This means it will probably not work on a Windows system without Cygwin or some other Unix-like enviroment (Microsoft used to have the SFU and now they have an Ubuntu enviroment for Windows 10.) Anyways, use php zcli.php story.z3 to start a game.


zphp is released under the GNU General Public License, version 2.

2016-04-13 11:51:39 UTC

Supported Games

A near-complete list of games that should be playable (I haven't completed any of them):

Some of these games have been re-released in a newer Z-code versions which are not supported by zphp.

It not uncommon for games to require a leaflet that came in the box to be able to complete them. Luckily there are scans and photos of most of the boxes and accessories online.... as well as walk–through guides.

If you want to test this but do not have any of the games, the original Zork trilogy seems to be legally available for download. You only need the story files DATA/ZORK{1,2,3}.DAT from those zip archives.

2016-04-16 17:21:55 UTC


ZORK I: The Great Underground Empire

Zork I

ZORK II: The Wizard of Frobozz

Zork II

ZORK III: The Dungeon Master

Zork III

2016-04-16 17:07:03 UTC


Or just clone it: git clone https://git.gizmo.dy.fi/zphp.git

2017-10-01 19:53:36 UTC


You can reach me via email at vaino (dot) helminen (at) gmail (dot) com.