Miva is not the most glamorous web technology – by today's standards its 1995 origin makes it ancient. But it is still actively maintained and developed, and can be used to make web apps.

There are little to no installation notes provided with the Miva Empresa CGI engine. So in lieu of that, here are my notes for how to get Miva up and running. My linux skills are mostly google-fu, so I've included some steps that are probably not needed if you're an experienced linux user.

I've created these steps based on my experience with debian and ubuntu. You may have to modify them for other distros, or you may not.

  1. Assuming a linux instance with nothing else yet installed...
  2. Install Apache sudo apt-get install apache2
  3. Install these two Apache mods: sudo a2enmod actions and sudo a2enmod cgi
  4. Download the latest Miva Empresa version from here: http://www.mivamerchant.com/support/downloads
  5. Upload it to the server and tar -zxvf it
  6. Copy the cgi-bin and lib folders to /usr/local/miva/ and chmod 755 -R the miva folder
  7. Over in your /etc/apache2/sites-available folder, you'll need to customize your Virtual Host. Edit the host file you want Miva running on.
  8. You'll want to add (or modify) the line line DirectoryIndex index.mvc index.html to allow Miva's .mvc files be the index files
  9. Add these lines ScriptAlias /miva-bin/ /usr/local/miva/cgi-bin/ <Directory /usr/local/miva/cgi-bin/> Require all granted </Directory>
  10. Add these lines (a copy of this is in the README file) making the replacements in italics:
    SetEnv MvCONFIG_LIBRARY /usr/local/miva/lib/config/env.so SetEnv MvCONFIG_DIR_MIVA [your site's html folder] SetEnv MvCONFIG_DIR_DATA [your site's mivadata folder] SetEnv MvCONFIG_DIR_BUILTIN /usr/local/miva/lib/builtins AddHandler application/x-miva-compiled .mvc Action application/x-miva-compiled /miva-bin/mivavm-v[latest]
  11. You will need to create the html and mivadata folders mentioned in the step above before restarting apache. The mivadata folder should not be inside the html folder. The way I prefer is putting them is for html: /usr/local/web/SITE NAME/site/ and data: /usr/local/web/SITE NAME/data/. Once those folders are created, change their ownership with chown -R username:www-data and then chmod 0775 -R them. There may be a better way of doing this.
  12. You should now be finished. Restart apache sudo systemctl restart apache. To test your site, put a Mivascript file in the root which creates a database file and writes to the script directory. If your Mivascript can do both those things, then things are working!

Mivascript Compiler

Here's how to install the Mivascript compiler (this is much easier):

  1. Download the compiler from the same place as the above link
  2. tar -zxvf it
  3. Move the contents of bin to /usr/local/bin and the contents of builtins to a new directory /usr/local/include/miva/
  4. Either add this to your ~/.profile file or (if you want to install for all users) the /etc/profile file: MVC_LIB=/usr/local/include/miva
  5. You should now be able to run mvc file.mv and have it successfully make a file.mvc compiled Mivascript file