Hi, Having completely failed to sort out my apache 500 error, I thought I would work through the "Rolling with Ruby on Rails" tutorial at http://www.onlamp.com/pub/a/onlamp/2005/01/20/rails.html I am using webrick, not apache - and still getting 500 errors. When I get to page 4 where http://127.0.0.1:3000/recipe/new should give me a data entry screen, instead I get... ActiveRecord::StatementInvalid in Recipe#index Packets out of order: 1<>3: SELECT * FROM recipes script/server:49 The top few lines of the trace are d:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.5.1/lib/active_record/conne ction_adapters/abstract_adapter.rb:384:in `log'' d:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.5.1/lib/active_record/conne ction_adapters/mysql_adapter.rb:132:in `select'' d:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.5.1/lib/active_record/conne ction_adapters/mysql_adapter.rb:44:in `select_all'' d:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.5.1/lib/active_record/base. rb:328:in `find_by_sql'' d:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.5.1/lib/active_record/base. rb:321:in `find_all'' d:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.3.1/lib/action_controller/sca ffolding.rb:103:in `list'' d:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.3.1/lib/action_controller/sca ffolding.rb:96:in `index'' The webrick log contains 127.0.0.1 - - [22/Jan/2005:22:14:50 GMT Standard Time] "GET /recipe/new HTTP/1.1" 500 5099 http://www.onlamp.com/pub/a/onlamp/2005/01/20/rails.html?page=3 -> recipe/new 127.0.0.1 - - [22/Jan/2005:22:15:14 GMT Standard Time] "GET /Recipe HTTP/1.1" 500 5079 - -> /Recipe So I have shown that the 500 error is nothing to do with apache! Help most gratefully received. Thanks Ian -- If you practise error, you do error. If you practice perfectly, you will become perfect. You can''t correct the fast. You can speed up the correct. MM
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Ian Hobson wrote:> ActiveRecord::StatementInvalid in Recipe#index > > Packets out of order: 1<>3: SELECT * FROM recipes > > script/server:49Here''s a guess: you''re running a MySQL 4.1 server, but using old-style password hashing. See http://dev.mysql.com/doc/mysql/en/old-client.html The pure-Ruby MySQL bindings included with Rails only support new-style passwords if you''re using version 4.1+ If this is the case, you have several options: - update your passwords for MySQL 4.1, - use the C bindings which seem to work fine (gem install mysql), - downgrade MySQL to the 4.0 series, or - switch to SQLite! woo! jeremy -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.6 (Darwin) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFB8uRwAQHALep9HFYRAuXtAJ4mdsMwQ2pMBaqgJFgVYUk/nmSDsACffiGb O/Gx3e8YVUWW5mqERDI5NyI=OBCV -----END PGP SIGNATURE-----
In message <41F2E470.4010603-w7CzD/W5Ocjk1uMJSBkQmQ@public.gmane.org>, Jeremy Kemper <jeremy-w7CzD/W5Ocjk1uMJSBkQmQ@public.gmane.org> writes>Ian Hobson wrote: >> ActiveRecord::StatementInvalid in Recipe#index >> >> Packets out of order: 1<>3: SELECT * FROM recipes >> >> script/server:49 > >Here''s a guess: you''re running a MySQL 4.1 server, but using old-style >password hashing. See http://dev.mysql.com/doc/mysql/en/old-client.html >The pure-Ruby MySQL bindings included with Rails only support new-style >passwords if you''re using version 4.1+ > >If this is the case, you have several options: > - update your passwords for MySQL 4.1, > - use the C bindings which seem to work fine (gem install mysql), > - downgrade MySQL to the 4.0 series, or > - switch to SQLite! woo! >Hi Jeremy, Thanks for the input. I am indeed running mysql 4.1, but I thought I had fixed the password problem by setting the password to password_old(''pass''). I''ve tried --old-passwords parameter (by putting old_passwords in mysql.ini) but that has no effect (I did restart mysql). I tried gem install mysql, and that crashed.... ERROR: Failed to build gem native extension. Gem files will remain installed in d:/ruby/lib/ruby/gems/1.8/gems/mysql-2.5.1 for inspection. ruby extconf.rb install mysql\nchecking for mysql_query() in mysqlclient.lib... no checking for main() in m.lib... yes checking for mysql_query() in mysqlclient.lib... no checking for main() in z.lib... no checking for mysql_query() in mysqlclient.lib... no checking for main() in socket.lib... no checking for mysql_query() in mysqlclient.lib... no checking for main() in nsl.lib... no checking for mysql_query() in mysqlclient.lib... no Although I am only using mysql on this machine for testing rails, I use it quite a lot on various web sites, so I want to avoid sqlite, to avoid compatibility issues (even when you try to avoid them, they still bite). So it looks like downgrading to 4.0 Lets hope that solves it! Regards Ian>jeremy >_______________________________________________ >Rails mailing list >Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >http://lists.rubyonrails.org/mailman/listinfo/rails >-- If you practise error, you do error. If you practice perfectly, you will become perfect. You can''t correct the fast. You can speed up the correct. MM
I had the same problem, but it appears that my old password style was reset using the following command line: mysqladmin -u root -h localhost --password password "mypassword" -[s] On Jan 22, 2005, at 8:11 PM, Ian Hobson wrote:> In message <41F2E470.4010603-w7CzD/W5Ocjk1uMJSBkQmQ@public.gmane.org>, Jeremy Kemper > <jeremy-w7CzD/W5Ocjk1uMJSBkQmQ@public.gmane.org> writes >> Ian Hobson wrote: >>> ActiveRecord::StatementInvalid in Recipe#index >>> >>> Packets out of order: 1<>3: SELECT * FROM recipes >>> >>> script/server:49 >> >> Here''s a guess: you''re running a MySQL 4.1 server, but using >> old-style >> password hashing. See >> http://dev.mysql.com/doc/mysql/en/old-client.html >> The pure-Ruby MySQL bindings included with Rails only support >> new-style >> passwords if you''re using version 4.1+ >> >> If this is the case, you have several options: >> - update your passwords for MySQL 4.1, >> - use the C bindings which seem to work fine (gem install mysql), >> - downgrade MySQL to the 4.0 series, or >> - switch to SQLite! woo! >> > Hi Jeremy, > > Thanks for the input. I am indeed running mysql 4.1, but I thought I > had fixed the password problem by setting the password to > password_old(''pass''). > > I''ve tried --old-passwords parameter (by putting old_passwords in > mysql.ini) but that has no effect (I did restart mysql). > > I tried gem install mysql, and that crashed.... > > ERROR: Failed to build gem native extension. > Gem files will remain installed in > d:/ruby/lib/ruby/gems/1.8/gems/mysql-2.5.1 for inspection. > ruby extconf.rb install mysql\nchecking for mysql_query() in > mysqlclient.lib... no > checking for main() in m.lib... yes > checking for mysql_query() in mysqlclient.lib... no > checking for main() in z.lib... no > checking for mysql_query() in mysqlclient.lib... no > checking for main() in socket.lib... no > checking for mysql_query() in mysqlclient.lib... no > checking for main() in nsl.lib... no > checking for mysql_query() in mysqlclient.lib... no > > > > Although I am only using mysql on this machine for testing rails, I > use it quite a lot on various web sites, so I want to avoid sqlite, to > avoid compatibility issues (even when you try to avoid them, they > still bite). > > So it looks like downgrading to 4.0 > > Lets hope that solves it! > > Regards > > Ian > >> jeremy >> _______________________________________________ >> Rails mailing list >> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >> http://lists.rubyonrails.org/mailman/listinfo/rails >> > > -- > If you practise error, you do error. If you practice perfectly, you > will become perfect. > You can''t correct the fast. You can speed up the correct. > MM > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
spiros antonopoulos wrote:> > I had the same problem, but it appears that my old password style was > reset using the following command line: > > mysqladmin -u root -h localhost --password password "mypassword" > > -[s] > > On Jan 22, 2005, at 8:11 PM, Ian Hobson wrote:Holy cow this solved the same problem I was having. Thanks!
I''ve made some progress since last time. To recap - I want to get rails working in an apache virtual host. Using webrick, rails appears to work...... rails:3000 gives me the _doc/index.html file (modified so I know which one I am getting! lrails:300/Recipe gives me a list of my recipes Woo Hoo!..... rails is, at least probably, OK. Using apache http://rails/ gives me the same _doc/index.html file as via webrick but http://rails/Recipe gives me a 500 error. The apache log contains [Mon Jan 24 03:07:14 2005] [error] [client 192.168.0.15] Premature end of script headers: dispatch.cgi [Mon Jan 24 03:07:14 2005] [error] [client 192.168.0.15] D:/ruby/lib/ruby/gems/1.8/gems/rubyzip-0.5.5/./zip/zip.rb:11: warning: already initialized constant Tempfile\r [Mon Jan 24 03:07:14 2005] [error] [client 192.168.0.15] D:/ruby/lib/ruby/1.8/pstore.rb:25:in `initialize'': directory /tmp does not exist (PStore::Error)\r [Mon Jan 24 03:07:14 2005] [error] [client 192.168.0.15] \tfrom D:/ruby/lib/ruby/1.8/cgi/session/pstore.rb:72:in `new''\r [Mon Jan 24 03:07:14 2005] [error] [client 192.168.0.15] \tfrom D:/ruby/lib/ruby/1.8/cgi/session/pstore.rb:72:in `initialize''\r [Mon Jan 24 03:07:14 2005] [error] [client 192.168.0.15] \tfrom D:/ruby/lib/ruby/1.8/cgi/session.rb:264:in `new''\r [Mon Jan 24 03:07:14 2005] [error] [client 192.168.0.15] \tfrom D:/ruby/lib/ruby/1.8/cgi/session.rb:264:in `initialize''\r [Mon Jan 24 03:07:14 2005] [error] [client 192.168.0.15] \tfrom D:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.3.1/lib/action_controller/cgi _process.rb:71:in `new''\r [Mon Jan 24 03:07:14 2005] [error] [client 192.168.0.15] \tfrom D:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.3.1/lib/action_controller/cgi _process.rb:71:in `session''\r [Mon Jan 24 03:07:14 2005] [error] [client 192.168.0.15] \tfrom D:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.3.1/lib/action_controller/bas e.rb:577:in `assign_shortcuts''\r [Mon Jan 24 03:07:14 2005] [error] [client 192.168.0.15] \tfrom D:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.3.1/lib/action_controller/bas e.rb:259:in `process''\r [Mon Jan 24 03:07:14 2005] [error] [client 192.168.0.15] \tfrom D:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.3.1/lib/action_controller/res cue.rb:20:in `process_with_exception''\r [Mon Jan 24 03:07:14 2005] [error] [client 192.168.0.15] \tfrom D:/ruby/lib/ruby/gems/1.8/gems/rails-0.9.4.1/lib/dispatcher.rb:42:in `dispatch''\r [Mon Jan 24 03:07:14 2005] [error] [client 192.168.0.15] \tfrom D:/dev/blog/public/dispatch.cgi:10\r [Mon Jan 24 03:07:14 2005] [error] [client 192.168.0.15] File does not exist: D:/dev/blog/public/favicon.ico Which of these are important, and what do they mean? Thanks for any help. Ian
* Ian Hobson (Ian-1i7dRvFgrf+SE57U5PDhIQ@public.gmane.org) [050123 22:24]:> but http://rails/Recipe gives me a 500 error. > > The apache log contains > > [Mon Jan 24 03:07:14 2005] [error] [client 192.168.0.15] Premature end > of script headers: dispatch.cgi > [Mon Jan 24 03:07:14 2005] [error] [client 192.168.0.15] > D:/ruby/lib/ruby/gems/1.8/gems/rubyzip-0.5.5/./zip/zip.rb:11: warning: > already initialized constant Tempfile\r > [Mon Jan 24 03:07:14 2005] [error] [client 192.168.0.15] > D:/ruby/lib/ruby/1.8/pstore.rb:25:in `initialize'': directory /tmp does > not exist (PStore::Error)\r > [Mon Jan 24 03:07:14 2005] [error] [client 192.168.0.15] \tfrom > D:/ruby/lib/ruby/1.8/cgi/session/pstore.rb:72:in `new''\r > [Mon Jan 24 03:07:14 2005] [error] [client 192.168.0.15] \tfrom > D:/ruby/lib/ruby/1.8/cgi/session/pstore.rb:72:in `initialize''\r > [Mon Jan 24 03:07:14 2005] [error] [client 192.168.0.15] \tfrom > D:/ruby/lib/ruby/1.8/cgi/session.rb:264:in `new''\r > [Mon Jan 24 03:07:14 2005] [error] [client 192.168.0.15] \tfrom > D:/ruby/lib/ruby/1.8/cgi/session.rb:264:in `initialize''\r > [Mon Jan 24 03:07:14 2005] [error] [client 192.168.0.15] \tfrom > D:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.3.1/lib/action_controller/cgi > _process.rb:71:in `new''\r > [Mon Jan 24 03:07:14 2005] [error] [client 192.168.0.15] \tfrom > D:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.3.1/lib/action_controller/cgi > _process.rb:71:in `session''\r > [Mon Jan 24 03:07:14 2005] [error] [client 192.168.0.15] \tfrom > D:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.3.1/lib/action_controller/bas > e.rb:577:in `assign_shortcuts''\r > [Mon Jan 24 03:07:14 2005] [error] [client 192.168.0.15] \tfrom > D:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.3.1/lib/action_controller/bas > e.rb:259:in `process''\r > [Mon Jan 24 03:07:14 2005] [error] [client 192.168.0.15] \tfrom > D:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.3.1/lib/action_controller/res > cue.rb:20:in `process_with_exception''\r > [Mon Jan 24 03:07:14 2005] [error] [client 192.168.0.15] \tfrom > D:/ruby/lib/ruby/gems/1.8/gems/rails-0.9.4.1/lib/dispatcher.rb:42:in > `dispatch''\r > [Mon Jan 24 03:07:14 2005] [error] [client 192.168.0.15] \tfrom > D:/dev/blog/public/dispatch.cgi:10\r > [Mon Jan 24 03:07:14 2005] [error] [client 192.168.0.15] File does not > exist: D:/dev/blog/public/favicon.ico > > Which of these are important, and what do they mean?The one saying /tmp doesn''t exist (from Pstore) is probably the most important. Not sure (since I don''t use Windows) what the easiest way is around that. I would probably try "mkdir c:\tmp\" and see if that made things happy. Probably the better way in general is to have Pstore point to somewhere more reasonable on your system, but I don''t know off the top of my head how to config that. Rick -- http://www.rickbradley.com MUPRN: 18 | configuration, random email haiku | and have had the same problem | as you with Speakfreely.