Reputation: 5155
May be this question is a little stupid. But I've tried to solved it for two hours and cannot find the solution.
Firstly, I'm a hobby and novice PHP developer. Last year, I installed MAMP and Pear on my mac.
Today, I uninstalled old MAMP (from last year) and reinstall new MAMP. Now, when I type pear
command on terminal, the following error occurs:
/Users/naylin/pear/bin/pear: line 28: /Applications/MAMP/bin/php/php5.4.10/bin/php: No such file or directory
/Users/naylin/pear/bin/pear: line 28: exec: /Applications/MAMP/bin/php/php5.4.10/bin/php: cannot execute: No such file or directory
I know the error occurs because php5.4.10/bin/php
no longer exist on my machine. Currently, I have /Applications/MAMP/bin/php/php5.5.18/bin/php
according to my last updated MAMP. But I don't know how to properly solve this problem.
Update
As Stony suggested in his answer, I try to modify .pearrc
file. This file is normally located under ~/.pearrc directory. At the last line of this file, there is config definition like that s:44:"/Applications/MAMP/bin/php/php5.4.10/bin/php";
. I modified it to the correct path of Php executable. In my case, it's s:44:"/Applications/MAMP/bin/php/php5.5.18/bin/php";
.
But, the error still occurs unfortunately. I even restart my mac with the hope to refresh config settings. Still, the error. (I described this because I assume someone may be able to solve the error with this way on his mac.)
How do I solved the error
After trying 2 days to solve this problem, I gave up and try to uninstall this pear from my machine. And I planned to reinstall pear with correct settings again. I used the following command to uninstall it.
$ sudo pear uninstall pear
But the problem is I could not even run this command. The same error occured again.
So, I tweaked it. The error occurs because of configured directory for PHP executable file is not found. Hence, I created this directory by hand (I mean GUI). In my case, it is "/Applications/MAMP/bin/php/php5.4.10/bin/php"
. So, I created "/Applications/MAMP/bin/php/php5.4.10/"
directory first. After that, I copied all the files and folders from "/Applications/MAMP/bin/php/php5.5.18/"
.
After that, the error disappear and pear
command works gracefully again. Then you can modify Config Settings of pear as suggested in Stony's answer (for correct PHP executable file). After you modify your settings, delete the tweaked folder that you created earlier ("/Applications/MAMP/bin/php/php5.4.10/"
).
(In my case, I uninstalled this pear. And I use the pear already included from MAMP php5.5.18.)
I'm not sure whether this is the correct way. But I hope anyone who experience this problem like me can solve the error if they don't found any more correct solutions.
Upvotes: 1
Views: 123
Reputation: 27305
You set everywhere in your PEAR configuration the path to your PHP executable. You have to find that file and change the path to the new one.
You can use a command to change the value:
pear config-get php_dir
Then it should work. To show your configuration your can use:
pear config-show
And the configuration file is the .pearrc
which should be somewhere in your user directory.
https://pear.php.net/manual/de/guide.users.commandline.config.php
Upvotes: 1