I'm past all this now and trying to fix the problem not in quotes down below, but leaving for background information.
I am trying to get a working rails development environment on my LAMP stack, so I've installed rbenv, the 2.1.2 version of ruby, the 4.1.4 version of Rails and the phusion mod for Apache. I'm now seeing very strange errors when I try to stop and start my Apache service and I think the issue is that Phusion has rebuilt the Apache installation on the machine and Apache is now looking for configuration files in
/etc/apache2/
. I'm now struggling to find out how to fix apache to look in the LAMP directories forhttpd.conf
.Here are some examples of the errors.
$ sudo service apache2 restart
* Restarting web server apache2
(98)Address already in use: AH00072: make_sock: could not bind to address [::]:80
(98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
AH00015: Unable to open logs
Action 'start' failed.
The Apache error log may have more information.
$ sudo /opt/lampp/lampp restart
Restarting XAMPP for Linux 1.8.3-4...
XAMPP: Stopping Apache...fail.
apachectl returned 1.
XAMPP: Stopping MySQL...ok.
XAMPP: Stopping ProFTPD...not running.
XAMPP: Starting Apache...already running.
XAMPP: Starting MySQL...ok.
XAMPP: Starting ProFTPD...fail.
XAMPP: Another FTP daemon is already running.
Also, this is how I've modified the config file in
/opt/lampp/etc/httpd.conf
. I know the module is supposed to be a .so file but I did not see one in my directory (didn't really spend enough time looking into this to know how to fix it, do I need to compile something?)
LoadModule passenger_module /home/moody/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/passenger-4.0.45/ext/apache2/mod_passenger.c
PassengerRoot /home/moody/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/passenger-4.0.45
PassengerRuby /home/moody/.rbenv/versions/2.1.2/bin/ruby
Server is running Ubuntu 14.04. Install order was LAMP (1.8.3-4), Ruby 1.9.3 (via apt-get), then rbenv, then ruby-build, then installed Ruby 2.1.2, then removed Ruby 1.9.3 via apt-get remove, then installed rails gems, then installed phusion for Apache and the ruby gem for phusion.
Edit 1: I found out it's actually an issue with my LoadModule file paths
I checked out the actual LAMPP script to see where the apachectl returned 1 error was coming from and it was just running /opt/lampp/bin/apachectl, so then I ran the same command
/opt/lampp/bin/apachectl -k stop
and it gave me a very descriptive error:
httpd: Syntax error on line 160 of /opt/lampp/etc/httpd.conf: Cannot load /home/moody/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/passenger-4.0.45/ext/apache2/mod_passenger.c into server: /home/moody/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/passenger-4.0.45/ext/apache2/mod_passenger.c: invalid ELF header
Commented out my lines-need to figure out how to get the appropriate .so file.
Edit 2: I ran the passenger-install-apache2-module installer and it seemed to work fine and told me the lines to add to my program (including the .so file which I was missing before)
Now I'm running into a far more confusing error that I think is related to the version of GCC that is available for ubuntu 14.04 and I can't find any resources on the internet that deal with this problem
httpd: Syntax error on line 160 of /opt/lampp/etc/httpd.conf: Cannot load /home/moody/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/passenger-4.0.45/buildout/apache2/mod_passenger.so into server: /opt/lampp/lib/libstdc++.so.6: version `GLIBCXX_3.4.9' not found (required by /home/moody/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/passenger-4.0.45/buildout/apache2/mod_passenger.so)
Saw this in another google search to see which GCC versions are available, apparently 3.4.9 isn't one of them (go figure, that's what the error says.) Any ideas on how I can remedy this?
$ strings /opt/lampp/lib/libstdc++.so.6 | grep -i glibcxx
GLIBCXX_3.4
GLIBCXX_3.4.1
GLIBCXX_3.4.2
GLIBCXX_3.4.3
GLIBCXX_3.4.4
GLIBCXX_3.4.5
GLIBCXX_3.4.6
GLIBCXX_3.4.7
GLIBCXX_3.4.8
GLIBCXX_FORCE_NEW
Edit 3: It's 6 AM and I think I figured it out at last.
I did a few searches and found this post here: /usr/lib/libstdc++.so.6: version `GLIBCXX_3.4.15' not found
And then I did a find on the root directory
find / | grep -i libstdc++.so
And used the strings command I found earlier-the libstdc++.so had GLIBCXX_3.4.9 in the directory /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.19
so I backed up the old one with mv and copied the new one to the lampp directory. Restarted the server and got no errors. Supposedly I have a working rails stack now :)
Edit 4: Welp, Phusion is working, but there's a new problem... Now when I navigate to my new virtual host (RailsEnv set to development) I get this lovely stack trace on a bunch of code I have no experience with. Seems like something's wrong with the sha1.so referencing some unknown symbol that's supposed to be in libcrypto.so.1.0.0. What the heck is link time reference?
Interestingly, if I just navigate to the application folder and do rails server, I can see the application without issue. Does the application need to be generated? (i.e. call rails generate)?
/home/moody/.rbenv/versions/2.1.2/lib/ruby/2.1.0/x86_64-linux/digest/sha1.so: symbol SHA1_Init, version OPENSSL_1.0.0 not defined in file libcrypto.so.1.0.0 with link time reference - /home/moody/.rbenv/versions/2.1.2/lib/ruby/2.1.0/x86_64-linux/digest/sha1.so (LoadError)
/home/moody/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
/home/moody/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
/home/moody/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/bundler-1.6.3/lib/bundler/definition.rb:1:in `<top (required)>'
/home/moody/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/bundler-1.6.3/lib/bundler.rb:153:in `definition'
/home/moody/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/bundler-1.6.3/lib/bundler.rb:116:in `setup'
/home/moody/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/bundler-1.6.3/lib/bundler/setup.rb:17:in `<top (required)>'
/home/moody/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:135:in `require'
/home/moody/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:135:in `rescue in require'
/home/moody/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:144:in `require'
/home/moody/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/passenger-4.0.45/lib/phusion_passenger/loader_shared_helpers.rb:258:in `block in run_load_path_setup_code'
/home/moody/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/passenger-4.0.45/lib/phusion_passenger/loader_shared_helpers.rb:361:in `running_bundler'
/home/moody/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/passenger-4.0.45/lib/phusion_passenger/loader_shared_helpers.rb:256:in `run_load_path_setup_code'
/home/moody/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/passenger-4.0.45/helper-scripts/rack-preloader.rb:100:in `preload_app'
/home/moody/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/passenger-4.0.45/helper-scripts/rack-preloader.rb:158:in `<module:App>'
/home/moody/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/passenger-4.0.45/helper-scripts/rack-preloader.rb:29:in `<module:PhusionPassenger>'
/home/moody/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/passenger-4.0.45/helper-scripts/rack-preloader.rb:28:in `<main>'