Error installing php 71 with homebrew on my mac - php

I have been developing with Vallet for some time now. Today i wanted to update laravel 5.4 to 5.5. Before doing so i run composer global update. Causing Vallet to stop working.
Fist i tried to do the following:
cd ~/.composer/
sudo chown -R $(whoami) vendor
source: https://laracasts.com/discuss/channels/general-discussion/getting-valet-not-found-error
I did not solve the issue. Then i decided to reinstall Vallet. Hereby i did the following:
I followed this: https://github.com/laravel/valet/issues/321
Stop and uninstall services
sudo brew services stop php71 dnsmasq nginx
brew uninstall php71 dnsmasq nginx
Remove related config files and valet home folder
sudo rm -r /usr/local/etc/php /usr/local/etc/nginx /usr/local/etc/dnsmasq.conf
sudo rm -r ~/.valet /var/root/.valet
Install services i tried this:
brew install php71
$ brew tap homebrew/php
$ brew install php71
brew install homebrew/php/php71
All gave the following error:
MacBook-Pro:~ mblivier$ brew install homebrew/php/php71
==> Installing php71 from homebrew/php Error: The following formula: php71
cannot be installed as a binary package and must be built from source.
Install the Command Line Tools:xcode-select --install
I new in this and don't know how to solve this. Any suggestions how to install php and go further with reinstalling Vallet?
homebrew is installed and working

You need xcode to build php, so first run:
xcode-select --install
to install xcode and later you can brew install php71

This is answer for your comment, I can't post as comment, need to post because is length limited.
There is one of two things going on here, either you didn't install PHP, or PHP is installed and not currently in any of system aware paths. First I would try to find PHP and make sure it exists:
$ find / -name php -type f
You should see something like:
/path/to/your/php/bin/php
If PHP binary does exist, check your path:
$ echo $PATH
If it does not exist, recompile php.
If PHP exists on your system, make sure the path to the /bin/php file is included. You can edit your ~/.bash_profile and add the custom path like this:
PATH=$PATH:/path/to/your/php/bin/
....
export PATH
Then save and reload the file to ensure your current session has access to new path changes:
$ source ~/.bash_profile
With any luck you can now do a php -v and see the version response.

Related

php -v returns dyld: Library not loaded: /usr/local/opt/readline/lib/libreadline.7.dylib

I was trying to install Valet and for a mistake I uninstall php from brew, now I reinstall php, if I go to a phpinfo() file on apache I can see
PHP Version 7.1.23
but if I do php -v on console, or something other php command i get:
dyld: Library not loaded:
/usr/local/opt/readline/lib/libreadline.7.dylib Referenced from:
/usr/local/bin/php Reason: image not found Abort trap: 6
Im on Mac Os Sierra
There's a couple of ways you could try to resolve this:
$ brew link readline
or perhaps:
$ brew link readline --force
If that doesn't work try:
$ cd /usr/local/opt/readline/lib/
$ ln -s libreadline.dylib libreadline.7.dylib
↳ Github Discussion : libreadline (image not found)
For me, I had php 5.4 installed, but an upgrade to php 7.3 worked for me.
brew install php#7.3
Then you'll likely need to add the new php version in your path. This basically means that when you load up your shell it knows where find the path to the files that you are using. For me, since I'm using zshrc that command is:
echo 'export PATH="/usr/local/opt/php#7.3/bin:$PATH"' >> ~/.zshrc
For you, if you have all your path and aliases in bash profile then the command would be this instead:
echo 'export PATH="/usr/local/opt/php#7.3/bin:$PATH"' >> ~/.bash_profile
Then, all you need to do is either source your zshrc or your bash_profile file, OR close that tab and open a new one. The source command basically says "hey, make sure you have an updated list of my aliases and path info". This naturally happens when you open a new shell, but you can force that with a command like:
source ~/.bash_profile
And then it worked for me. Good luck.
Try this:
$ cd /usr/local/opt/readline/lib/
$ ln -s libreadline.dylib libreadline.7.dylib
Then :
brew unlink readline && brew link --force readline

brew link php71: Could not symlink sbin/php-fpm

I'm trying to install Laravel Valet, which requires php 7.1, but when i run brew install php71, I get the following error:
==> Pouring php71-7.1.10_21.high_sierra.bottle.tar.gz
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
Could not symlink sbin/php-fpm
/usr/local/sbin is not writable.
I get the same error when i run brew link php71. If i run php -v, I actually see that I'm currently running PHP 7.1.7.
But when I run valet install, I get:
[DomainException]
Unable to determine linked PHP.
I don't even have an sbin directory in /usr/local.
Any suggestions?
I solved this problem by first creating the directory sbin:
sudo mkdir /usr/local/sbin
then if you are like me using macOS highSierra 10+ you need to run:
sudo chown -R $(whoami) $(brew --prefix)/sbin
after this
brew link php
Installing Laravel Valet, I had a similar issue with sbin not being writable. I had to make the directory, then utilized the solution included at this page. This finally allowed me the proper permissions to run a brew link command with a previously installed version of php 7.1.

How do I uninstall a PHP module?

I bumped into this bit of instructions while installing an addon for a PHP framework:
Make sure you don't have the PHP module installed. This is a Debian/Ubuntu example:
sudo apt-get purge php5-geoip
I am working on Windows PC with a Virtual Machine running Laravel Homsetead. I am using Git Bash command window. When I enter the above command I get:
bash: sudo: command not found
If I remember correctly, sudo is an Apple-related command so I tried dropping it like this:
apt-get purge php5-geoip
but I get
bash: apt-get: command not found
What command do I need to use to purge php5-geoip?
EDIT: echo $PATH gives out:
$ echo $PATH
/c/Users/Arthur/bin:/mingw64/bin:/usr/local/bin:/usr/bin:/bin:/mingw64/bin:/usr/
bin:/c/Users/Arthur/bin:/c/ProgramData/Oracle/Java/javapath:/c/Windows/system32:
/c/Windows:/c/Windows/System32/Wbem:/c/Windows/System32/WindowsPowerShell/v1.0:/
c/Program Files (x86)/Intel/OpenCL SDK/2.0/bin/x86:/c/Program Files (x86)/Intel/
OpenCL SDK/2.0/bin/x64:/c/Program Files (x86)/NVIDIA Corporation/PhysX/Common:/c
/Program Files/MATLAB/MATLAB Production Server/R2015a/runtime/win64:/c/Program F
iles/MATLAB/MATLAB Production Server/R2015a/bin:/c/Program Files/MATLAB/MATLAB P
roduction Server/R2015a/polyspace/bin:/c/Program Files (x86)/Skype/Phone:/c/PHP:
/c/ProgramData/ComposerSetup/bin:/c/Users/Arthur/AppData/Roaming/Composer/vendor
/bin:/c/HashiCorp/Vagrant/bin:/c/Program Files/nodejs:/c/Users/Arthur/AppData/Ro
aming/npm:/usr/bin/vendor_perl:/usr/bin/core_perl

Autoconf Mac OS X Mavericks

I need to install FANN extension to AMPPS, so I need to use phpize util.
For using phpize I need autoconf.
I tried to install autoconf via MacPort and Brew, but a get errors.
$ sudo port install autoconf
return error
Error: Port autoconf not found
And
$ brew install autoconf
return error
Error: The `brew link` step did not complete successfully The formula built, but is not symlinked into /usr/local Could not symlink
share/autoconf/Autom4te/C4che.pm Target
/usr/local/share/autoconf/Autom4te/C4che.pm already exists. You may
want to remove it: rm /usr/local/share/autoconf/Autom4te/C4che.pm
To force the link and overwrite all conflicting files: brew link
--overwrite autoconf
To list all files that would be deleted: brew link --overwrite
--dry-run autoconf
Possible conflicting files are:
/usr/local/share/autoconf/Autom4te/C4che.pm
/usr/local/share/autoconf/Autom4te/ChannelDefs.pm
/usr/local/share/autoconf/Autom4te/Channels.pm
/usr/local/share/autoconf/Autom4te/Configure_ac.pm
/usr/local/share/autoconf/Autom4te/FileUtils.pm
/usr/local/share/autoconf/Autom4te/General.pm
/usr/local/share/autoconf/Autom4te/Getopt.pm
/usr/local/share/autoconf/Autom4te/Request.pm
/usr/local/share/autoconf/Autom4te/XFile.pm
/usr/local/share/autoconf/INSTALL
/usr/local/share/autoconf/autoconf/autoconf.m4
/usr/local/share/autoconf/autoconf/autoconf.m4f
/usr/local/share/autoconf/autoconf/autoheader.m4
/usr/local/share/autoconf/autoconf/autoscan.m4
/usr/local/share/autoconf/autoconf/autotest.m4
/usr/local/share/autoconf/autoconf/autoupdate.m4
/usr/local/share/autoconf/autoconf/c.m4
/usr/local/share/autoconf/autoconf/erlang.m4
/usr/local/share/autoconf/autoconf/fortran.m4
/usr/local/share/autoconf/autoconf/functions.m4
/usr/local/share/autoconf/autoconf/general.m4
/usr/local/share/autoconf/autoconf/go.m4
/usr/local/share/autoconf/autoconf/headers.m4
/usr/local/share/autoconf/autoconf/lang.m4
/usr/local/share/autoconf/autoconf/libs.m4
/usr/local/share/autoconf/autoconf/oldnames.m4
/usr/local/share/autoconf/autoconf/programs.m4
/usr/local/share/autoconf/autoconf/specific.m4
/usr/local/share/autoconf/autoconf/status.m4
/usr/local/share/autoconf/autoconf/types.m4
/usr/local/share/autoconf/autom4te.cfg
/usr/local/share/autoconf/autoscan/autoscan.list
/usr/local/share/autoconf/autotest/autotest.m4
/usr/local/share/autoconf/autotest/autotest.m4f
/usr/local/share/autoconf/autotest/general.m4
/usr/local/share/autoconf/autotest/specific.m4
/usr/local/share/autoconf/m4sugar/foreach.m4
/usr/local/share/autoconf/m4sugar/m4sh.m4
/usr/local/share/autoconf/m4sugar/m4sh.m4f
/usr/local/share/autoconf/m4sugar/m4sugar.m4
/usr/local/share/autoconf/m4sugar/m4sugar.m4f
/usr/local/share/autoconf/m4sugar/version.m4
/usr/local/share/emacs/site-lisp/autoconf-mode.el
/usr/local/share/emacs/site-lisp/autoconf-mode.elc
/usr/local/share/emacs/site-lisp/autotest-mode.el
/usr/local/share/emacs/site-lisp/autotest-mode.elc
/usr/local/share/man/man1/autoconf.1
/usr/local/share/man/man1/autoheader.1
/usr/local/share/man/man1/autom4te.1
/usr/local/share/man/man1/autoreconf.1
/usr/local/share/man/man1/autoscan.1
/usr/local/share/man/man1/autoupdate.1
/usr/local/share/man/man1/config.guess.1
/usr/local/share/man/man1/config.sub.1
/usr/local/share/man/man1/ifnames.1
What I need to do to install autoconf? Or maybe you know other way to install FANN to AMPPS?
Error: Cowardly refusing to sudo brew link
You can use brew with sudo, but only if the brew executable is owned by root.
However, this is both not recommended and completely unsupported so do so at
your own risk.

How can I fix php-fpm info by homebrew-php

I've just installed php in osx by using homebrew with command like this.
$ brew install --without-apache --with-fpm --with-mysql php55
After install I got a following messeage.
To have launchd start php55 at login:
ln -sfv /usr/local/opt/php55/*.plist ~/Library/LaunchAgents Then to load php55 now:
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.php55.plist
But the last sentence should be launchctl load ~/Library/LaunchAgents/homebrew-php.josegonzalez.php55.plist. This issue is already in github issue page.
https://github.com/josegonzalez/homebrew-php/issues/663
I thought it's only small change of text, so I forked the project and by git clone, cloned to local. And looked for the place the text is written by like this.
find . -type f -name "*.*" -print0 | xargs -0 grep "mxcl"
./Contributions/Using FPM.md:0. `brew update && brew pull https://github.com/mxcl/homebrew/pull/12093`
./Contributions/Using FPM.md:For PHP-FPM to work with OS X built-in Apache, you need to install mod_fastcgi. There is a formula for that at https://github.com/mxcl/homebrew/pull/12093 (hopefully, soon within Homebrew).
./Contributions/Using FPM.md: brew pull https://github.com/mxcl/homebrew/pull/12093
./Formula/abstract-php.rb: opoo "INTL is broken as of mxcl/homebrew#03ed757c, please install php#{php_version_path.to_s}-intl" unless build_intl?
./Formula/abstract-php.rb: icu4c is broken as of mxcl/homebrew#03ed757c, so you will need to install intl as
./README.md:This repository contains **PHP-related** formulae for [Homebrew](https://github.com/mxcl/homebrew).
As far as I can see, there is nothing related to the instruction text.
Am I completely wrong path to solve the problem like this?
I want to know there is more effective way to find the text, or should I read the code line by line to find the place?

Categories