On Wed, 17 Jun 2020 at 22:19, Craig Russell <apache....@gmail.com> wrote:
>
> I edited /etc/apache2/httpd.conf and added this:
> SetEnv PATH 
> /usr/local/opt/ruby/bin:/usr/local/lib/ruby/gems/2.7.0/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
>
> I restarted the server via:
> sudo apachectl restart
>
> But localhost/officers/test.cgi still showed:
> PATH /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
> Is there something else I can do to affect PATH?

Try seeing if the SetEnv is being processed at all.

Add another SetEnv which is unlikely to be overridden, e.g.

SetEnv XYZABC 123

and see if that appears in the test.cgi

> Craig
>
> > On Jun 17, 2020, at 12:37 PM, sebb <seb...@gmail.com> wrote:
> >
> > You should also be able to change the path in httpd.conf
> >
> > SetEnv PATH ...:${PATH}
> >
> >
> > On Wed, 17 Jun 2020 at 20:20, Craig Russell <apache....@gmail.com> wrote:
> >>
> >>
> >>
> >>> On Jun 17, 2020, at 11:43 AM, Sam Ruby <ru...@intertwingly.net> wrote:
> >>>
> >>> You are getting close, and this problem I can fully explain.
> >>>
> >>> Prior stack traces indicated that you were running Ruby 2.7
> >>> (presumably from homebrew?).  This stack trace indicates that you are
> >>> running Ruby 2.3 (the system installed Ruby).
> >>>
> >>> Each version of Ruby has its own set of installed Gems.  The fact that
> >>> you can get the board agenda tool up and running indicates that you
> >>> have a complete set of gems installed with Ruby 2.7.
> >>>
> >>> If you look at the top line of any CGI file, it says "#!/usr/bin/env
> >>> ruby".  This will load the Ruby interpreter based on your PATH
> >>> environment variable.
> >>>
> >>> You should be able to control the value of the PATH environment
> >>> variable by adding a <key> / <string> pair to the
> >>> <key>EnvironmentVariables</key> <dict> entry in
> >>> /System/Library/LaunchDaemons/org.apache.httpd.plist, and then
> >>> restarting httpd.  This sounds complicated, but it will make sense
> >>> when you look at the contents of that file.
> >>
> >> I cannot edit that file. By design, it's protected by Apple. One 
> >> suggestion is to do:
> >>> Just create your own plist in /Library/LauchDaemons that contains the 
> >>> changes you need. Load that plist instead of the System LaunchDaemon. 
> >>> Once created, you will need to change the owner:group to root:wheel an 
> >>> the same permissions as on the original.
> >>
> >>
> >> So is there some way to tell the launch daemon to use a different plist?
> >>
> >> My PATH is set up with 
> >> /usr/local/opt/ruby/bin:/usr/local/lib/ruby/gems/2.7.0/bin as the first 
> >> few lines.
> >> [MacBook-Pro-10:~/apache/git/whimsy] clr% which ruby
> >> /usr/local/opt/ruby/bin/ruby
> >> [MacBook-Pro-10:~/apache/git/whimsy] clr% ruby -v
> >> ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [x86_64-darwin18]
> >>
> >> So why doesn't whimsy find Ruby 2.7? Because localhost/test.cgi has this:
> >> PATH /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
> >> Where did that come from?
> >>>
> >>> The main whimsy menu is static HTML, so no Ruby code is run.
> >>>
> >>> test.cgi doesn't depend on much, and can run with Ruby 2.3, so it also 
> >>> works.
> >>>
> >>> members/proxy does depend on a number of gems, and those gems are not
> >>> installed using Ruby 2.3 on your machine.
> >>>
> >>> You could get past this immediate problem by installing those gems
> >>> under Ruby 2.3, but I suspect that you will be a lot happier using the
> >>> same version of Ruby everywhere.
> >>>
> >>> Once you have set your path, you can verify it visiting
> >>> http://whimsy.local/test.cgi and looking for the value of PATH.  If
> >>> you add anything to the query part of the URL (for example, by
> >>> visiting http://whimsy.local/test.cgi?help) you will see considerably
> >>> more information, such as the actual version of Ruby used, your gem
> >>> path, etc.
> >>>
> >>> Once you are running CGI scripts using Ruby 2.7, I suspect that
> >>> members/proxy.cgi will work as you have the necessary gems installed.
> >>>
> >>> And finally, the reason passenger applications work is that the
> >>> version of Ruby to be used for passenger applications is specified in
> >>> /etc/apache2/other/passenger.conf.
> >>>
> >>> - Sam Ruby
> >>>
> >>> On Wed, Jun 17, 2020 at 1:59 PM Craig Russell <apache....@gmail.com> 
> >>> wrote:
> >>>>
> >>>> Deleting that file solved the issue with board/agenda. It now works.
> >>>>
> >>>> And I can reliably get the whimsy main page and officers/test.cgi and 
> >>>> members/test.cgi to work.
> >>>>
> >>>> But http://localhost/members/proxy.cgi gives me an error 500 page. In 
> >>>> the httpd log:
> >>>> [Wed Jun 17 10:40:57.734041 2020] [cgi:error] [pid 55728] [client 
> >>>> 127.0.0.1:58309] AH01215: 
> >>>> /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in
> >>>>  `require': cannot load such file -- wunderbar (LoadError): 
> >>>> /srv/whimsy/www/members/proxy.cgi
> >>>> [Wed Jun 17 10:40:57.734156 2020] [cgi:error] [pid 55728] [client 
> >>>> 127.0.0.1:58309] AH01215: \tfrom 
> >>>> /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in
> >>>>  `require': /srv/whimsy/www/members/proxy.cgi
> >>>>
> >>>> I looked in my local /srv/whimsy/www/members:
> >>>> [MacBook-Pro-10:~/apache/git/whimsy] clr% ls -l 
> >>>> /srv/whimsy/www/members/proxy.cgi
> >>>> -rwxr-xr-x@ 1 clr  staff  10789 Jun 14 14:39 
> >>>> /srv/whimsy/www/members/proxy.cgi
> >>>>
> >>>> This is consistent with the above:
> >>>> [MacBook-Pro-10:~/apache/git/whimsy] clr% ls -l 
> >>>> /srv/whimsy/www/officers/index.cgi
> >>>> -rwxr-xr-x  1 clr  staff  2272 Apr 20 11:01 
> >>>> /srv/whimsy/www/officers/index.cgi
> >>>>
> >>>> Trying to  load the "useful officer tools" using either 
> >>>> localhost/officers/index.cgi or localhost/officers which then goes to 
> >>>> index.cgi which exists in the local /srv repository...
> >>>>
> >>>> [Wed Jun 17 10:51:15.819032 2020] [:debug] [pid 55727] 
> >>>> mod_hfs_apple2.c(384): [client 127.0.0.1:58401] mod_hfs_apple: Final 
> >>>> check compares: /srv/whimsy/www/officers/index.cgi vs 
> >>>> /srv/whimsy/www/officers/, length 24
> >>>> [Wed Jun 17 10:51:15.819050 2020] [:debug] [pid 55727] 
> >>>> mod_hfs_apple2.c(397): [client 127.0.0.1:58401] mod_hfs_apple: Allowing 
> >>>> access with matching directory. filename = 
> >>>> /srv/whimsy/www/officers/index.cgi
> >>>> [Wed Jun 17 10:51:15.956428 2020] [cgi:error] [pid 55727] [client 
> >>>> 127.0.0.1:58401] AH01215: 
> >>>> /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in
> >>>>  `require': cannot load such file -- wunderbar (LoadError): 
> >>>> /srv/whimsy/www/officers/index.cgi
> >>>> [Wed Jun 17 10:51:15.956557 2020] [cgi:error] [pid 55727] [client 
> >>>> 127.0.0.1:58401] AH01215: \tfrom 
> >>>> /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in
> >>>>  `require': /srv/whimsy/www/officers/index.cgi
> >>>> [Wed Jun 17 10:51:15.956608 2020] [cgi:error] [pid 55727] [client 
> >>>> 127.0.0.1:58401] AH01215: \tfrom 
> >>>> /Users/clr/apache/git/whimsy/lib/whimsy/asf/ldap.rb:34:in `<top 
> >>>> (required)>': /srv/whimsy/www/officers/index.cgi
> >>>> [Wed Jun 17 10:51:15.956646 2020] [cgi:error] [pid 55727] [client 
> >>>> 127.0.0.1:58401] AH01215: \tfrom /srv/whimsy/lib/whimsy/asf.rb:3:in 
> >>>> `require_relative': /srv/whimsy/www/officers/index.cgi
> >>>> [Wed Jun 17 10:51:15.956682 2020] [cgi:error] [pid 55727] [client 
> >>>> 127.0.0.1:58401] AH01215: \tfrom /srv/whimsy/lib/whimsy/asf.rb:3:in 
> >>>> `<top (required)>': /srv/whimsy/www/officers/index.cgi
> >>>> [Wed Jun 17 10:51:15.956760 2020] [cgi:error] [pid 55727] [client 
> >>>> 127.0.0.1:58401] AH01215: \tfrom 
> >>>> /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in
> >>>>  `require': /srv/whimsy/www/officers/index.cgi
> >>>> [Wed Jun 17 10:51:15.956831 2020] [cgi:error] [pid 55727] [client 
> >>>> 127.0.0.1:58401] AH01215: \tfrom 
> >>>> /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in
> >>>>  `require': /srv/whimsy/www/officers/index.cgi
> >>>> [Wed Jun 17 10:51:15.956864 2020] [cgi:error] [pid 55727] [client 
> >>>> 127.0.0.1:58401] AH01215: \tfrom /srv/whimsy/www/officers/index.cgi:6:in 
> >>>> `<main>': /srv/whimsy/www/officers/index.cgi
> >>>> [Wed Jun 17 10:51:15.960403 2020] [cgi:error] [pid 55727] [client 
> >>>> 127.0.0.1:58401] End of script output before headers: index.cgi
> >>>> [Wed Jun 17 10:51:15.960633 2020] [authz_core:debug] [pid 55727] 
> >>>> mod_authz_core.c(817): [client 127.0.0.1:58401] AH01626: authorization 
> >>>> result of Require all granted: granted
> >>>> [Wed Jun 17 10:51:15.960657 2020] [authz_core:debug] [pid 55727] 
> >>>> mod_authz_core.c(817): [client 127.0.0.1:58401] AH01626: authorization 
> >>>> result of <RequireAny>: granted
> >>>> [Wed Jun 17 10:51:15.960785 2020] [:debug] [pid 55727] 
> >>>> mod_hfs_apple2.c(363): [client 127.0.0.1:58401] mod_hfs_apple: 
> >>>> compare_paths / vs /srv/whimsy/www/500.html/, related=1
> >>>>
> >>>>> On Jun 17, 2020, at 10:13 AM, Sam Ruby <ru...@intertwingly.net> wrote:
> >>>>>
> >>>>> On Wed, Jun 17, 2020 at 12:53 PM Craig Russell <apache....@gmail.com> 
> >>>>> wrote:
> >>>>>>
> >>>>>> It looks like there is some problem with Passenger. IIRC the only way 
> >>>>>> I have used Passenger is with Whimsy.
> >>>>>
> >>>>> [snip lots of scary warnings]
> >>>>>>
> >>>>>> App 55090 output:  [passenger_native_support.bundle] will not be used 
> >>>>>> (can't compile or download)
> >>>>>> App 55090 output:   --> Passenger will still operate normally.
> >>>>>> App 55090 output: Error: The application encountered the following 
> >>>>>> error: Permission denied @ rb_sysopen - /Users/clr/.whimsy 
> >>>>>> (Errno::EACCES)
> >>>>>
> >>>>> Try changing permissions, or deleting or renaming that file temporarily.
> >>>>>
> >>>>> - Sam Ruby
> >>>>
> >>>> Craig L Russell
> >>>> c...@apache.org
> >>>>
> >>
> >> Craig L Russell
> >> c...@apache.org
> >>
>
> Craig L Russell
> c...@apache.org
>

Reply via email to