Camen Design Forum

How to use this forum?

append delete Nicolai

How do I get this forum to work at my own site?
Sorry for being a newbie, I'm not a genious at php.

Reply RSS

Replies

append delete #1. Kroc

Need some details:

What OS are you using on your own computer? Do you already use an Apache/PHP install of some sort?

If you’re going to put this on an existing website then you will need a subdomain like forum.---.com

To run the forums, you need to download the code, unzip to a folder that is mapped to a virtual host (the forums will not run in a sub-folder, they have to be at webroot). Set the file permissions to read/write for everything and then open your browser to the right place. The code all runs in-place and besides the file permissions, there’s no setup needed.

append delete #2. Nicolai

Windows 7 at my own computer, but my site (staurvik.org) is hosted at IXwebhosting (Linux plan).

I have uploaded the files, but I only get a 500. :(

append delete #3. Kroc

A 500 sometimes means that the .htaccess is not parsing. You should be running Apache 2.2 and PHP 5.2.x.

Try removing the .htaccess file, download an RSS feed from this site, upload to yours and then try rendering it directly using /thread.php?file=xyz.xml

append delete #4. Nicolai

The forum is hosted at forum.staurvik.org by the way.

I'm sure fixing this is somehow obvious, but I'm not very good at it. :)

append delete #5. Kroc

It works for me! I can’t post though, probably because you need to make a users folder on root and give it permissions.

append delete #6. Nicolai

Removing the .htaccess did it. :D

Thanks much!

append delete #7. Kroc

You need the .htaccess file for the site to fully work though. So there is an error in the .htaccess file (for your server) that we need to fix / eliminate. Put the .htaccess empty and add each block of text back in one by one and narrow down exactly what command breaks it. (remember that RewriteCond lines *must* be followed by RewriteRule, or it’ll 500).

append delete #8. Nicolai

Found it!

<IfModule mod_setenvif.c>
<IfModule mod_headers.c>
BrowserMatch MSIE ie
Header set X-UA-Compatible "IE=Edge,chrome=1" env=ie
</IfModule>
</IfModule>

append delete #9. Kroc

That shouldn’t even be there really. Just copy/pasted from camendesign. I’ll remove that.

append delete #10. Nicolai

Now it works smooth as butter. Thanks Kroc! :)

append delete #11. Kroc

That's good to hear :)

Now would be a good time to brush up on your PHP! You're going to have the problem that I'm continually making improvements to the code, whilst you're making changes to your own copy, and the current code has no proper anti-spam ability at all.

I suggest that you duplicate theme.php, and edit a copy, rather than the original. The HTML is stored in there, and you can thus keep your own skin changes between updates. Improved skin support will be coming.

You should follow the GitHub repository (and probably use GIT itself) so you can see what has changed after each commit and keep your copy up to date.

Also, please be aware that the code is licenced under CC-BY. What this means is that you can do anything with the code, as long as you give credit. Please include in your HTML (though it doesn't have to be visible on the page, it could be a comment) credit to kroc camen / forum.camendesign.com thanks!

append delete #12. Nicolai

Done! ;)

append delete #13. davidhund

@Kroc re: the file permissions. Is it really necessary to give all files/folder complete read/write access? To a PHP newbie like me this sounds like a potential security issue(?)

append delete #14. Kroc

@davidhund Probably not, but the PHP script does need to write to webroot to add and update threads. No need to set execute on anything but the PHP. Anyway, the code sanitizes the user’s input so that they can’t mess with the server. If there are any security flaws, hopefully people will report them, it is open source after all.

append delete #15. Kroc

BTW, I should add that I’ve just pushed an update to allow you to change themes on the server side to make way for a new default theme for the open source distribution (the C=64 skin is personally for this website and I wouldn’t want it as the default for new installs).

append delete #16. Kroc

Ironically just pushed an update to fix a whole bunch of security fixes with unsanitised input :P

append delete #17. davidhund

@Kroc thanks. I am no PHP developer, but I am following this forum closely and will probably install and play around with it soonish. Loving the simplicity…

append delete #18. Nicolai

Btw; What changes do one have to do in order to makes this forum run in a subdirectory?

append delete #19. Kroc

Hmm. I would think that it’s just the constants that need redefining to suit the subdirectory (you could hard code them) — FORUM_ROOT and FORUM_URL. The forum has to build client-side URLs and serverside paths (that might not map to the URL base at all), so this is not always reliable to work in a sub folder, but I’m sure it could be done, I just can’t think of it right now.

append delete #20. Nicolai

I've fixed the php, but the mod_rewrite is redirecting me to the domain root.
I know nearly nothing about Apache-programming, so I don't know how to fix the .htaccess.

append delete #21. Kroc

Ah, the mod_rewrite detects sub-folders and pipes them through the PHP scripts; I knew there was something I was forgetting!

You’ll have to prepend your folder name to the mod_rewrite statements:

before:

~~~
# a folder
RewriteCond %{REQUEST_URI} ^/[^./&]+/$
RewriteCond %{DOCUMENT_ROOT}%0 -d
RewriteRule ^(?:([^./&]+)/)?$ /?path=$1 [QSA,L]

# a thread
RewriteCond %{REQUEST_URI} ^/([^./&]+/)?([^./]+)$
RewriteCond %{DOCUMENT_ROOT}%0.xml -f
RewriteRule ^(?:([^./&]+)/)?([^./]+)$ /thread.php?path=$1&file=$2 [QSA,L]

# an index RSS feed
RewriteCond %{REQUEST_URI} ^/([^./&]+/)?index.rss$
RewriteRule ^(?:([^./&]+)/)?index.rss$ /rss.php?path=$1 [QSA,L]
~~~

After: (replace 'folder' with the appropriate name)

~~~
# a folder
RewriteCond %{REQUEST_URI} ^/folder/[^./&]+/$
RewriteCond %{DOCUMENT_ROOT}%0 -d
RewriteRule ^folder/(?:([^./&]+)/)?$ /?path=$1 [QSA,L]

# a thread
RewriteCond %{REQUEST_URI} ^/folder/([^./&]+/)?([^./]+)$
RewriteCond %{DOCUMENT_ROOT}%0.xml -f
RewriteRule ^folder/(?:([^./&]+)/)?([^./]+)$ /thread.php?path=$1&file=$2 [QSA,L]

# an index RSS feed
RewriteCond %{REQUEST_URI} ^/folder/([^./&]+/)?index.rss$
RewriteRule ^folder/(?:([^./&]+)/)?index.rss$ /rss.php?path=$1 [QSA,L]
~~~

Also, I just realised that the theme links to "/" for the logo, which will go up a folder to web root, you'll need to replace that with "/folder/" instead.

Working from a sub-folder is not a simple problem to solve, esp. when it comes to the mod_rewrite rules.

append delete #22. Nicolai

Thanks Kroc! :)
It fixed most things, but I can't open any threads.

--------------
Not Found

The requested URL /forum-subdirectory/thread was not found on this server.
--------------

Is this a php related issue or could it be the .htaccess?

append delete #23. Kroc

Oh, I just spotted a mistake. I forget that the PHP files are in the root of the folder, and shouldn't include the path being accessed.

Replace the relevent htaccess stuff with this corrected version.

~~~
# a folder
RewriteCond %{REQUEST_URI} ^/folder/[^./&]+/$
RewriteCond %{DOCUMENT_ROOT}%0 -d
RewriteRule ^folder/(?:([^./&]+)/)?$ /folder/index.php?path=$1 [QSA,L]

# a thread
RewriteCond %{REQUEST_URI} ^/folder/([^./&]+/)?([^./]+)$
RewriteCond %{DOCUMENT_ROOT}%0.xml -f
RewriteRule ^folder/(?:([^./&]+)/)?([^./]+)$ /folder/thread.php?path=$1&file=$2 [QSA,L]

# an index RSS feed
RewriteCond %{REQUEST_URI} ^/folder/([^./&]+/)?index.rss$
RewriteRule ^folder/(?:([^./&]+)/)?index.rss$ /folder/rss.php?path=$1 [QSA,L]
~~~

append delete #24. tag_

thanks Kroc. I too had 500 error. I get error for the following line in .htacces

php_flag short_open_tags on

And works when disabled. Is it absolutely necessary?

append delete #25. Kroc

No, it's supposed to be there to force on the short tags option "<?=...?>". The error could be something to do with if your PHP is running as an Apache module or as a CGI module. I'll remove the offending line and have to rework the code to not use shorttags.

Reply

(Leave this as-is, it’s a trap!)

There is no need to “register”, just enter the same name + password of your choice every time.

Pro tip: Use markup to add links, quotes and more.

Your friendly neighbourhood moderators: Kroc, Impressed, Martijn