# How to install port without dependencies



## dejamuse (Jun 5, 2014)

I'm sure this has been asked a thousand times...

I have FreeBSD 10 but manually installed PHP 5.3.28 because the version of Drupal I'm using requires it.  The system default is either 5.4 or 5.5 - not sure which.

I want to install a port named "Drush", a set of scripts for managing Drupal installations but the port automatically installs the system default version of PHP which I don't want.

Isn't there some way of installing ports where you get to select which dependencies to add?

I tried manually installing Drush using Composer which is the preferred install method over the older Pear method but when I invoke Drush I get: ERROR: Can't find PHP.

I had added: 
	
	



```
setenv DRUSH_PHP /usr/local/bin/php
```
 to root's .cshrc file.

There's a startup script in Drush that checks for PHP. Here's the relevant code:

```
if [ -n "$DRUSH_PHP" ] ; then
  # Use the DRUSH_PHP environment variable if it is available.
  php="$DRUSH_PHP"
else
  # On MSYSGIT, we need to use "php", not the full path to php
  if [ -n "$MINGW" ] ; then
    php="php"
  else
    # Default to using the php that we find on the PATH.
    # We check for a command line (cli) version of php, and if found use that.
    # Note that we need the full path to php here for Dreamhost, which behaves oddly.  See http://drupal.org/node/662926
    php="`which php-cli 2>/dev/null`"

    if [ ! -x "$php" ]; then
      php="@php_bin@"
    fi

    if [ ! -x "$php" ]; then
      echo "ERROR: can't find php."; exit 1
    fi
  fi
fi
```


Why can't Drush find PHP (CLI)?  
	
	



```
#php -i
```
 works fine.

It just seems a no brainer that there ought to be a way of using ports to install only the dependencies you select or at least being smart enough to see PHP already installed and not install another version.

Any clues how to fix this?

Tnx,

Jeff


----------



## dejamuse (Jun 5, 2014)

Not sure why Composer failed...

Resorted to Pear which worked.  Pear isn't automatically included with PHP built from FreeBSD ports, so first had to:

```
# wget http://pear.php.net/go-pear.phar
# php go-pear.phar
```
Then:


```
pear channel-discover pear.drush.org
pear install drush/drush
```


----------



## junovitch@ (Jun 6, 2014)

Set this in your /etc/make.conf

```
DEFAULT_VERSIONS=php=5.3
```

Then compile anything you want from ports and it will respect that version.  Keep in mind packages from the official repos use PHP 5.4 as the default version. You won't be able to install PHP packages from the official repos and will have to rely in ports for them.


----------

