picocms / Pico

Pico is a stupidly simple, blazing fast, flat file CMS.
http://picocms.org/
MIT License
3.85k stars 615 forks source link

Server 100 error; no error log, restricted server #332

Closed randombitsofcode closed 8 years ago

randombitsofcode commented 8 years ago

Disclaimer: Hi, first post. I recognize pico as a cms might be a little bit of a challenge for me, but I think I'm there are probably a lot of guys like me that are trying to get out of WordPress and into something "neater" like pico, so hopefully I can get over this initial hump.

I've installed pico on my universities web host, which gives me ftp access on their apache server (I couldn't figure out how to verify the version). I am not aware of what limitations they have, other than storage and bandwidth, and I imagine there may be some that make cmsing difficult, but I would like to try to see how far I can go first before giving up completely. I have no access to an admin that actually knows what the server config is like, because the available IT staff don't regularly deal with this kind of stuff.

After installation I got a 500 internal server error, I did some googling and I played with the .htaccess file. I've variously removed and added each line individually, and eventually I settled on a simpler version of the file that was described on another thread on this board:

<IfModule mod_rewrite.c> RewriteEngine On # RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule>

# Prevent file browsing #Options -Indexes

If I remove the comment for no indexes, I get the 500 error, pretty much no matter what I do, so I have a feeling like I won't be able to get the file linking working at all, but I would appreciate some input. Thanks! [Edit: Note that with the initial .htaccess I wasn't able to browse subfolders even with the index option enabled, but by fiddling with the settings I figured that part out, I think.]

PhrozenByte commented 8 years ago

This happens when Apache is configured to disallow overwriting Options with AllowOverride None (or similar). This shouldn't be a problem for Pico, the line just ensures that directory listing (the Indexes option) and Apache's MultiViews feature is disabled (what is Apache's default anyway). You can safely leave this line commented out.

Did you try Pico's default .htaccess with just the last line commented out? Provided that the .htaccess you posted above works, this should work also. It protects you from users trying to access the raw contents of your website.

Since version 1.0, Pico basically doesn't require a .htaccess at all. It just enables URL rewriting and some basic protection against malicious user requests (like accessing the raw contents). However, as long as you don't want to use plugins which implement authorization, you can safely go without it.

If you encounter any other problems, please don't hesitate to ask :smiley:

randombitsofcode commented 8 years ago

[Edit: sorry, I reread your question and realized you asked to comment out the file index exclusion. The file index doesn't work (clicking on subfolders other than /plugins and /themes produces 500 error) when the line is commented out, which is why I initially started pruning the .htaccess file, to see why it was doing that.]

Yes, I've just copied the exact .htaccess to be sure and it still gives the 500 error. Deleting the file completely gives me the file index. I have a feeling this is something to do with the .php implementation, but I don't really have any evidence. If I click index.php directly from the file index, it simply outputs "run();" onto a blank page.

I don't know if it means anything, but the folder I am running pico from is inside the /public_html for my host, so it's not running out of the "root" of my account.

Thanks for your help!

PhrozenByte commented 8 years ago

Hmm, yeah, it seems that your webserver doesn't support PHP. Unfortunately you can't use Pico without a working PHP installation :disappointed:

randombitsofcode commented 8 years ago

It does (or it says it does!), but I guess it hasn't been enabled for my account. I'll see if I can get someone server-side to enable it, then try again. Thanks!

mayamcdougall commented 8 years ago

Yeah, you should try talking to the customer support of your webhost. They may also be able to provide more insight about their configuration. They might even be willing to make changes if necessary. Customer support reps are usually able to pull some strings if it means keeping a customer.

randombitsofcode commented 8 years ago

So, a little progress: php (and perl) is supported but only through cgi-mode, quote:

"PHP runs in CGI mode using suexec because the supporting server is a multi-user commodity server (vs. running mod_php on a "private" host)"

and to make matters worse, I'm working away from home, so I've now had to resort to using an ssh client on my phone and typing out unix commands (I'll look for a more user friendly client) to ensure text-mode and chmod easily, and I'm not sure if that level of effort will be justified in the long run, but I've waded in this far so I might as well continue. (And thanks btw for keeping up with me!)

My next question is, does it still look like it would be possible to run pico, given that I'm restricted to cgi-mode? I've done a couple of test scripts to make sure it works, but I don't know if something as advanced as pico is likely to work.

PhrozenByte commented 8 years ago

Sure, Pico should work just fine with CGI PHP. :smiley:

Please try creating a info.php with <?php phpinfo(); and navigate to this file using your webbrowser. Provided that it outputs information about PHP, you can simply upload Pico (with the .htaccess which doesn't give you errors) and you should be ready to go. Maybe you're required to make the info.php (and Pico's index.php) executable (755 permissions).

Otherwise the webserver isn't configured to execute PHP files automatically. You're then required to add AddHandler fcgi-php-fpm .php or AddType application/x-httpd-php .php or something similar to your .htaccess. Unfortunately we can't give you more detail about this, it is completely up to your webserver's configuration and you have to ask your admin about what the right configuration is.

Tip: FTP clients (like e.g. FileZilla) usually allow to change file permissions (i.e. chmod) with a context menu. There even exist FTP clients for Android & iOS. :wink:

randombitsofcode commented 8 years ago

Yeah since I'm working on borrowed computers right now I can't actually install an sftp client, but I've managed with the clients I'm using on my phone thus far.

phpinfo worked, and it tells me they're using php 5.2.11, whereas pico says it won't work on less than 5.3. Is that a hard requirement?

PhrozenByte commented 8 years ago

I'm afraid PHP 5.3 is a hard requirement. PHP 5.2 is ancient and hasn't received security updates for more than five (!) years... :unamused: