Recent Changes - Search:

Cookbook

PmWiki

pmwiki.org

Standalone

Summary: Allows PmWiki to run in a "standalone" mode, without needing a webserver such as Apache
Version: 2.1.13
Prerequisites: none
Maintainer: Pm
Categories: SystemTools

Questions answered by this recipe

Is it possible to run PmWiki in a "standalone" mode, without needing a web server such as Apache?

Answer

PmWiki is a PHP web application, so there has to be something that can support PHP and act as a webserver. The files below contain a special, bare-bones webserver application that can be used to run PmWiki in places where another webserver isn't available (e.g., a desktop machine).

server.zipΔ - Complete archive for Microsoft Windows environments, including PHP binaries
pmwikiserv.phpΔ - PHP script only (for Unix or systems that already have PHP available)

Another possibility is to use a read-only mirror of the wiki gained from wget and a special link conversions :

  • the following bash script can be used (doHoove.txtΔ)
  • the style sheet link conversion needs to be updated if you are not using the default style

Comment

Some of the solutions below do use a webserver, and thus do not answer the question posed above. Attach:

Installation

Microsoft Windows

  1. Download a copy of PmWiki and unzip it into a folder on the local system.
  2. Download the server.zipΔ package and unpack its contents into a folder called server/ within the PmWiki main folder. This package includes a copy of the PHP executables, so you don't need to install that separately.
  3. Execute the pmwikiserv.bat file in the server/ folder.
  4. Open a web browser to http://localhost/wiki -- you should see the PmWiki default home page.

That's it!

Apple OS X

See Wiki on a stick

Unix systems

Instructions forthcoming.

  • This recipe was last tested on PmWiki version: 2.1.13
  • This recipe requires at least PmWiki version: any

PHP Built-In Server

PHP version 5.4 and later comes with a built-in web server. You can enter the pmwiki directory, then type

php -S localhost:8001

to start the server on port 8001. The port number can be changed to whatever you want if 8001 is in use. Then open a browser to

localhost:8001/pmwiki.php

and use your wiki. The PHP built-in server is not an Apache replacement, so you should only use this for a standalone PmWiki. The PHP command given above prevents access from any other computer.

See Also

  • Wiki on a stick for using various web servers with PmWiki installed on a USB stick.

Discussion

I ran into 2 problems the first time I tried this:

  1. Clicking on the batch file opens a command window. The first few times I did this the window filled with text that scrolled so fast I couldn't see what it was saying. Turning off Skype stopped that problem. As described below, this is a conflict on port 80, and you can disable port 80 use in Skype prefs.
    1. 03/04/10 Newer Skype doesn't seem to have (obvious) way to kill port 80; but stopping skype then starting the PHP then starting skype, worked. The Skype web page on killing 80 is old news - tools / options / connections -- the new menu has no such. Ward Christensen
  2. Once the darn thing was running, there was no way to stop it. The command window was completely unresponsive and I didn't really want to kill PHP.EXE in the Task Manager. Type Control-C in the command window to bring up a "Terminate batch job?" dialog. Neil Herber

While using this recipe I got two problems:

  • Only images situated in the '/pub' directory or subdirectory can be displayed.
    Now fixed as of 9-Oct-2005. --Pm
  • We are back with the terrific problem of accented letters, either in image name or in directory names, which prevent images to be displayed, when these images are in the http://localhost domain. Same images, but called via File:///C:/Doc... are perfectly visible, as they are on any outside site. This occurs with IE and Firefox, while with different error messages.
    PRZ

Please, be aware that the standalone version is not totally functional because of the server configuration. You may run into problems arising from directory names not being recognized by the server. Also, setting WikiFarms doesn't seem to work properly with the minimal server configuration. Be sure to check the readme included with it.

I was able to get this to work, but I had to add the following lines to pmwikiserv.php. As explained on the comments on the PHP site, this tweak is a way of getting around the "unable to bind, address already in use" error (that I was getting). I'm not sure exactly what negative effects this tweak might have; if anybody has an idea about that, please fill us in. These lines go right BEFORE the line, socket_bind($AcceptSocket, $ip, $port);

# reuse socket tweak
  if (!socket_set_option($AcceptSocket, SOL_SOCKET, SO_REUSEADDR, 1)) {
    echo socket_strerror(socket_last_error($sock));
    exit;
  }

I also might add, I was able to get this thing to work on my flash drive, no problem. Just follow the instructions above, and you've got a localized portable PmWiki installation. Just keep in mind that, from computer to computer, there are probably different settings related to servers, and it's possible you could have problems on one machine and not another. - JonHaupt

I am having trouble running on a shared drive at work. PM Wiki ran fine in standalone mode on my hard drive. I exited it by killing the dos window. I copied the installation over to a shared drive and found it working when called from a DOS command prompt. When I click the batch file \server\pmwikiserv.bat from Windows, (with no servers running) I get a lovely flash on the screen but no wiki. Methinks (wethinks?) the path is not setting correctly in Windows. Help? OBTW. My mappage of the drive will be different than my co-worker's, the path can not be hard-coded. - CongaMike

Update: I fixed (kludged) the problem by hard coding the path statement in the pmwikiserver batch file - CongaMike

I thought the action above corrected the problem and I no longer needed the local copy. Windows would not let me delete it due to file sharing issues. I exited PM Wiki, deleted the local copy, and tried to run the shared copy. Voila! All is well! Sorry to trouble you. - CongaMike

Sometimes the server won't work, because the port 80 that the server uses is already taken. A common reason for this is if you have Skype running. To fix this problem go to Skype Tools > Options > Connection and uncheck "use port 80 and 443 as alternatives for incomming connections". You might have to restart Skype in order for the changes to take effect.
The same problem occurs also with other servers used, like the ones below. Anno

Win32 bundle; Applied the recipe successfully, however the PHP http server sometimes seems unable to cope with a large number of simultaneous requests (e.g. GUIButtons images). stderr says socket_write() unable to write to socket [0]: <localized WinSock message here: closed by remote host>. - RasqualTwilight

  • Another possible combination is to set up PmWiki to work under another free and more complete web server called Xampp-Lite. The whole pack needs only about 90 MB and includes many advantages. Visit http://www.apachefriends.org for more details.
  • Yet another WAMP (Windows, Apache, MySQL and PHP) package has been spotted at http://www.en.wampserver.com/index.php . This one is licensed under the GNU GPL (like PmWiki). According to the site "WAMP5 installs automatically Apache 1.3.31 ,PHP5, MySQL database ,PHPmyadmin and SQLitemanager on your computer. It's principal aim is to allow you to easily discover the new version oh PHP .."
  • And yet another is The Uniform Server ( http://www.uniformserver.com/ ) The Uniform Server is a free and open source WAMP package that allows you to run a server on any MS Windows OS based computer. It is small and mobile to download or move around and can also be used or setup as a production/live server.
    • It works great with subfolders (e.g. pmwiki in pmwiki folder)
    • micro-how-to
      • choose UPX zip, uncompress it
      • uncompress your pmwiki in the www folder Z:/path_to_/UniformServer/www/pmwiki/pmwiki.php
      • modify your local/config.php
$ScriptUrl = 'http://localhost/pmwiki/pmwiki.php';
$PubDirUrl = 'http://localhost/pmwiki/pub';
  • run Z:/path_to_/UniformServer/Server_Start.bat
  • et voila !
  • What about using Nanoweb, an HTTP server written in PHP?
    • It works just fine in a SUSE box, just a little slow with the graphics. CarlosAB April 16, 2007, at 06:44 AM

I tried using server.zip on my Windows XP machine. I unzipped PmWiki to a folder on my local machine. I unzipped server.zip into that folder. I executed pmwikiserv.bat. When I tried to use my web browser to http://localhost/wiki, I got a page stating "No input file specified." I can't find mention of this problem in the PmWiki. Can anyone help me out on this? ---Michael Galvin Oops. I just figured out what I did wrong. I created a directory on my machine, I called PmWiki. I unzipped pmwiki-latest to that directory, into a directory under "PmWiki" called "pmwiki-1.2.27". I then unzipped server.zip into "PmWiki". What I should have done was to unzip it into pmwiki-1.2.27. Now all is well and works fine. I'll leave this comment in this page in case someone else makes the same darned mistake. ---Michael Galvin

:Jolly good thing... I just did the same thing, and I would have given up and gone to bed if I hadn't seen your post! Perhaps some rewording of the instruxions would be in order!!!

:I tried putting pmwikiserv in a shared directory and pointing to it, and even changing the default path, etc, but was unsuccessful; it DOES have to be where the readmem says. Question has anyone successfully gotten a wiki farm going locally, so you can have both a farm server copy and a farm local copy for testing? Otherwise I'll write up how to "duplicate" all the files, have multiple copies of server, etc. Kind of ugly. Ward Christensen


I'm trying to run pmwikiserv.php and got message like this:

PHP Warning:  dl() [<a href='function.dl'>function.dl</a>]: 
Unable to load dynamic library 
'/usr/local/Php-5.2.0/lib/php/extensions/no-debug-non-zts-20060613/php_sockets.dll' 
- /usr/local/Php-5.2.0/lib/php/extensions/no-debug-non-zts-20060613/php_sockets.dll: 
cannot open shared object file: 
No such file or directory in /root/spot/webserver/htdocs/tww/server/pmwikiserv.php on line 76
PHP Fatal error:  
Call to undefined function socket_create() in /root/spot/webserver/htdocs/tww/server/pmwikiserv.php on line 77

What does it mean?

---Ierikka

I've been trying to use pmwikiserv.php, and have got it running, but it doesn't seem to work properly:

  • It seems to be splitting the header/body sections incorrectly, resulting in the beginning of the header section being missing, and raw html appearing instead of the wiki.
  • I think the regular expression used in preg_split on line 136 of pmwikiserv.php isn't quite right, but I don't really know enough about php to fix it.

Any thoughts?

Many thanks, Rowland (2007-10-01)



If you wish to distribute your copy of PmWiki on a CD, you can give http://www.server2go-web.de/ a try hua

Another option is Web Server for CD running on Win, Mac OS X and Linux - currently the only option for creating single CD that will work on 3 platforms. Derek?


I'm trying to set up and test this on a Windows XP PC with PHP, apache, etc, but for use on a PC without them. I get

PHP Warning:  Unknown(): (null): Unable to initialize module
Module compiled with module API=20060613, debug=0, thread-safety=1
PHP    compiled with module API=20020429, debug=0, thread-safety=1
These options need to match in Unknown on line 0

Any suggestions for how to get it to work would be appreciated.

tia, Simon

Hello, I'm using XP Home OS. I'm trying to use the stand alone version and i followed instructions. I unzpped pmwiki to pmwiki-2.1.27, then unzipped server to pmwiki-2.1.27 then executed the batch file named "pmwikeserv" and when it runs I get a command promt that says "c:\pmwiki-2.1.27\server>echo off" then a few seconds later i get a pop up box that says;

"Unknown(): (null): Unable to initialize module Module compiled with module API=20060613, debug=0, thread-safety=1 PHP compiled with module API=20020429, debug=0, thread-safety=1"

Can someone please explain to me how to fix this? Sterling

Answer:

I had this same problem when I tried to run a standalone wiki on a machine that already had one set up on an Apache web server. To fix this, I moved the PHP file (originally in Program Files) and its contents to the desktop. Now the standalone one works, but the one running off Apache doesn't. I'm not sure if they can both run at the same, but this issue definitely has something to do with PHP and not the wiki itself.


Configuration note

It's worth to know that some configuration can be put in a separate configuration file pmwikiserv.conf you should create in the server/ directory. This allows e.g. for easy configuration of the port on which the server will reside. An example from my disk is:

 
<?php
$Listen = "127.0.0.1:7777";
print "Listening port used: $Listen\n";

which allows me to browse local PmWiki at http://localhost:7777/wiki when port 80 is occupied by a firewall configuration page. MateuszCzaplinski


I use Quickphp (use google to find it, first hit) to have a PHP-enabled webserver to run PMwiki on it. It is a few files without installing. Just put them in a directory and start the executable file. Just a few options and you can start/stop it from your systray. When you need certain modules that are not enabled by default you can also easily integratie itt with the PHP binaries from PHP.net. --Jeroen


Question: I have been using this wiki for a couple of years, and now I am trying to using it on Windows 7 64 bit OS and IIS 7.0 and have problems with it. It sometimes just crashes or it will take about 30 seconds to load a page. Any suggestions?

-D. McNulty


guys, the only advantage to using this over xampp is that it is small and easier on ram. xampp will load on a USB stick, has versions for windows (including windows 7, but I don't know about 64 bit), linux, mac, and solaris, it's pre-configured to run, and there is extensive support in multiple places. I'd still use xampp for a first installation, or if there's a problem, since I know I can make it work. (disclaimer: php.ini will limit upload size, and I'm a 10 year veteran of running web servers. what I've learned how to do in 30 minutes in Gnome might take you a little while, especially with apache)


FireFox update broke standalone

Stand-alone worked great for me in Windows XP SP 3, then my FireFox got updated to 10.0.3, and while PHP.EXE + pmwikiserv.php etc loads the first page, nothing happens after that - including no messages in the php server window. Would appreciate any ideas. Ward Christensen April 22, 2012, at 03:10 PM

Contributors

User notes +1 -1: If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki.

Edit - History - Print - Recent Changes - Search
Page last modified on July 10, 2014, at 08:54 AM