1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Path to php

Discussion in 'PHP' started by zamolxes, Apr 22, 2005.

  1. #1
    I know on most servers the path to php is /usr/bin/php or /usr/local/bin/php or something like that, however I was wondering, is there a simple way to find out precisely the path to php by running a script or similar?

    All answers appreciated.
     
    zamolxes, Apr 22, 2005 IP
  2. T0PS3O

    T0PS3O Feel Good PLC

    Messages:
    13,219
    Likes Received:
    777
    Best Answers:
    0
    Trophy Points:
    0
    #2
    php_info() will give you some info. Mine returns:

    include_path .:/usr/local/lib/php .:/usr/local/lib/php

    And other paths.
     
    T0PS3O, Apr 22, 2005 IP
  3. neterslandreau

    neterslandreau Peon

    Messages:
    279
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #3
    
    [user@server]$ which php
    /path/to/php
    [user@server]$
    
    Code (markup):
     
    neterslandreau, Apr 22, 2005 IP
  4. zamolxes

    zamolxes Peon

    Messages:
    176
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Excuse my ignorance but how would I run this code?
     
    zamolxes, Apr 22, 2005 IP
  5. neterslandreau

    neterslandreau Peon

    Messages:
    279
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #5
    That command assumes you have shell access to the server and it is done from the command line.

    Log in and simply type 'which php'.
     
    neterslandreau, Apr 22, 2005 IP
  6. neterslandreau

    neterslandreau Peon

    Messages:
    279
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #6
    If you look at the Configure Command for php_info() you will see the prefix used to compile PHP. It will be something like:
     './configure' '--with-prefix=/usr/' '--exec-prefix=/usr/'
    Code (markup):
    The above indicates that the path to php is /usr/bin.
     
    neterslandreau, Apr 22, 2005 IP
    Rockstr27 likes this.
  7. zamolxes

    zamolxes Peon

    Messages:
    176
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Thank you for your answers - much appreciated!
     
    zamolxes, Apr 22, 2005 IP
  8. nikolas22t

    nikolas22t Peon

    Messages:
    6
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    what is my path...


    PATH /sbin:/bin:/usr/sbin:/usr/bin:/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin
     
    nikolas22t, Oct 14, 2007 IP
  9. silasp

    silasp Peon

    Messages:
    1
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #9
    <?php
    echo exec("which php");
    ?>

    (or you can use the phpinfo(); command as stated above)

    That will give you the path to PHP, then put something like this in cron
    */5 * * * * /path/to/php -q /htdocs/www/x.php > /dev/null

    replace /path/to/php with your php path, and
    /htdocs/www/x.php with the php script you wish to run.

    remove the > /dev/null if you want the script output emailed to you.

    S.
     
    silasp, Jun 2, 2008 IP
    Rockstr27 likes this.
  10. MediaTemple

    MediaTemple Greenhorn

    Messages:
    11
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    11
    #10
    hi, I use adultscript, I need set up my php path, how I get it from my server?

    Screen shot 2012-03-01 at 5.24.59 PM.jpg
     
    MediaTemple, Mar 1, 2012 IP