Mailing List Archive

Re: [Wikitech-l] installing mediawiki
On Wednesday, Oct 15, 2003, at 14:02 US/Pacific, Tomoaki Watanabe wrote:
> Hi. I and others are trying to install a mediawiki into iBiblio's
> server for a project, and I would like to get some help.
>
> It seems that installation requires command-line php, which is not
> available at their server.
>
> Is there any quick work-around that I am missing? Or is this the way
> it is? (Or am I simply wrong?) I would appreciate any input.

As a workaround for the installer script, you can do it manually. I'm
assuming you've got a way of running batch SQL commands, either through
the mysql command-line client or through some administrative tool such
as phpMyAdmin.

First, create the database:
CREATE DATABASE wikidb;
(or whatever you'd like to name it)

into this database run the table creation SQL scripts, which are in the
maintenance subdirectory: tables.sql and indexes.sql. These create an
empty wiki database.

You may wish to create a separate MySQL user for the wiki, if so adapt
users.sql to the username and password you want to use and run that on
the table as a MySQL user with administrative privs.

Put wiki.phtml and redirect.phtml into the destination install
directory. You can put the rest of the .php files there if you like (as
the installer does), but I prefer to put them in a separate directory
which I then add to the PHP include path so multiple wikis can be run
from the same code (and the other source files aren't exposed to the
web on the off chance that something weird can be done by executing
them alone).

Create your LocalSettings.php and put it into the same directory with
wiki.phtml. If the sample file isn't clear, refer to
DefaultSettings.php and override anything that isn't going to turn out
right for you.

Copy the *.js and *.css files from the 'stylesheets' subdirectory into
an appropriate place, which should be accessible as $wgStyleSheetPath.

Security notes:

* the wiki code currently requires that register_globals be on. You may
not wish to turn this on server-wide because some programs may be
insecure using that mode. See http://php.net/register_globals for how
to enable it.

* If your LocalSettings.php contains a password for the database user,
make sure you're not saving backup files that will be accessible via
the web served as text files.

* Interpretation of PHP in the upload directory really should not be
enabled, since anyone could execute arbitrary code as the webserver
user. It's also recommended that you set HTML files to server as plain
text to prevent cookie-stealing attacks. As an example apache config
fragment:
<Directory "/usr/local/apache/htdocs/wiki/upload">
php_admin_flag engine off
AddType text/plain .html .htm .shtml
</Directory>

* There's a bug in the upload code that may make it possible to delete
files with an appropriately crafted URL. Until this is fixed, you
should comment out the call to unsaveUploadedFile() in
SpecialUpload.php. This may occasionally leave temporary files around
from uploads that are discarded.

Other notes:
* iconv support is required, but it's not compiled into PHP by default.
If you don't have iconv support, you can work around it by defining a
dummy function like so: http://meta.wikipedia.org/wiki/Iconv_hack

* the $wgDebugLogFile must either be writable or be set to "" or you
get ugly error messages.

-- brion vibber (brion @ pobox.com)
Re: [Wikitech-l] installing mediawiki [ In reply to ]
On Wednesday, Oct 15, 2003, at 14:02 US/Pacific, Tomoaki Watanabe wrote:
> Hi. I and others are trying to install a mediawiki into iBiblio's
> server for a project, and I would like to get some help.
>
> It seems that installation requires command-line php, which is not
> available at their server.
>
> Is there any quick work-around that I am missing? Or is this the way
> it is? (Or am I simply wrong?) I would appreciate any input.

As a workaround for the installer script, you can do it manually. I'm
assuming you've got a way of running batch SQL commands, either through
the mysql command-line client or through some administrative tool such
as phpMyAdmin.

First, create the database:
CREATE DATABASE wikidb;
(or whatever you'd like to name it)

into this database run the table creation SQL scripts, which are in the
maintenance subdirectory: tables.sql and indexes.sql. These create an
empty wiki database.

You may wish to create a separate MySQL user for the wiki, if so adapt
users.sql to the username and password you want to use and run that on
the table as a MySQL user with administrative privs.

Put wiki.phtml and redirect.phtml into the destination install
directory. You can put the rest of the .php files there if you like (as
the installer does), but I prefer to put them in a separate directory
which I then add to the PHP include path so multiple wikis can be run
from the same code (and the other source files aren't exposed to the
web on the off chance that something weird can be done by executing
them alone).

Create your LocalSettings.php and put it into the same directory with
wiki.phtml. If the sample file isn't clear, refer to
DefaultSettings.php and override anything that isn't going to turn out
right for you.

Copy the *.js and *.css files from the 'stylesheets' subdirectory into
an appropriate place, which should be accessible as $wgStyleSheetPath.

Security notes:

* the wiki code currently requires that register_globals be on. You may
not wish to turn this on server-wide because some programs may be
insecure using that mode. See http://php.net/register_globals for how
to enable it.

* If your LocalSettings.php contains a password for the database user,
make sure you're not saving backup files that will be accessible via
the web served as text files.

* Interpretation of PHP in the upload directory really should not be
enabled, since anyone could execute arbitrary code as the webserver
user. It's also recommended that you set HTML files to server as plain
text to prevent cookie-stealing attacks. As an example apache config
fragment:
<Directory "/usr/local/apache/htdocs/wiki/upload">
php_admin_flag engine off
AddType text/plain .html .htm .shtml
</Directory>

* There's a bug in the upload code that may make it possible to delete
files with an appropriately crafted URL. Until this is fixed, you
should comment out the call to unsaveUploadedFile() in
SpecialUpload.php. This may occasionally leave temporary files around
from uploads that are discarded.

Other notes:
* iconv support is required, but it's not compiled into PHP by default.
If you don't have iconv support, you can work around it by defining a
dummy function like so: http://meta.wikipedia.org/wiki/Iconv_hack

* the $wgDebugLogFile must either be writable or be set to "" or you
get ugly error messages.

-- brion vibber (brion @ pobox.com)

_______________________________________________
Wikitech-l mailing list
Wikitech-l@Wikipedia.org
http://mail.wikipedia.org/mailman/listinfo/wikitech-l