osx - mac os x terminal php command not found

20
2014-03
  • user1427195

    I am using Mac OS X 10.6.8. In Terminal, when I enter php -v, I get below message:

    Last login: Sun Dec 16 20:22:05 on ttys000
    You have mail.
    -bash: e: command not found
    ~ $cd /
    / $php -v
    -bash: php: command not found
    / $
    

    My $PATH is:

    /Applications/MAMP/Library/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr‌​/local/git/bin:/usr/X11/bin:/usr/local/php5-20121126-100332/bin/php

    When I type which php, I simply get an empty output.

  • Answers
  • Area 51

    hm, that sucks. Showed up fine on my 10.7 machine using php -v or "which php".

    You can always try "sudo find /usr/ -name php 2>/dev/null" to do a more complete search.

    If it somehow got borked, you could use http://www.macports.org to install php


  • Related Question

    osx - Make mcrypt available to PHP 5.3 on Mac OS X 10.6
  • ed209
    $ which mcrypt
    /opt/local/bin/mcrypt
    $ mcrypt -v
    Mcrypt v.0.9.9 (i386-apple-darwin10.4.0)
    Linked against libmcrypt v.2.5.8
    Copyright (C) 1998-2002 Nikos Mavroyanopoulos ([email protected])
    

    So I have mcrypt. How do I get PHP to use it? Other than adding

    extension=mcrypt.so
    

    to php.ini, I also see this in php.ini

    [mcrypt]
    ; For more information about mcrypt settings see http://php.net/mcrypt-module-open
    
    ; Directory where to load mcrypt algorithms
    ; Default: Compiled in into libmcrypt (usually /usr/local/lib/libmcrypt)
    ;mcrypt.algorithms_dir=
    
    ; Directory where to load mcrypt modes
    ; Default: Compiled in into libmcrypt (usually /usr/local/lib/libmcrypt)
    ;mcrypt.modes_dir=
    

    which is obviously unused.

    How can I get mcrypt working for PHP?

    This install is on Mac OS X 10.6, using MacPorts. I would prefer not to have to recompile php if possible.


  • Related Answers
    Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.