Project

General

Profile

Install in webhosting env.: Application error (500)

Added by Dennis H about 13 years ago

Hi everyone,

I am trying to get redmine 1.1.0 running on a managed virtual server (Hosteurope) with local installation of rubygems and rails in my $HOME.

> ruby -v
ruby 1.8.7 (2008-08-11 patchlevel 72) [i486-linux]

> rails -v
Rails 2.3.5

> uname -a
Linux vwpXXXX 2.6.18.8-xenU-static-i686-uk9 #3 SMP Wed Apr 9 10:51:41 CEST 2008 i686 GNU/Linux

> mysql --version
mysql  Ver 14.14 Distrib 5.1.49, for debian-linux-gnu (i486) using readline 5.2

> gem list

*** LOCAL GEMS ***

actionmailer (2.3.5)
actionpack (2.3.5)
activerecord (2.3.5)
activeresource (2.3.5)
activesupport (2.3.5)
i18n (0.4.2)
rack (1.0.1)
rails (2.3.5)
rake (0.8.7)

> RAILS_ENV=production script/about
/is/htdocs/wpXXXXXXX_VFXKMFEPBB/rm.my-domain.com/config/../vendor/rails/railties/
lib/rails/gem_dependency.rb:119:Warning: Gem::Dependency#version_requirements is 
deprecated and will be removed on or after August 2010.  Use #requirement
About your application's environment
Ruby version              1.8.7 (i486-linux)
RubyGems version          1.4.1
Rack version              1.0
Rails version             2.3.5
Active Record version     2.3.5
Active Resource version   2.3.5
Action Mailer version     2.3.5
Active Support version    2.3.5
Edge Rails revision       unknown
Application root          /is/htdocs/wpXXXXXXX_VFXKMFEPBB/rm.my-domain.com
Environment               production
Database adapter          mysql
Database schema version   20101114115359

Important notice: WEBrick works and I can open rm.my-domain.com:3001, login and work with redmine!

Running it through apache produces the 500 error. In "additional_environment.rb" I set the debug level to "info". But there are no entries when accessing through apache.

To me it looks like there is a problem with the CGI? I cannot use FCGI as it is not installed on my machine. The worst thing is, I don't know where the "error_log" is located and I basically don't have any permissions outside home and I don't have a clue what actually happens there.

Does anybody of you guys have an idea on this or already tried this in a similar environment? I'd appreciate your help.

Dennis.


Replies (6)

RE: Install in webhosting env.: Application error (500) - Added by vitaly endors about 13 years ago

Dennis,

1. It can be hard to find the help documents here, they are not well sorted or logically displayed.
But lucky for us, they exist!
You must click on Projects, then Wiki, then you will see the "*how-to*" collection on upper right.
These can be of some help to you in doing installs. For me too, I have not figured out the apache install method - it should be much simpler, but rails is not trivial to deploy apart from the webrick method. I just use webrick for now.

2. In linux, you can look in /var/log/apache or /var/log/httpd or /var/log/apache2 and try to find the web logs. These will reveal the source of many errors. It is usually fall into just a few categories if the software is not broken. You have a vps so you should have access to this.

3. The top five errors that people find with linux OSS installs (web application) seem to be:

a. Wrong permissions - you do not have read or write permissions correctly setup on necessary files. These are changed by the chmod command. You should type "man chmod" and read what it says, then use google to find a tutorial. Many install programs are very crude and do not set these permissions as required to use the software. So that is a big problem.

b. wrong ownership - the webserver is running as a certain user, but you installed the software as some other user. Thus the webserver cannot read or execute or write to your files. Maybe you installed as root but the web server (apache) is running as www-data or httpd or who knows what. You can check this by running "ps aux|less" and then looking for the words apache or httpd or apache2. ps will show you who the process runs as. You can type "chown -R webuserX:webuserX *" where webuserX is the name of the apache/httpd process owner... maybe this is not clear enough.

So you must type "man chown" and read it, then look for a tutorial on chown or group and user file ownership - usually "chown linux" will teach you some things. In the end, the problem is often that files owned by root or some owner like ftp or user1 cannot be read and used by the web server.

c. Bad paths - this is a real problem with rails and redmine, but also many other software. The program must be able to find the paths to files, and sometimes the paths are not set up correctly by default. This is usually a weakness in the developer's understanding of the end user environment, they do not know that for many users everything is a mystery! You can find your path by typing "pwd" and maybe you can see some issue with a config file or some settings. I can't help much more with this, just look at "relative paths".

Also, some complication can happen because apache has the ability to create paths in ways that don't reflect the ordinary settings. Thus you can have a web application that is not in /var/www/html/whatever but appears to be. These things are found in the apache conf files. You must search for these, because apache conf files are not obvious to beginners.

d. Incorrect webserver setup - not wrong by definition, but maybe it does not work as you or the person who wrote the installer or software expects. Sometimes this is because a distribution (debian, fedora, etc) does not agree with the method used by developers. For instance, to get ruby/rails/redmine running on debian is a bad time for beginners, as the package manager does not agree with "gem" philosophy, so extra steps must be taken to get everything to work as expected.

Or it is as simple as the default vps config is not as expected. Lucky for you, this is the least likely of your problems. You can learn some things by reading the "man apache" or "man apache2" information (tedious, but sometimes necessary) and by going in and looking at your config files in /etc/[whatever the webserver is called] to know more about it. It can be useful to strip all the commented lines from the files before viewing using "cat filename|grep -v '#' " or something. Again, this is the least likely problem!
e. Broken .htaccess files
- The .htaccess files are not correct or are not being found for any reason shown above.

In my experience, almost all web install software problems will be caused by these 5 things.
It took a long time to learn each one of these lessons! Maybe this can help you.

I am struggles here myself, but when I understand I will try to write better docs.

RE: Install in webhosting env.: Application error (500) - Added by vitaly endors about 13 years ago

I don't know why that looks wrong.

I just want to say that the errors should be in /var/log/ somewhere.
I don't know where ruby failures are logged yet.

RE: Install in webhosting env.: Application error (500) - Added by Dennis H about 13 years ago

Vitaly, thanks for your reply.

1. I saw them, but there is nothing additional I can apply to my case.
2. I mentioned this in the OP: I don't know the location of those files as I don't have permissions to read anything outside of my home directory.
3. a-b) chmod was applied to requested files. All the files belong to the same user/group which are used for the apache's www/ folder which works fine.
3. c) Webrick runs just fine -> no issues with paths. Or is this logic wrong?
3. d)-e) is where I expect the problem to be.

The redmine logs are in "log/production.rb" or similar.

Just discovered in today's 1.1.1 release notes:

Defect #7256: redmine/public/.htaccess must be moved for non-fastcgi installs/upgrades

Which .htaccess should be used then?

RE: Install in webhosting env.: Application error (500) - Added by Dennis H about 13 years ago

Some progress here. I ran "dispatch.cgi" from the command line as suggested in one of the HowTos:

$ public/dispatch.cgi
./public/../config/../vendor/rails/railties/lib/rails/gem_dependency.rb:119:Warning:
Gem::Dependency#version_requirements is deprecated and will be removed on or after 
August 2010.  Use #requirement
/is/htdocs/wpXXXXXXX_YYYYYYYY/rm.my-domain.com/vendor/rails/actionpack/lib/action_controller/cgi_process.rb:22:in `__send__': undefined method `env_table' for nil:NilClass (NoMethodError)
        from /is/htdocs/wpXXXXXXX_YYYYYYYY/rm.my-domain.com/vendor/rails/actionpack/lib/action_controller/cgi_process.rb:22:in `dispatch_cgi'
        from /is/htdocs/wpXXXXXXX_YYYYYYYY/rm.my-domain.com/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:101:in `dispatch_cgi'
        from /is/htdocs/wpXXXXXXX_YYYYYYYY/rm.my-domain.com/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:27:in `dispatch'
        from public/dispatch.cgi:12

Does not look like Content-Type: text/html; to me :)

I could change the source code on the first warning, but I am lost with the nilClass problem.

Felix, did you have some experience with Hosteurope/webhosters in particular case?

RE: Install in webhosting env.: Application error (500) - Added by Dennis H about 13 years ago

I started over with 1.1.1 release of redmine to make sure I completed all the required steps.

Following appear in my apache's error_log:

!!! The bundled mysql.rb driver has been removed from Rails 2.2. Please install the mysql gem and try again: gem install mysql.
 /usr/lib/ruby/1.8/i486-linux/mysql.so: libmysqlclient.so.15: failed to map segment from shared object: Cannot allocate memory - /usr/lib/ruby/1.8/i486-linux/mysql.so (LoadError)
 \tfrom /is/htdocs/xxx_yyy/executable/ruby/lib/rubygems/custom_require.rb:29:in `require'

As I am in a webhosting environment I cannot compile own mysql driver.

My questions is:

the Webrick method runs w/o any problems, why does above mysql problem appear via CGI and apache?

Is there a limitation to a memory allocation which I am not aware of?

RE: Install in webhosting env.: Application error (500) - Added by Dennis H about 13 years ago

I could resolve the memory issue by adding RLimitMEM to .htaccess. BTW, one should be able to edit own posts to avoid double posts like that :)

This leaves me with this final error:

/is/htdocs/wpXXXXXXX_YYYYYYYY/rm.my-domain.com/vendor/rails/actionpack/lib/action_controller/cgi_process.rb:22:in `__send__'
: 
undefined method `env_table' for nil:NilClass
(
NoMethodError
)
    from /is/htdocs/wpXXXXXXX_YYYYYYYY/rm.my-domain.com/vendor/rails/actionpack/lib/action_controller/cgi_process.rb:22:in `dispatch_cgi'
    from /is/htdocs/wpXXXXXXX_YYYYYYYY/rm.my-domain.com/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:101:in `dispatch_cgi'
    from /is/htdocs/wpXXXXXXX_YYYYYYYY/rm.my-domain.com/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:27:in `dispatch'
    from /is/htdocs/wpXXXXXXX_YYYYYYYY/rm.my-domain.com/public/dispatch.orig.cgi:10
Premature end of script headers: dispatch.cgi

    (1-6/6)