Difference between revisions of "User:Sven"

From Organic Design wiki
m
m
Line 35: Line 35:
 
*[http://www.asbbank.co.nz/story206.asp ASB rates]
 
*[http://www.asbbank.co.nz/story206.asp ASB rates]
  
----
 
 
== Installing MediaWiki on OS X==
 
Media wiki requires:
 
#Apache webserver
 
#PHP
 
#Mysql
 
 
See [http://www.mediawiki.org/wiki/Download mediawiki.org] and [http://sourceforge.net/projects/wikipedia/ sourceforge] for installation details.
 
As OS X ships with a built in Apache webserver, installation of PHP, and Mysql is all that is required.
 
If you want to run Apache as a secure webserver then you probably have to build Apache from source.
 
 
PHP 5.0.4/4.3.11 is available as a [http://www.entropy.ch/software/macosx/php/ dmg], and Mysql 4.1.13a is  [http://www.apple.com/downloads/macosx/networking_security/mysql.html available] A [http://www.apple.com/downloads/macosx/networking_security/mysqlbackup.html Mysql backup] tool is also available from the apple website
 
 
=== Apache in OS X (tiger) ===
 
Apache/1.3.33 is shipped with a standard install of OS X on Jaguar, Panther, and Tiger. It does not come with php
 
pre-compiled.
 
 
:Start your personal webserver under;
 
preferences → Sharing → Personal Web Sharing
 
 
There are  differences as to the locations of installed directories from standard binary/source linux installations. Its worth
 
checking the build with the terminal command '''httpd -V'''
 
<table class=document-code><tr><td>[[+Sven/OS X/httpd -V]]</td></tr></table>
 
 
The webpage is accessable as localhost or 127.0.0.1, with access to your personal home page at:
 
:<nowiki>http://127.0.0.1/~USER_NAME</nowiki>
 
The webserver pages are located in the directories
 
*/Library/WebServer (System pages)
 
*/Users/USER_NAME/Sites (User page)
 
 
===Useful Links===
 
*[http://www.macdevcenter.com/pub/a/mac/2001/12/07/apache.html Apache for OS X]
 
*[http://www.entropy.ch/software/macosx/php/ PHP for Apache shipped with OS X]
 
----
 
:[[Example Article]]
 
 
==Backing up wikidb using mysql (OS X)==
 
Information for doing this came from [http://meta.wikimedia.org/wiki/Backup_Database here].
 
There are many ways to go about this;
 
*drop entire databases, and reconstruct
 
*drop tables if they exist for a particular database and reconstruct tables and data
 
* Insert data only into databases (errors can be introduced if not using INSERT IGNORE statements)
 
 
===Caveat===
 
When using restore on INSERT statements only where tables already exist, there are two ways to restore
 
* mysql> source backup.sql <nowiki>#</nowiki>(interactively inside mysql itself)
 
* mysql -u root -D wikidb < backup.sql  <nowiki>#</nowiki>(bash call using a redirect)
 
 
If an error occurs in a redirect then nothing is inserted after the statement that causes the error (e.g. primary keys already exist), whereas interactively from the command line invalid INSERT's provide a warning '''only''' and valid statements are still restored. This is because the bash redirect is being used to stream the file line by line, exiting at the point of failure. Introduced into mysqldump  in version 5.0.15 is ''--insert-ignore'' which allows dumps of '''INSERT IGNORE''' statements. In this case a command line redirect whould work if the dump was;
 
 
*mysqldump -u root -p --single-transaction --no-create-info --insert-ignore wikidb > /tmp/backup.sql
 
 
Here, I want to move the wikidb directory in mysql to a temporary
 
location (say /tmp directory) so the information is not perminantly lost then use mysql to reconstruct wikidb.
 
 
*<s>mysqldump -u root -p --single-transaction wikidb > /tmp/backup.sql</s> ''creates tables which already exist''
 
*mysqldump -u root -p --single-transaction --no-create-info  wikidb > /tmp/backup.sql
 
*wikipath=`locate wikidb | grep wikidb$`
 
*sudo mv $wikipath ${wikipath}-bak
 
*cd /tmp
 
* '''[Time to recreate MediWiki which will make the wikidb database]'''
 
*mysql -u root -p -D wikidb < /tmp/backup.sql
 
* <nowiki>#</nowiki> Check the directory sizes match between wikidb and wikidb-bak
 
* sudo du $wikipath
 
* sudo du $wikipath-bak
 
*<nowiki>#</nowiki> Refresh the links using maintenance script
 
* php refreshLinks.php
 
 
 
 
 
== xml Wiki Markup ==
 
 
<table class=document-code>
 
<tr>
 
  <td>
 
    Table Markup
 
  </td>
 
  <td>
 
    <nowiki>
 
      <table class=document-code><tr><td>Table Markup</td></tr></table>
 
    </nowiki>
 
  </td>
 
</tr>
 
</table>
 
<center>''NOTE: You can be real casual with table syntax and miss out all <nowiki></tr>'s and </td>'s</nowiki> if you like.''</center>
 
----
 
 
==== Contact details====
 
==== Contact details====
 
*Name: Marcus Davy
 
*Name: Marcus Davy

Revision as of 21:17, 7 February 2006