Why is not apache2ctl on OSX? - macos

I'm trying run some server script which is using there lines:
#!/bin/bash
# ...
export APACHE_CONFDIR=$SOME_DIR
/usr/sbin/apache2ctl start
But it doesn't works, because I have 'apachectl'. After change it works but not in $SOME_DIR directory.

Because they never had an ambiguity due to installing both Apache 1.3 and Apache 2.x on the same operating system. "apache2" is a debian-ism.

Related

Installing Glassfish, Wildfly using homebrew on Mac OSX

Trying to install Glassfish(Java EE App. Server) and Wildfly App Server using Homebrew .
http://macappstore.org/wildfly-as/
http://macappstore.org/glassfish/
used these above mentioned tutorials .
I got the following errors while trying to run them by typing just "glassfish" & "wildfly-as" respectively.
Output(Error):
-bash: glassfish: command not found
-bash: wildfly-as: command not found
Searched about it and I think it has something to do with $PATH. I don't understand $PATH Variable . Need help.
The issue is that there are two asadmin scripts. One at $GLASSFISH_HOME/bin and one at $GLASSFISH_HOME/glassfish/bin
Here are full instructions to get your domain up
brew update
brew install glassfish
you should see message, add that line to your .bash_profile
==> Caveats
You may want to add the following to your .bash_profile:
export GLASSFISH_HOME=/usr/local/opt/glassfish/libexec
Open a new terminal then, cd $GLASSFISH_HOME/glassfish/bin
./asadmin start-domain --verbose
Browse to http://localhost:8080 for welcome page and http://localhost:4848 for admin console
I actually installed Wildfly-Application Server using homebrew but could not find a way to run it.
https://tomylab.wordpress.com/2016/07/03/how-to-install-wildfly-on-mac/
This tutorial helped me .
And for glassfish, my installation was again successful using homebrew but was not able to run it . I did figure it out when I ran the following commands.
$ cd /usr/local/opt/glassfish/libexec/bin
$ ./asadmin
asadmin> start-domain
You need to understand about the PATH variable. It is an environment variable on Unix-like operating systems, specifying a set of directories in which executable programs are located. In general, each executing process, or user session, has its own PATH setting.
So, you need to add the glassfish home path to your actual path variable.
Now, as per your problem with running the Glassfish server; try this:
export GLASSFISH_HOME=/usr/local/opt/glassfish/libexec/
export PATH=$PATH:$GLASSFISH_HOME/bin
Add it to your bash profile, if you do not want to do this everytime.

Apache references wrong httpd.conf after Mac OS X Sierra upgrade

I've recently upgraded to Mac OS X Sierra and it has totally shafted my apache/PHP setup. Having wasted most of the morning, I've finally found the actual httpd.conf file that is being referenced at /usr/local/etc/apache2/2.2/httpd.conf, whereas the file I need to be using is at /etc/apache2/httpd.conf.
How can I tell Apache to use the version I was successfully using before the update?
Not sure about MacOS version, but with any binary of httpd you use the parameter -f, as in:
httpd -k start -f /path/to/conf
In most cases you need to load envvars file in your environment, this file is in bin directory in an official install of httpd and generally adds HTTPD lib directory to LD_LIBRARY_PATH.
So briefly
. /path/to/httpd/bin/envvars
httpd -k start -f /path/to/conf
Or apachectl which is an official script which refers to both to make your life easier.

Why when i restart the shell, java is unavailable?

I have installed java 1.7 on my mac, and I have edited ~/.bash_profile as the following:
export JAVA_HOME=/Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin/Content s/Home
export PATH=${JAVA_HOME}/bin:$PATH
When I execute source /.bash_profile, the java become available. But when I restart the shell, I got the following error message:
No Java runtime present, requesting install.
I have to re-execute source /.bash_profile to make it available.
I am so confused, hope someone can help me.
It is because variables you export are only valid in the current ssh session.
Look here for deeper explanation:
Mac OS X 10.9 - setting permanent environment variables
As #trojanfoe stated there:
The .bash_profile is only executed for a login-shell, whereas .bashrc
is executed for every new shell instance
Check this posting out please. I don't believe your problem is a JAVA problem but it looks rather misunderstanding on BASH side.

My boot2docker installation seems to not be working. What am I doing wrong?

I'm running on Mac OS X 10.6.8 Snow Leopard.
FYI: I can't upgrade my OS so that is not an option for me right now.
So, I install boot2docker and when I go click on the icon I receive the following output:
username#My-Mac:~$ bash
username#My-Mac:~$ unset DYLD_LIBRARY_PATH ; unset LD_LIBRARY_PATH
username#My-Mac:~$ mkdir -p ~/.boot2docker
username#My-Mac:~$ if [ ! -f ~/.boot2docker/boot2docker.iso ]; then cp /usr/local/share/boot2docker/boot2docker.iso ~/.boot2docker/ ; fi
username#My-Mac:~$ /usr/local/bin/boot2docker init
/usr/local/bin/boot2docker up
$(/usr/local/bin/boot2docker shellinit)
docker version
error in run: Failed to initialize machine "boot2docker-vm": exit status 1
username#My-Mac:~$ /usr/local/bin/boot2docker up
error in run: Failed to get machine "boot2docker-vm": machine does not exist (Did you run `boot2docker init`?)
username#My-Mac:~$ $(/usr/local/bin/boot2docker shellinit)
error in run: Failed to get machine "boot2docker-vm": machine does not exist (Did you run `boot2docker init`?)
username#My-Mac:~$ docker version
Client version: 1.6.0
Client API version: 1.18
Go version (client): go1.4.2
Git commit (client): 4749651
OS/Arch (client): darwin/amd64
FATA[0000] Get http:///var/run/docker.sock/v1.18/version: dial unix /var/run/docker.sock: no such file or directory. Are you trying to connect to a TLS-enabled daemon without TLS?
username#My-Mac:~$
What does this mean? How can I fix this?
I ran into the same issue. You need to set the environment variables in your shell. Run the following:
eval "$(boot2docker shellinit)"
Since it is only persistent per shell you'll need to add it to your ~/.bashrc, ~/.bash_profile, .zshrc, or whatever other shell profile you need it to run in.
Here is a good example of a plist for auto starting boot2docker. You'll have to modify the plist so the working directory matches yours. https://gist.github.com/krak3n/0f7fe4c3c5828767ec5b
I've installed Kitematic (Version 0.5.19 which is Beta as of this writing) as well as boot2docker on my system. Kitematic does not install a plist for auto starting your boot2docker instance. It boots when you start Kitematic. It most likely shuts it down on close which means your containers that are running will shutdown as well.
Ultimately it is up to how you want to setup and run your environment. If you're going only boot2docker and docker CLI and want things running at boot, create the plist and set your .bash_profile/.zshrc. If you want a GUI and CLI option that only boots and runs when you want it to then Kitematic is the way to go.
The answer above is correct, but you don't need the eval, you can just use:
$(boot2docker shellinit)
You can put this in your .profile
echo '$(boot2docker shellinit)' >> ~/.profile
and then it is setup every time you create a new shell.
This might be a duplicate of a previous question I answered:
Docker TLS error on Mac
After much hassle and delegation I was able to finally figure out what was going on. It was xanderlopez in this post that got me to realize that the problem lied with my shared folder and virtual machine folder locations for VitualBox. After changing the shared folder and renaming the location for the VM to "VirtualBox VMs", once I reinstalled boot2docker, everything ran as was supposed to and the hello world verification succeeded. So that's a gotcha right there. The location of your vm must be inside a folder named "VirtualBox VMs". The location seems to be unimportant as I just created a subfolder folder inside the folder that I was already using. Not sure how that works but it seems to have worked which is good enough for this issue. If I see any problems up ahead later related to the folder structure I'll be sure to reference this post.

Apache "LoadModule passenger_module" works when "apachectl -k start" is invoked from bin directory, but not with bash script

I'm using
mac OS 1.8.3
RVM 1.19.6
Ruby ruby 1.9.3p327
Apache 2.4
Phusion Passenger 3.0.19
After an error free install of Apache I launched the server and it worked.
I wrote a 'start_apache.sh' script:
#!/bin/bash
sudo /usr/local/apache2/bin/apachectl -k start
... which worked.
I then installed phusion passenger without error.
When I ran my start_apache.sh script, I got this error
httpd: Syntax error on line 504 of /usr/local/apache2/conf/httpd.conf:
Cannot load
/Users/perry_mac/.rvm/gems/ruby-1.9.3-p327/gems/passenger-3.0.19/ext/apache2/mod_passenger.so
into server:
dlopen(/Users/perry_mac/.rvm/gems/ruby-1.9.3-p327/gems/passenger-3.0.19/ext/apache2/mod_passenger.so,
10): Symbol not found: _unixd_config\n Referenced from:
/Users/perry_mac/.rvm/gems/ruby-1.9.3-p327/gems/passenger-3.0.19/ext/apache2/mod_passenger.so\n
Expected in: flat namespace\n in
/Users/perry_mac/.rvm/gems/ruby-1.9.3-p327/gems/passenger-3.0.19/ext/apache2/mod_passenger.so
After following ++ a lot ++ of 'Can't loadModule' Q&A's, I tried
cd /usr/local/apache2/bin
sudo apachectl -k start
... and it worked.
Using the script still does not.
Can someone explain why?
Many thanks!
Maybe it has to do with the working directory. Try this:
#!/bin/bash
cd /usr/local/apache2/bin/ && sudo ./apachectl -k start
Maybe this is some issue with user profile. Could you check environmental paramentrs values?
Thank you rzymek.
Your insight lead me to try this:
perrys-MacBook-Pro:bin perry_mac$ ls
ab apxs dbmmanage envvars-std htcacheclean htdigest httpd logresolve
apachectl checkgid envvars fcgistarter htdbm htpasswd httxt2dbm rotatelogs
perrys-MacBook-Pro:bin perry_mac$ pwd
/usr/local/apache2/bin
perrys-MacBook-Pro:bin perry_mac$ which apachectl
/usr/sbin/apachectl
perrys-MacBook-Pro:bin perry_mac$
Here's what happened: I downloaded, built, and installed apache 2.4. Did not know mac OSX 10.8.3 still had a working apache installation. I had read some web posts about how Apple had "removed web sharing" from this OS version. Turns out that means they removed a GUI element, but left the server in place. As you can see, I now have two versions of apachectl and httpd. I am untangling the rest of the mess now. As a follow-up, if anyone has advice on how to best proceed, please comment below. Otherwise I am going to start by modifying $PATH and see how that goes.
ADDENDUM:
Looks like this lead to a component of my confusion:
http://www.modrails.com/documentation/Users%20guide%20Apache.html#_phusion_passenger_is_using_the_wrong_apache_during_installation
... but the link leads to no remedy (as of 5/5/2013). There must be an option to set during the phusion passenger installation to ensure it points to the desired apache installation, but I can't locate it.
In the end, I removed the ver 2.4 of apache that I built and reverted to the ver 2.2 that is included with the OS. So far, it's all working.

Resources