wiki on a shared hosting environment with no Python installed (my experience)

Disclaimer: The following is not the right way to do it (I am not sure about security and the number of files is not optimized), but it just works for me...

Hosting situation:

Local situation:

beginning

You should have at least 2 directories on the server:

Is better to know the absolute paths, so upload the following bash script as bashtest.cgi inside the cgi-bin directory

echo "Content-type: text/html"
echo
echo "<html><head /><body>"
echo "<br />The absolute path of your cgi-bin directory is: <br />"
pwd
echo "</body></html>"

Now point your browser to http://www.yoursite.org/cgi-bin/bashtest.cgi.

I got something like /home/something/www.mywikiname.org/cgi-bin/, but we will suppose the absolute paths are simply:

uploading Python

We need a new directory to hold the python and python-related tree. If you can make a private, not public accessible directory, is better. I can't, so I just made cgi-bin/pytree. We will protect this directory later with a .htaccess file.

From my archlinux box, I uploaded:

i.e. python and some openssl libs.

To save space on the server you can prune the python2.5/site-packages/ directory leaving only MoinMoin/ and _xmlplus/ (PyXML - required for the "Render as docbook" action) directories.

wrapping Python

Upload the following script as cgi-bin/pytree/bin/python

export PYTHONHOME=/path/to/cgi-bin/pytree
export PYTHONPATH=/path/to/cgi-bin/pytree/lib/python2.5
export LD_LIBRARY_PATH=/path/to/cgi-bin/pytree/lib:/path/to/cgi-bin/pytree/lib/python2.5
/path/to/cgi-bin/pytree/bin/python2.5 $@

To see if python works upload this script as cgi-bin/pytest.cgi

echo "Content-type: text/html"
echo
echo "<html><head /><body>"
echo "<br />Your python version is: <br />"
/path/to/cgi-bin/pytree/bin/python --version
echo "</body></html>"

And open http://www.yoursite.org/cgi-bin/pytest.cgi.

wiki, data and underlay

Follow the instructions in HelpOnInstalling/ApacheOnLinuxFtp.

For example:

But if you can, put data, underlay and wikiconfig.py somewhere outside the public directories.

configuring and wrapping the MoinMoin CGI

Edit your local copy of moin.cgi:

# Path to MoinMoin package, needed if you installed with --prefix=PREFIX
# or if you did not use setup.py.
sys.path.insert(0, '/path/to/cgi-bin/pytree/lib/python2.5/site-packages')

# Path of the directory where wikiconfig.py is located.
# YOU NEED TO CHANGE THIS TO MATCH YOUR SETUP.
sys.path.insert(0, '/path/to/htdocs/Moin')

Rename moin.cgi to moin.py and upload it to cgi-bin/pytree/bin/moin.py. Then upload the following script as cgi-bin/moin.cgi

/path/to/cgi-bin/pytree/bin/python /path/to/cgi-bin/pytree/bin/moin.py $@ 

.htaccess protection

Upload a .htaccess file with this content:

deny from all

inside this directories:

nice URLs (and probably better security)

Follow the instructions on RobertSchumann/ApacheOnLinuxFTPRootWiki.

MoinMoin: ClaudioPisa/ApacheOnLinuxFTPNoPython (last edited 2007-10-29 19:15:37 by localhost)