Hi, Hopefully someone can help me. I am struggling to get fastcgi and mysql to work on a Windows box. I have successfully built a little sample app and its runs fine with webrick. Using it with Apache and fastcgi on Windows is another story. This is what I installed: 1. The Xampp install of Apache 2.0 2. The one click installer of the apache/ruby integration package Via apache/fastcgi I can access controllers that do not interact with my mysql database, however as soon as I access a database I get this error: NameError in Entries#index uninitialized constant Mysql |/app/controllers/entries_controller.rb:8:in `list'' /app/controllers/entries_controller.rb:3:in `index''| Show framework trace <http://rails:4000/entries#> |C:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.1.1/lib/active_support/dependencies.rb:186:in `const_missing'' C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/active_record/connection_adapters/mysql_adapter.rb:37:in `mysql_connection'' C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/active_record/query_cache.rb:52:in `send'' C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/active_record/query_cache.rb:52:in `connection='' C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/active_record/connection_adapters/abstract_adapter.rb:108:in `retrieve_connection'' C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/active_record/base.rb:239:in `connection'' C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/active_record/base.rb:461:in `count_by_sql'' C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/active_record/base.rb:454:in `count'' C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/pagination.rb:154:in `count_collection_for_pagination'' C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/pagination.rb:171:in `paginator_and_collection_for'' C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/pagination.rb:111:in `paginate'' C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/base.rb:756:in `send'' C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/base.rb:756:in `perform_action_without_filters'' C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/filters.rb:295:in `perform_action_without_benchmark'' C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/benchmarking.rb:41:in `perform_action_without_rescue'' C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/benchmarking.rb:41:in `measure'' C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/benchmarking.rb:41:in `perform_action_without_rescue'' C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/rescue.rb:80:in `perform_action'' C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/base.rb:356:in `send'' C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.9.1/lib/action_controller/base.rb:356:in `process'' C:/ruby/lib/ruby/gems/1.8/gems/rails-0.13.1/lib/dispatcher.rb:32:in `dispatch'' C:/ruby/lib/ruby/gems/1.8/gems/rails-0.13.1/lib/fcgi_handler.rb:144:in `process_request'' C:/ruby/lib/ruby/gems/1.8/gems/rails-0.13.1/lib/fcgi_handler.rb:64:in `process!'' C:/ruby/lib/ruby/gems/1.8/gems/rails-0.13.1/lib/fcgi_handler.rb:55:in `each_cgi'' C:/ruby/lib/ruby/site_ruby/1.8/fcgi.rb:595:in `each'' C:/ruby/lib/ruby/site_ruby/1.8/fcgi.rb:595:in `each_cgi'' C:/ruby/lib/ruby/gems/1.8/gems/rails-0.13.1/lib/fcgi_handler.rb:55:in `process!'' C:/ruby/lib/ruby/gems/1.8/gems/rails-0.13.1/lib/fcgi_handler.rb:21:in `process!'' C:/home/scott/projects/railssandbox/public/dispatch.fcgi:24| |This error occured while loading the following files: mysql.rb My question is why??? Why should apache/fastcgi have anything to do with wether or not mysql functionality works or not? Since apache/fastcgi is using the same instance of ruby as my webrick deployment. I am starting to pull out my hair in frustration. Any helpl would be greatly appreciated scott. | -- Scott F. Walter Scott F. Walter Principal Consultant Vivare, Inc. E: scott.walter-uosFFu51klvQT0dZR+AlfA@public.gmane.org E: scott-APWf0AbNa2kIjDr1QQGPvw@public.gmane.org Visit scottwalter.com <http://scottwalter.com> --Point. Click. Explore!
On 8/22/05, Scott F. Walter <scott.walter-uosFFu51klvQT0dZR+AlfA@public.gmane.org> wrote: <snip/>> Via apache/fastcgi I can access controllers that do not interact with my > mysql database, however as soon as I access a database I get this error:<snip/>> uninitialized constant MysqlI believe this is due to an error in the native ruby-mysql module for windows, most windows fcgi tutorials are recommending that you don''t include this module. Uninstall Ruby for Apache then reinstall only including the mod_fcgi and it should work. Josh
Scott F. Walter wrote:> Hi, > > Hopefully someone can help me. I am struggling to get fastcgi and mysql > to work on a Windows box. I have successfully built a little sample app > and its runs fine with webrick. Using it with Apache and fastcgi on > Windows is another story. > > This is what I installed: > > 1. The Xampp install of Apache 2.0 > 2. The one click installer of the apache/ruby integration package > > Via apache/fastcgi I can access controllers that do not interact with my > mysql database, however as soon as I access a database I get this error: > > > NameError in Entries#index > > uninitialized constant MysqlI had the same problem and finally diagnosed it after a full day of configuration wrestling, so here it goes. The problem is that none (ZERO) of the environment variables that are defined either in machine-level or user-level are passed onto the FastCGI server process. This includes the RAILS_ENV, PATH and RUBYOPT variables. And then, what happens is that most native extensions rely on some .DLL that are located within one or more directories that are in the PATH, such as windows\system32 and others. And when executed inside the FastCGI process, the native extensions fail because they can''t find the DLLs anymore. You''ll face the same trouble if you try to use RMagick or Iconv, etc. So, what I had to do to solve this problem was by adding the proper ''-initial-env'' values to the FastCgiConfig directive in the Apache''s httpd.conf. Mine looks like this: FastCgiConfig -maxClassProcesses 1 -maxProcesses 1 -minProcesses 1 -processSlack 1 -initial-env PATH="c:/ruby/bin;c:/windows/system32;c:/windows;c:/windows/System32/Wbem;c:/cygwin/bin;C:/mysql/bin;C:/Progra~1/Common~1/GTK/2.0/bin" -initial-env RUBYOPT=rubygems -initial-env MAGICK_CONFIGURE_PATH=c:/ruby/lib/ruby/gems/1.8/gems/RMagick-win32-1.7.0-mswin32/config Now everythings works! Hope it helps. (Don''t even bother trying to do this using SetEnv directive, it just won''t work at all) Cheers, Demetrius -- http://dema.ruby.com.br - Rails from a .NET perspective