SyncDB
SyncDB copied to clipboard
wrong php binary detection on search_replace_local
I was getting a funny error when hitting search_replace_local
:
./syncdb: line 1209: /Applications/MAMP/bin/php/php5.3.28/bin/php: No such file or directory
Weird because I run MAMP PRO and it's supposed to be php 5.6.7. There isn't a 5.3.28 in MAMP.
I thought MAMP was doing something funky but which php
correctly returns /usr/bin/php
.
Digging the code deeper it seems like the problem is here:
if [[ "${l_php-}" ]]
then
my_php=$l_php
fi
What is this l_php-
?
I had to comment those lines out to get the proper php binary and then it worked.
Just a heads up!
I just noticed this comment in your changelog:
Fixed bug which broke search_replace_local in some circumstances. The Search and Replace CLI script, in its shebang line, defaults to /usr/bin/php, but MAMP users for example need to use their own binary. If you use any PHP binary besides the default /usr/bin/php, make sure it is in your PATH, otherwise your local search and replace will fail (go which php to find out).
I guess that's related to this issue @jplew. Is MAMP supposed to add it's php binary to PATH?
Answering my own question: I think this SO answer solves it. Didn't expect this to be necessary though as /usr/bin/php
is located regardless of MAMP (maybe because I have XCode installed). So I'd suggest setting my_php
only if not previously set?