ObiHill
ObiHill

Reputation: 11876

Changing the default PHP Command Path

I'm running Ubuntu Natty.

I recently installed PHP 5.3.8 from Source and it works ok. However, as part of my installation, I had to install php5-dev so I guess this has installed another PHP on the server (I needed to do this for phpize).

My main PHP binary is at /usr/local/php/bin. However, when I run php from the command line with something like this php --ini I get the following:

$ php --ini
Configuration File (php.ini) Path: /etc/php5/cli
Loaded Configuration File:         /etc/php5/cli/php.ini
Scan for additional .ini files in: /etc/php5/cli/conf.d
Additional .ini files parsed:      /etc/php5/cli/conf.d/pdo.ini

I can still run PHP from /usr/local/php/bin, but that would mean me having to type the whole path out for all my command line scripts.

Is there a way I can change this behaviour so that when I use the php command, it points to the php binary inside /usr/local/php/bin instead?!

Thanks in advance

Upvotes: 2

Views: 15082

Answers (2)

ObiHill
ObiHill

Reputation: 11876

The below code worked for the specific circumstance in my earlier question:

printf "\nexport PATH=/usr/local/php/bin:\${PATH}\n" >> /etc/profile
source /etc/profile

Hope it helps.

Upvotes: 1

Matt H
Matt H

Reputation: 6532

You can edit your .bash_profile file to change your default search path. Or update it using PATH=/usr/local/php/bin:$PATH or somesuch.

Upvotes: 4

Related Questions