Op 31-jul-2007, om 22:17 heeft Jyrki Wahlstedt het volgende geschreven:
I don't know why but apache 2 has its own directory. So you have to add the following to your $PATH:
/opt/local/apache2/bin
And this must be put before /usr/sbin in the PATH, as otherwise the result remains the same …
To find out which version of an application is used you can use the following command. This prints the path to the application.
which apachectl
This command uses PATH, because of which the order is important!
Yes, that must be the problem, but how do I fix it? I made a new order like so: /opt/local/bin: /opt/local/sbin: /opt/local/apache2/bin: /opt/local/bin/mysql5: /opt/local/lib/mysql5/bin: /opt/local/lib/mysql5/bin/mysql: /opt/local/lib/mysql5/bin/mysqladmin: /bin: /sbin: /usr/bin: /usr/local/bin: /usr/local/mysql/bin: /usr/sbin and entered that in the terminal: export PATH=/opt/local/bin:/opt/local/sbin:/opt/local/apache2/bin:/ opt/local/bin/mysql5:/opt/local/lib/mysql5/bin:/opt/local/lib/mysql5/ bin/mysql:/opt/local/lib/mysql5/bin/mysqladmin:/bin:/sbin:/usr/bin:/ usr/local/bin:/usr/local/mysql/bin:/usr/sbin But even after a restart, the path is still in the wrong order: echo $PATH /opt/local/lib/mysql5/bin/mysql:/opt/local/bin/mysql5:/usr/local/ mysql/bin:/opt/local/bin:/opt/local/sbin:/opt/local/lib/mysql5/bin:/ usr/local/bin:/bin:/sbin:/usr/bin:/usr/sbin:/opt/local/bin:/opt/local/ lib/mysql5/bin/mysqladmin:/opt/local/lib/mysql5/bin/mysql /opt/local/lib/mysql5/bin/mysql; /opt/local/bin/mysql5; /usr/local/mysql/bin; /opt/local/bin; /opt/local/sbin; /opt/local/lib/mysql5/bin; /usr/local/bin; /bin; /sbin; /usr/bin; /usr/sbin; /opt/local/bin; /opt/local/lib/mysql5/bin/mysqladmin; /opt/local/lib/mysql5/bin/mysql I don't quite understand how this comes about: I'm not even sure where many of these values come from. Based on what I've googled, I gather that these variables are specified in the system and user profile files. But if I ask 'pico /etc/profile', I get: ----------------------------------------------------------- PATH="/opt/local/bin:/opt/local/sbin:/opt/local/lib/mysql5/bin:/usr/ local/bin:/bin:/sbin:/usr/bin:/usr/sbin" export PATH if [ "${BASH-no}" != "no" ]; then [ -r /etc/bashrc ] && . /etc/bashrc fi ----------------------------------------------------------- Similarly, 'pico ~/.profile' produces: ----------------------------------------------------------- # # Your previous .profile (if any) is saved as .profile.dpsaved # Setting the path for DarwinPorts. export PATH=/opt/local/bin:/opt/local/sbin:$PATH ----------------------------------------------------------- So that should ensure that the /opt/local/bin path always comes first, right? Your help is greatly appreciated: UNIX for Dummies (3rd edition) is not much help here. Elise van Looij
On 1.8.2007, at 14.58, Elise van Looij wrote:
So that should ensure that the /opt/local/bin path always comes first, right? Your help is greatly appreciated: UNIX for Dummies (3rd edition) is not much help here.
Yes, but: apache2 directory, /opt/local/apache2/bin, is not included there. If you want to include that, you could modify your ~/.profile or ~/.bash_profile to include (provided that the installation is by default): PATH=/opt/local/bin:/opt/local/sbin:/opt/local/apache2/bin:$PATH Different shells use different inifiles, I'd say .bash_profile is the safest. You see your shell with command 'echo $SHELL'. For casual uses, which I'd expect the manual launches of Apache software to be, it could be sufficient to write the path explicitly (the tab key completes directory names). ! ! Jyrki Wahlstedt ! http://www.wahlstedt.fi/jyrki/ ! ! Our life is no dream; but it ought to become one and perhaps will. ! PGP key ID: 0x139CC386 fingerprint: F355 B46F 026C B8C1 89C0 A780 6366 EFD9 139C C386
On Aug 1, 2007, at 06:58, Elise van Looij wrote:
Op 31-jul-2007, om 22:17 heeft Jyrki Wahlstedt het volgende geschreven:
I don't know why but apache 2 has its own directory. So you have to add the following to your $PATH:
/opt/local/apache2/bin
And this must be put before /usr/sbin in the PATH, as otherwise the result remains the same …
To find out which version of an application is used you can use the following command. This prints the path to the application.
which apachectl
This command uses PATH, because of which the order is important!
Yes, that must be the problem, but how do I fix it? I made a new order like so:
/opt/local/bin: /opt/local/sbin: /opt/local/apache2/bin: /opt/local/bin/mysql5: /opt/local/lib/mysql5/bin: /opt/local/lib/mysql5/bin/mysql: /opt/local/lib/mysql5/bin/mysqladmin: /bin: /sbin: /usr/bin: /usr/local/bin: /usr/local/mysql/bin: /usr/sbin
Note that there's no use in listing /opt/local/lib/mysql5/bin/mysql and /opt/local/lib/mysql5/bin/mysqladmin in your PATH. PATH can only hold directories, and those are files. You can safely remove those two items, since the directory they're in is already in your PATH.
and entered that in the terminal:
export PATH=/opt/local/bin:/opt/local/sbin:/opt/local/apache2/bin:/ opt/local/bin/mysql5:/opt/local/lib/mysql5/bin:/opt/local/lib/ mysql5/bin/mysql:/opt/local/lib/mysql5/bin/mysqladmin:/bin:/sbin:/ usr/bin:/usr/local/bin:/usr/local/mysql/bin:/usr/sbin
Ok, so you have thus set the PATH for that instance of the Terminal. But that goes away as soon as you close that Terminal window.
But even after a restart, the path is still in the wrong order:
echo $PATH /opt/local/lib/mysql5/bin/mysql:/opt/local/bin/mysql5:/usr/local/ mysql/bin:/opt/local/bin:/opt/local/sbin:/opt/local/lib/mysql5/bin:/ usr/local/bin:/bin:/sbin:/usr/bin:/usr/sbin:/opt/local/bin:/opt/ local/lib/mysql5/bin/mysqladmin:/opt/local/lib/mysql5/bin/mysql
/opt/local/lib/mysql5/bin/mysql; /opt/local/bin/mysql5; /usr/local/mysql/bin; /opt/local/bin; /opt/local/sbin; /opt/local/lib/mysql5/bin; /usr/local/bin; /bin; /sbin; /usr/bin; /usr/sbin; /opt/local/bin; /opt/local/lib/mysql5/bin/mysqladmin; /opt/local/lib/mysql5/bin/mysql
If you want the PATH to be persistent, you have to put the "export" line in a file that the Terminal reads when it starts.
I don't quite understand how this comes about: I'm not even sure where many of these values come from. Based on what I've googled, I gather that these variables are specified in the system and user profile files. But if I ask 'pico /etc/profile', I get: ----------------------------------------------------------- PATH="/opt/local/bin:/opt/local/sbin:/opt/local/lib/mysql5/bin:/usr/ local/bin:/bin:/sbin:/usr/bin:/usr/sbin" export PATH
if [ "${BASH-no}" != "no" ]; then [ -r /etc/bashrc ] && . /etc/bashrc fi -----------------------------------------------------------
Similarly, 'pico ~/.profile' produces: ----------------------------------------------------------- # # Your previous .profile (if any) is saved as .profile.dpsaved # Setting the path for DarwinPorts. export PATH=/opt/local/bin:/opt/local/sbin:$PATH -----------------------------------------------------------
So that should ensure that the /opt/local/bin path always comes first, right? Your help is greatly appreciated: UNIX for Dummies (3rd edition) is not much help here.
It sounds like at some point you modified /etc/profile, and ~/.profile, to contain those /opt/local directories (since they would not have been there by default) but that there's another file that the terminal is using instead of those. Possibilities include /etc/ bashrc, ~/.bash_profile and ~/.bashrc. That's assuming your shell is bash. Is it? Find out with "echo $SHELL".
participants (3)
-
Elise van Looij
-
Jyrki Wahlstedt
-
Ryan Schmidt