/    Sign up×
Community /Pin to ProfileBookmark

How to make your local server find the right PHP install

I’m using MAMP (Mac Apache Mysql and PHP) and by default it uses an installation of PHP installed in its own directory. However, when executing some php commands like exec() and system(), it uses the command line. I found this out by running exec(“which php”) which displayed /usr/bin/php rather than /Application/MAMP/bin/php. This version of PHP it uses with exec() is a different and older version of PHP than I want. I then upgraded to PHP 5.3 to my /opt/local/bin/ directory. When I run “which php” from the command line, it returns the right php because I have the path /opt/local/bin set up in my bash_profile file. However, when I run this command using exec(“which command”), it returns that it can’t find any PHP in /usr/bin /bin /usr/sbin /sbin. This is most likely because MAMP doesn’t know to look in /opt/local/bin. My question is why and how can I make MAMP include the path /opt/local/bin to find the proper php install.

to post a comment
PHP

0Be the first to comment 😎

×

Success!

Help @ternto333 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.2,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...