Page 1 of 3 123 LastLast
Results 1 to 10 of 23

Thread: problem with PATH

  1. #1

    Default problem with PATH

    I have a newbie question.

    I just installed PEAR (as root).

    The PEAR binary files are in:

    /usr/share/php5/bin/

    When I tried running the PEAR binary from the command line, it didn't work. So I figure I need to put the directories in the path.

    I put a file in /etc/preload.d/ called pear.sh which contained the following code:

    export PEAR_BIN=/usr/share/php5/bin
    PATH=$PATH:$PEAR_BIN


    It seems one needs to reboot to get the new path subsection appended... But once I reboot, I get the following when I type echo $PATH:

    pavilion:~ # echo $PATH
    /sbin:/usr/sbin:/usr/local/sbin:/opt/kde3/sbin:/opt/gnome/sbin:/root/bin:/usr/local/bin:/usr/bin:/usr/X11R6/bin:/bin:/usr/games:/opt/gnome/bin:/opt/kde3/bin:/usr/lib/jvm/jre/bin:/usr/lib/mit/bin:/usr/lib/mit/sbin:/usr/NX/bin:/usr/share/php5/bin
    pavilion:~ #

    So it would seem my PEAR binaries should be in the path (at the very end).

    But when I try and run the PEAR binary from the command line, I get the following:

    pavilion:~ # pear version
    -bash: pear: command not found
    pavilion:~ #

    But if I try running from the command line with the full path, I get the following:

    pavilion:~ # /usr/share/php5/bin/pear version
    PEAR Version: 1.9.0
    PHP Version: 5.2.6
    Zend Engine Version: 2.2.0
    Running on: Linux pavilion 2.6.18.8-0.9-default #1 SMP Sun Feb 10 22:48:05 UTC 2008 i686
    pavilion:~ #

    So what's going on?... The folder containing the PEAR binary seems to be in $PATH but I cannot run the binary without prepending the path.

    TIA,

    --Doug

  2. #2
    Join Date
    Jun 2008
    Location
    relative
    Posts
    1,172

    Default Re: problem with PATH

    If you want to include this patch just on one user then it's enough to add the following lines:
    Code:
    PATH=$PATH:/usr/share/php5/bin/
    export PATH
    to .bashrc.
    Hope that helps.
    http://mydailyhash.wordpress.com/
    http://yami.googlecode.com/

  3. #3
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    25,288

    Default Re: problem with PATH

    That's correct, but the export PATH is useless.
    Henk van Velden

  4. #4

    Default Re: problem with PATH

    -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA1

    I'm not sure either option makes a difference. I assume by 'useless' you
    mean because PATH is already exported. Moving the way it is set seems
    useless because we already know it is set but still the executable is not
    found. Setting it somewhere else will not make a difference unless there
    is a serious bug somewhere (doubtful).

    Good luck.





    On 02/21/2010 02:56 AM, hcvv wrote:
    >
    > That's correct, but the -export PATH- is useless.
    >
    >

    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v2.0.12 (GNU/Linux)
    Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

    iQIcBAEBAgAGBQJLgS1XAAoJEF+XTK08PnB5LJQP/A+c7bSxi85TIb5dqTAorAWO
    QKTz3/Ft+jMSewO2uRzAdkIxVv6cNgfdBForir+u23ckyy079nZ3tJc9rdZlHRLl
    R+EsCMgDdSUGghIFZsc/MiXBUT53OXl1wZdvlLWgU1QdW6aghcUpMBtC7yPzEUJc
    AsoKKmI+KBpvZJ5ZtAcuIr3euCEAwSbdiq/giIASX5sTvcYB8ceRq7OYzi8yzLue
    9i1nmFj46YoUJd0zNLEYxMRTHsRbX1FKKMqlQ8IrI3vEqSMjuTTHEwCTf1bDD7te
    DxgVmMGXXbvu6pfhVRSw67ovaw71mOTn1WJS9NS/CTlbNviRnRPY/7iPc1RzO6na
    eFRzDSPFUQVZXKHXy0Fml7amqEo5A8q+ibr1AeRw5qc3ZoPCEKl5JfaX4CVxj3R2
    HL+evXXjWyVUBeEo6lPHZOLFaM/n0kSKDd2bV02hiEdjhlKsoHQisam+HNbIZeKD
    TWBEv2XqYjZLfNrXAt+QiUd1nVtBNzUu0T8NE/DvWOvKYsrEh7Ghg7g6GrstvKEg
    2lZAr7VkpN3Owl5p68m5oGs23hCryZnmPiZTOxkbWtocG4VeZ5Fj6Hw1RNM9o5rt
    crYkqVOva6vx0AJtol4jIpCKpw/w6uqX4oiFd4LALrGIzJyzlFUNI59WQUBcc/c6
    vsMeKfHKMToKlMvqhsdS
    =W6t/
    -----END PGP SIGNATURE-----

  5. #5

    Default Re: problem with PATH

    Quote Originally Posted by ram88 View Post
    If you want to include this patch just on one user then it's enough to add the following lines:
    Code:
    PATH=$PATH:/usr/share/php5/bin/
    export PATH
    to .bashrc.
    Hope that helps.
    Thanks but I would like to add it to the path for all users. Also, I liked to know why I cannot execute the binary when its directory does appear in the $PATH echo.

    --Doug

  6. #6

    Default Re: problem with PATH

    Quote Originally Posted by hcvv View Post
    That's correct, but the export PATH is useless.
    Thanks but can you please clarify that... I was just copying syntax I saw posted elsewhere.

    Does the Export PATH do nothing... Or is it just unnecessary given the earlier line of code?

    What is the correct code snippet for appending or prepending to the PATH?

    Also, why doesn't the binary execute even though its directory does appear in the PATH?

    From looking at other threads and forums, it appears that SUSE (and other distro's)have a multitude of directories where one can add a script file for appending or prepending to the path. I used /etc/profile.d but is that the correct directory? Also, what is the effect of the shell script extension. I used pear.sh but I noticed other shell scripts with .tcsh, .csh, .bash. I understand there are several different shells, does each shell have its own $PATH variable. My "command not found" appears with --bash in front of it. Should I have named my script pear.bash instead of pear.sh?

    TIA,

    --Doug

  7. #7
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    25,288

    Default Re: problem with PATH

    Sorry, I must be a bit more clear about my post. I only acted on the
    Code:
    PATH=$PATH:/usr/share/php5/bin/
    export PATH
    sequence because I see that often and nobody who gives it seems to care about what it means.

    You can work with variables in bash (as in most shells), but there existence is restricted to the shell process that they are defined and used in. When you want to have variables in the process environment to be available in newly forked processes, you can export such a variable and its value to the environment with the export statement.

    But as PATH is already inherited from the parent process (else there would be nothing in it) there is no need to export it again. You only need to change its value.

    Back to your problem.
    I think there is no need to do a
    Code:
    PATH=$PATH:/usr/share/php5/bin/
    because your echo $PATH proves that it is already there. We must concentrate on why the program is still not found.
    Did you try a
    Code:
    which pear
    And, why we are searching for something we do not quite understand, some silly questions as what is the output of
    Code:
    ls -l /usr/share/php5/bin/
    (BTW, strange place to put a bin directory)
    Henk van Velden

  8. #8
    Join Date
    Nov 2009
    Location
    West Virginia Sector 13
    Posts
    15,765

    Default Re: problem with PATH

    Perhaps you could put a symlink in a directory that is more traditionally used for executables like /bin.

  9. #9
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    25,288

    Default Re: problem with PATH

    We then still wouldn't understand what is wrong here.

    But as a test, it could give more information about this phenomenon.
    Henk van Velden

  10. #10
    Join Date
    Nov 2009
    Location
    West Virginia Sector 13
    Posts
    15,765

    Default Re: problem with PATH

    which pear
    is a good idea there may be a another file (non exec) in the path prior to the target directory.

    Could also put the target path first

Page 1 of 3 123 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •