Author Topic: Wiki Help  (Read 6326 times)

Sin Stalker

  • Boss
  • ****
  • Posts: 179
Wiki Help
« on: November 27, 2009, 10:26:39 PM »
Hello all.

I have been working for a while now on something a long with a few others. My out of game group is known as the City of Comic Creators aka CCC.

We have our own website of www.cohcomicindex.com

What we are, are a bunch of players who make CoH and CoV comic books.

Now to the issue at hand. I have been working on this:
http://cohcomicindex.com/home/cohcomicindex/index.php?title=Main_Page

Now I am having a lot of trouble with this and I am hoping for some help.

The wiki is still not fully set up. There are several things I need help with but the main one is taking away pretty much all abilities from "all" except for reading the pages of course. I only want users to be able to edit and whatnot.

Now I found where it says in the guide to change but its a bit confusing for me and I also can't find the commands that it says. It doesn't say specificlly to add them in myself so I am unsure about that. If so, where do I add in it the localsettings.php file? The end? The beginning? a specific spot in the middle?

I am very confused and could really use some help here. Any and all help would be appriciated.

Thanks.


-Sin


Sekoia

  • Titan Network Admin
  • Elite Boss
  • *****
  • Posts: 1,848
Re: Wiki Help
« Reply #1 on: November 28, 2009, 07:50:28 PM »
Most of the time, you want to add settings to the end of LocalSettings.php.

To prevent anonymous users from editing pages, add this line to the bottom of LocalSettings.php:

Code: [Select]
$wgGroupPermissions['*']['edit'] = false;
If you also want to restrict account creation, add this line to the bottom of LocalSettings.php:

Code: [Select]
$wgGroupPermissions['*']['createaccount'] = false;
If you do restrict account creation, refer to http://www.mediawiki.org/wiki/Manual:Preventing_access#Restrict_account_creation for details on how to then add accounts manually.

Sin Stalker

  • Boss
  • ****
  • Posts: 179
Re: Wiki Help
« Reply #2 on: November 29, 2009, 04:40:56 AM »
Cool. That worked. TY.

I was also able to do a few other things.

There is 1 last MAIN thing I am hoping to get done.


See when people make comics, without a place like hypercomic.com or whatever it was called, noone has a place to upload there work. The only place right now is www.cohcomics.com and that is run by someone and can take awhile to get their work on there.

I want to make it so that the file size limit is higher, like 10 or even 20 mb per file.

This way anyone can upload the pdf of their comic to the site and can have control of there own creation.

Can you help me figure out how to increase the 2mb file size limit?

TonyV

  • Titan Staff
  • Elite Boss
  • ****
  • Posts: 2,175
    • Paragon Wiki
Re: Wiki Help
« Reply #3 on: November 29, 2009, 07:14:29 AM »
There is a setting that you can add to your LocalSettings.php file named $wgMaxUploadSize.  However, that's probably not your problem; the default is 100 MB, which should be more than generous.

The likely bottleneck is your php.ini file.  The default setting for upload_max_filesize is 2 MB.  The php.ini file is typically under /etc/php5 on a Linux server (possibly in an apache2 subdirectory).  I think that on Windows, its default location is in the root of the php folder.  To change it, just edit your php.ini file and change the 2MB to something higher.  Don't go too nuts, though, because you don't want someone trying a denial-of-service attack by uploading a thousand 1GB files or something.

If you're on a shared hosting server and can't edit the php.ini file directly, there's a way around it that might work by creating an .htaccess file.  Check out this article for details.

Edit:  By the way, if you want to be able to upload PDF files, they are disabled by default.  You need to add something like this to your LocalSettings.php file also:

Code: [Select]
$wgFileExtensions[] = 'pdf';
Be default, only files with the extensions png, gif, jpg, and jpeg are allowed.  Any other formats you want to accept (tif, bmp, etc.) you'll need to add also.  If you want a full list of those $wg variables, it can be found here.
« Last Edit: November 29, 2009, 02:28:31 PM by TonyV »

Sin Stalker

  • Boss
  • ****
  • Posts: 179
Re: Wiki Help
« Reply #4 on: December 01, 2009, 01:52:10 AM »
Thanks for the pdf info, I got that up now.

I am still having trouble with changing the upload size allowed.

The $wgMaxUploadSize part I put it and yet when I go to the wiki and click upload, it still says 2mb max.

Here is what my line looks like (it took me awhile and it may be wrong because that wiki page doesn't want to give examples)

$wgMaxUploadSize = 1024 * 1024 * 15;

So I am going for the 15mb there.


Then with the other talk about the php.ini file, I can't find that file anywhere.  The other option you gave me there is a bit confusing as it does not give examples aswell. What folder do I make that new file in? Is it the same folder that has the LocalSettings.php file in?

Steiner

  • Elite Boss
  • *****
  • Posts: 1,602
    • Steinerd.com
Re: Wiki Help
« Reply #5 on: December 01, 2009, 02:57:11 AM »
Who's your host?

If GoDaddy, it's in your ftp root, and if there is nothing there you can create one and there are help articles to guide you through that. Otherwise I'd submit a ticket to whomever you're hosting through and ask about upping your allowed upload quota to 8MB... anything more than that it overkill and they won't do it.
~Steinerd

TonyV

  • Titan Staff
  • Elite Boss
  • ****
  • Posts: 2,175
    • Paragon Wiki
Re: Wiki Help
« Reply #6 on: December 01, 2009, 05:36:45 AM »
The nutshell version is to create a file called .htaccess (that's dot-htaccess, the dot on the front of it is important) and upload it to your home/cohcomicindex directory.  It should contain the line:

Code: [Select]
php_value upload_max_filesize 15M
If there's already an .htaccess file there, edit the existing one and put that line either at the top or bottom of it.

Keep in mind that it's possible to disable php settings via an .htaccess file, so it's possible that it won't work.  If it doesn't, you might need to get a different web host.

By the way, I'm glad you're getting into this.  MediaWiki is a cool piece of software, and I've learned an awful lot about just about every aspect of hosting a web site by messing around with it.  It seems like it was just yesterday that it was a little pet project hanging off the PC Free Press's web site.  Keep plugging away!
« Last Edit: December 01, 2009, 05:42:08 AM by TonyV »

Sin Stalker

  • Boss
  • ****
  • Posts: 179
Re: Wiki Help
« Reply #7 on: December 02, 2009, 07:26:04 AM »
Who's your host?

If GoDaddy, it's in your ftp root, and if there is nothing there you can create one and there are help articles to guide you through that. Otherwise I'd submit a ticket to whomever you're hosting through and ask about upping your allowed upload quota to 8MB... anything more than that it overkill and they won't do it.

I do see an ftp folder when looking at everything, although I do not have GoDaddy. I have FastDomain. Know anything about that?

Sin Stalker

  • Boss
  • ****
  • Posts: 179
Re: Wiki Help
« Reply #8 on: December 02, 2009, 09:30:05 AM »
The nutshell version is to create a file called .htaccess (that's dot-htaccess, the dot on the front of it is important) and upload it to your home/cohcomicindex directory.  It should contain the line:

Code: [Select]
php_value upload_max_filesize 15M
If there's already an .htaccess file there, edit the existing one and put that line either at the top or bottom of it.

Keep in mind that it's possible to disable php settings via an .htaccess file, so it's possible that it won't work.  If it doesn't, you might need to get a different web host.

By the way, I'm glad you're getting into this.  MediaWiki is a cool piece of software, and I've learned an awful lot about just about every aspect of hosting a web site by messing around with it.  It seems like it was just yesterday that it was a little pet project hanging off the PC Free Press's web site.  Keep plugging away!

Could this screw up my ability to upload stuff to the server , not through the wiki but using the fast domain interface?

Sin Stalker

  • Boss
  • ****
  • Posts: 179
Re: Wiki Help
« Reply #9 on: December 02, 2009, 09:40:20 AM »
Is this right? I didn't get an answer.

$wgMaxUploadSize = 1024 * 1024 * 15;

because if you go to my wiki and join it, then go to the upload page, you'll see it still says Max Upload 2MB. Why is that if I put that code in the localsettings.php file?

TonyV

  • Titan Staff
  • Elite Boss
  • ****
  • Posts: 2,175
    • Paragon Wiki
Re: Wiki Help
« Reply #10 on: December 02, 2009, 01:23:55 PM »
I do see an ftp folder when looking at everything, although I do not have GoDaddy. I have FastDomain. Know anything about that?

Looking at their web site, they look like pretty much a standard shared web host.  I doubt that they'll make or allow changes to php.ini, so you'll have to try using an .htaccess file instead.  The ftp folder is probably not where you'll want your .htaccess file, that's where you would store files to be accessed via ftp.cohcomics.com.  You're probably looking for a folder named either www or public_html.

Could this screw up my ability to upload stuff to the server , not through the wiki but using the fast domain interface?

No, the only thing it will affect is how large those uploads can be.  Currently, they're limited to 2 MB, and (if the web host allows it) that will allow you to upload larger files via PHP.  An .htaccess file will apply its settings to all subdirectories under where it's located.  So, for example, if you put the .htaccess file in home/cohcomicindex, then it would affect trying to upload a file via a web form at /home/cohcomicindex/upload.php, but it wouldn't affect trying to upload a file via a web form at /home/myotherstuff/upload.php.

Is this right? I didn't get an answer.

$wgMaxUploadSize = 1024 * 1024 * 15;

because if you go to my wiki and join it, then go to the upload page, you'll see it still says Max Upload 2MB. Why is that if I put that code in the localsettings.php file?

Yes, that's correct.  However, be aware that you're actually lowering the limit of how large a file can be when uploading to the wiki, not increasing it.  The default is 100 MB.

The maximum file size for uploading to the wiki is set in two places.  One is the $wgMaxUploadSize variable.  The other is within PHP.  The reason that it is still showing 2 MB is because the upload page will always show you the lesser of those two settings.  If it's set lower in PHP, you'll see the PHP setting, not the $wgMaxUploadSize setting.

To demonstrate, try changing the line to this temporarily:
Code: [Select]
$wgMaxUploadSize = 1024 * 1024 * 1;  // 1 MB max upload size
The upload page will show you that the max file size is 1 MB because that's the lower of the PHP setting (2 MB) and the $wgMaxUploadSize setting (1 MB).

Now change it to this:
Code: [Select]
$wgMaxUploadSize = 1024 * 1024 * 100;  // 100 MB max upload size
Now it will show 2 MB again, because that's the lower of the PHP setting (2 MB) and the $wgMaxUploadSize setting (100 MB).

Keep in mind that the 2 MB file size is not a wiki limitation, it's universal to all PHP forms.  So if you were to create a new PHP form from scratch and try to upload a 2.1 MB file using it, the file would be rejected with a PHP error.

Here's a test scratch file you can use to test uploads.  Save it anywhere as something like upload.php and give it a whirl.  Without the .htaccess file, it should stop you from uploading anything larger than 2 MB.  If you want to test an .htaccess file to make sure it doesn't break anything and that the web host allows .htaccess files, put this script with the .htaccess file (with the "php_value upload_max_filesize 15M" line in it) in its own subdirectory to test it out.  Remember, .htaccess doesn't affect anything outside its own subdirectory and its child directories, so that's safe.  The script doesn't do anything with the uploaded file, it's deleted when the script finishes running.

Code: [Select]
<html><body>
<?php if (!array_key_exists('file'$_FILES)) { ?>
<form action="<?= $_SERVER['REQUEST_URI'] ?>" method="post" enctype="multipart/form-data">
  <p>
    Upload file: <input type="file" name="file" id="file" />
    <input type="submit" name="submit" value="Upload" />
  </p>
</form>
<?php } else {
  if (
$_FILES['file']['error'] > 0) { ?>

<p>Error: <?= $_FILES['file']['error'] ?></p>
<?php } else { ?>
Upload:    <?= $_FILES['file']['name'] ?><br />
Type:      <?= $_FILES['file']['type'] ?><br />
Size:      <?= $_FILES['file']['size'] ?> bytes<br />
Stored as: <?= $_FILES['file']['tmp_name'] ?><br />
<?php } } ?>
</body></html>

Sin Stalker

  • Boss
  • ****
  • Posts: 179
Re: Wiki Help
« Reply #11 on: December 05, 2009, 09:47:28 AM »
I created the file and simply typed this one line of code in "php_value upload_max_filesize 15M" and this is what happened when I tried to go to the wiki...

http://cohcomicindex.com/home/cohcomicindex/index.php?title=Main_Page


So what did I do wrong?

Should I have done it with the long code of this:
<html><body>
<?php if (!array_key_exists('file', $_FILES)) { ?>
<form action="<?= $_SERVER['REQUEST_URI'] ?>" method="post" enctype="multipart/form-data">
  <p>
    Upload file: <input type="file" name="file" id="file" />
    <input type="submit" name="submit" value="Upload" />
  </p>
</form>
<?php } else {
  if ($_FILES['file']['error'] > 0) { ?>
<p>Error: <?= $_FILES['file']['error'] ?></p>
<?php } else { ?>
Upload:    <?= $_FILES['file']['name'] ?>
 
Type:      <?= $_FILES['file']['type'] ?>

Size:      <?= $_FILES['file']['size'] ?> bytes

Stored as: <?= $_FILES['file']['tmp_name'] ?>

<?php } } ?>
</body></html>

?

Steiner

  • Elite Boss
  • *****
  • Posts: 1,602
    • Steinerd.com
Re: Wiki Help
« Reply #12 on: December 05, 2009, 02:24:36 PM »
15MB

 Has to have the whole abbreviation.
~Steinerd

TonyV

  • Titan Staff
  • Elite Boss
  • ****
  • Posts: 2,175
    • Paragon Wiki
Re: Wiki Help
« Reply #13 on: December 05, 2009, 02:27:59 PM »
NOTE:  Steiner's right, please note his post above before reading mine below.  ;)

Well first and foremost, if you want the site to come back up, delete the .htaccess file.  A 500 Internal Server Error almost always means that there's some configuration error, and since you created that file, that's got to be it.  If you are using an FTP client and you don't see the .htaccess file, look for an option to view hidden files in the FTP client that you're using.  (On UNIX-based machines, files that begin with a dot are hidden by default, but they really are there.)  If you're doing all of this from a command-line client, just rm .htaccess even if you don't see the file in the directory listing.  An ls -a will show you all files, including ones that begin with a dot.

No, don't put that whole <html>...</html> file in .htaccess, that's a regular .php file.  It sounds like you had it right the first time, putting that single php_value line in it.  There are two likely causes of the error that I can think of.  One is that you used Windows Notepad to create the file.  Notepad uses carriage return/newline as a line delimiter, whereas UNIX-based systems use just a newline.  For working with files--especially configuration files--for UNIX-based systems, you might want to use something like PSPad instead, which has a function to convert DOS files (CR/LF) to UNIX files (LF) and to edit files as UNIX files.

If that still doesn't solve the problem, then I hate to say it, but it's possible that the web host doesn't have the PHP configuration module loaded.  If that's the case, then the php_value option wouldn't be recognized by Apache, which would cause it to throw a 500 error.  :(

I don't want you to give me your password, but if you have access to create a user account on your server, PM me and I'll take a look at your configuration to see if I can help.

Sin Stalker

  • Boss
  • ****
  • Posts: 179
Re: Wiki Help
« Reply #14 on: February 16, 2010, 02:22:01 AM »
I just wanted to say thank you to everyone who was helping me out and your offers.

Life ended up being extremely busy but I just got back to working on this and was able to figure it out. Apparently all I had to do was call my host and they enabled me that access. :)


So all seems good with the site. If you guys want to check it out and give me feedback that would be great. I think its about ready for public use.


I made this wiki to replace a function that was left when hypercomics.com imploded. I hope it all works. :)



-Sin

TonyV

  • Titan Staff
  • Elite Boss
  • ****
  • Posts: 2,175
    • Paragon Wiki
Re: Wiki Help
« Reply #15 on: February 16, 2010, 03:50:53 PM »
Glad to hear it, and welcome to the world of wiki! :)

I'll check it out when I get home tonight.