How to run "brew" command in windows..? - php

It shows "'brew' is not recognized as an internal or external command" in windows command prompt.
I am trying to install codeigniter-reactjs-example from github, where first command is brew.
How to run this command to install that project in Windows..?

Edit: Homebrew is also usable on Windows Subsystem for Linux (WSL) since version 2.0.0 (released February 2019), as detailed by #VonC's answer below. The instructions for installation/use are available at:
https://docs.brew.sh/Homebrew-on-Linux
Homebrew is MacOS only command line installer application and it doesn't exist for Windows.
The Windows alternatives are:
Chocolatey
Npackd
Scoop
OneGet for Windows 10
Source: https://laracasts.com/discuss/channels/laravel/homebrew-install-on-windows-os

It shows "'brew' is not recognized as an internal or external command" in windows command prompt.
Not anymore, 19 months later (Feb. 2019, compared to July 2017)
At least, not on Windows 10, in a WSL (Windows Subsystem for Linux) session.
As mentioned by Mike McQuaid
Homebrew 2.0.0 has been released (at #FOSDEM!) with official Linux and Windows 10 WSL support, brew cleanup running automatically (opt-out with HOMEBREW_NO_INSTALL_CLEANUP), no more options in Homebrew/core and no longer running on OS X 10.8 and older.
See Homebrew 2.0.0.
“Homebrew on Linux” is called “Linuxbrew”.
You can install it in your home directory, so it does not require sudo, and use it to install software that your host distribution’s package manager does not provide.
Linuxbrew uses its own repository for formulae: Linuxbrew/homebrew-core.
So again, this is not native Windows support, but Linux (through the WSL layer, on Windows 10).

As mentioned in the comments, Homebrew is a package manager for OSX, much like Aptitude in linux. You can't install Homebrew on Windows and never will be able to so you need to find a new way to accomplish what you are doing. I think you're trying to work with Google's V8 Javascript engine so why not try:
https://github.com/phpv8/v8js

You can Install Brew on windows subsystem i.e in Ubuntu or Kali linux by following these steps.
1: $ sudo apt-get install build-essential procps curl file git -y
2: $ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
3: $ echo 'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"' >> /home/$USER/.profile
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
4: $ brew update
I have installed in both the linux(Windows subsystem)
To Upgrade
$ brew upgrade PACKAGE
To Uninstall
$ brew uninstall PACKAGE
Finally, if you ever want to remove Homebrew from Linux, the command is:
$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)"

Homebrew is a package manager for OS X. Windows can't use Homebrew. Even if there was a way to get pass that, the packages wouldn't work.
This link below might help you find an alternative.
http://alternativeto.net/software/homebrew/

Use this
Download git bash
Run below command, this will install homebrew to your PC
now this can help you run brew command
bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
If you want to run directly without bash then It can be done using cmd also
If following with cmd then you need to add the location of homebrew downloaded folder to your environment path variables
Try this in windows CMD
curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh
Now add this folder location "C:\Users\[NAME]\homebrew\" to path variable
TO add in Path Variables Follow below:

Related

PHPInfo / Valet - Two different PHP versions

OK so I am experiencing something quite odd. My phpinfo() shows one version while php -v shows another.
I am running locally on a MacBook Air (Mojave), with Laravel and Valet.
phpinfo():
PHP Version 7.2.13
Configuration File (php.ini) Path /usr/local/etc/php/7.2
Loaded Configuration File /usr/local/etc/php/7.2/php.ini
Scan this dir for additional .ini files /usr/local/etc/php/7.2/conf.d
While in my terminal, it shows:
php -v
PHP 7.3.0 (cli) (built: Dec 7 2018 11:00:11) ( NTS )
Now, if I do a which php I get this:
/usr/local/bin/php
In my ~/.bash-profile, I have this:
export "PATH=~/.composer/vendor/bin:$PATH"
I have tried to:
Restart Nginx
Restart Valet
Unlink PHP#7.2 and link PHP#7.3with Homebrew:
Olivers-MacBook-Air:~ oliverbusk$ brew unlink php#7.2
Error: No such keg: /usr/local/Cellar/php#7.2
How can I get my actual valet site to use php#7.3?
Below simple fix worked for me.
rm ~/.config/valet/valet.sock
valet restart
In my case it worked after forcing the specific PHP version:
valet use php#7.4 --force
Good news, please upgrade to latest valet version, you can easily switch php version.
Source: https://laravel.com/docs/5.8/valet
PHP Versions
Valet allows you to switch PHP versions using the valet use php#version command. Valet will install the specified PHP version via Brew if it is not already installed:
valet use php#7.2
valet use php //without any specification, it will be using latest version
Something so basic as rebooting my Macbook solved this issue. Once rebooted, the correct version 7.3 showed in my phpinfo();
From MacBook pro (Mojave), with Laravel and Valet:
valet use php#7.2
To be able to effectively change the version of php on my machine I use the following script:
Add to your user's .bash_profile
Then use the following command to switch
switch-php7.x
switch-php() {
valet stop
brew unlink php#7.2 php#7.3 php#7.4
brew link --force --overwrite php#$1
brew services restart php#$1
composer global update
rm -f ~/.config/valet/valet.sock
valet install
}
https://gist.github.com/r1tt3r/e0f199eb274d5ff186b73956af594316
I am running linux valet on Ubuntu 20.04 , The following command works for me
valet use 8.0
Here, 8.0 refers to the php version.
NB: Tested this solution on Ubuntu 20.04 Desktop
If you are using Valet Linux Plus(Has more features than Valet Linux) Just do valet use {your PHP version} --update-cli. For instance to use php8.0 just run:
valet use 8.0 --update-cli
This will update both php-fpm version plus php-cli version too.
Basically the php valet uses and the one used by your macbook is different.
But as already mentioned by #Shiro and #Israel Alexis Palma Quezada, in newer versions valet use php73 would solve your problem.
If it's not working, try running composer global update to update your global packages, thus updating valet
To update the mac php version, execute the following lines:
export PATH="your/path/to/php#7.3/bin:$PATH"
export PATH="your/path/to/php#7.3/sbin:$PATH"
or simply add these two lines to your ~/.profile or ~/.bash_profile
Don't forget to run source ~/.profile or source ~/.bash_profile or whatever file you chose to edit.
Yesterday I encountered the same problem on Ubuntu 18.
At first I changed the PHP version:
$ sudo a2dismod php7.2
$ sudo a2enmod php7.3
$ sudo update-alternatives --set php /usr/bin/7.3
But valet was still showing the wrong PHP version. Rebooting did not work. In fact, phpinfo() was displaying PHP 7.1.
After run ps -aux | grep php I noticed few instances of php-fpm (5.6, 7.1 and 7.2) running.
I stopped them
$ sudo service php5.6-fpm stop
$ sudo service php7.1-fpm stop
$ sudo service php7.2-fpm stop
Then started 7.3
$ sudo service php7.3-fpm start
And now my phpinfo() display the correct version of PHP
I ran into this same problem while using valet plus today. When I switched PHP versions it was showing the previous one in my browser but the correct one in my terminal. Looking at the my brew services list:
brew services list
It showed that one of the valet-php services (valet-php#7.2) was not in the service list but somehow my valet was able to switch to it. Valet didn't install this PHP properly and that's what was causing the issue. I did the following to uninstall that PHP and reinstall it with brew.
brew uninstall valet-php#7.2
sudo rm -rf /usr/local/Cellar/valet-php#7.2/7.2.34_1
brew install valet-php#7.2
The PHP version that was once not showing in the brew services list now showed and I was able to "stop" that php version's service:
brew services stop valet-php#7.2
which made everything work properly again without a restart.

how to install and run rethinkdb in cpanel?

I'm having a hard time getting the RethinkDb server up in cpanel. I'm able to run it smoothly in my local machine using windows os.
I follow instruction listed here to somehow install it in cpanel.
https://www.rethinkdb.com/docs/install/centos/
this is what exactly I typed in putty:
wget http://download.rethinkdb.com/dist/rethinkdb-2.3.6.tgz
tar xf rethinkdb-2.3.6.tgz
I tried the above step as well as manually downloaded the .tgz file,
extracted it and the continued with below command to no avail.
cd rethinkdb-2.3.6
./configure --allow-fetch --dynamic jemalloc
make
sudo make install
It seems like the installation goes on and on.
I waited until it complete installing and typed rethinkdb to start the server.
But it says undefined command.
Please guide me on how o install and run RethinkDb in cpanel.
Thanks.
Not sure why you are trying to install it from source and compile it since there are already created packages available for CentOS 6 & 7.
sudo wget http://download.rethinkdb.com/centos/7/`uname -m`/rethinkdb.repo -O /etc/yum.repos.d/rethinkdb.repo
sudo yum install rethinkdb
If it's CentOS 6, just then replace 7 with 6 after the CentOS repo.
Then just do a service rethinkdb start for CentOS 6.x or systemctl start rethinkdb for CentOS 7 and you should be good to go.

How to install PHP extension 'pcntl' on my Mac OSX

My operating system is:Mac OSX 10.11
I'm trying to install Phabricator on my Mac, when I execute the command of
phabricator cpopt$ ./bin/phd start
I got an error:
"ERROR: The PHP extension 'pcntl' is not installed. You must install it to run daemons on this machine."
I've search this problem on google and I got lots of solutions,but they all don't work to me,I'm almost in despair.
How can I achieve that?
Do you have brew installed (read here to install http://brew.sh/)?
Try:
brew install php
or if you need to install PHP 5.6 with brew you could do this:
brew install php#5.6
Then to include it in your PATH (if it is not automatically added), it may be necessary to run the commands in the CLI you may need to update your path, e.g. (this is the case if you were to brew install php#7.1 but was not the case when I just tested with brew install php - if you are using bash instead of zsh, change .zshrc to .bashrc.
echo 'export PATH="/usr/local/opt/php#7.1/bin:$PATH"' >> ~/.zshrc
echo 'export PATH="/usr/local/opt/php#7.1/sbin:$PATH"' >> ~/.zshrc
If that doesn't work, I wonder if phabricator is calling the right version of php.
Out of curiosity, what is the output you get from this? That is what phabricator is using to determine your php version.
/usr/bin/env php -v
Also... is your php.ini updated to have the pcntl extension? Run this to see your modules and look for pcntl:
php -i | grep pcntl
Double-check the php.ini that the php-cli is running:
php -i | grep php.ini
I had to do this to install the platform.sh command line tool. This was the top hit in Google so I'm adding this information. The process I followed was as below.
In Terminal:
Add yourself to the 'wheel' user group.
sudo dscl . append /Groups/wheel GroupMembership <username>
Grant group write access to /usr/local/bin
sudo chmod -R g+w /usr/local/bin
Link libpng for brew
brew link libpng
Install pcntl for php (5.6 in my case)
brew install homebrew/php/php56-pcntl
Just in case anyone else uses MAMP, I recently updated it to the latest version. Then I was getting the error
"ERROR: The PHP extension 'pcntl' is not installed. You must install it to run daemons on this machine."
I had not restarted my terminal since I updated it. After reloading the session everything worked fine.

Install pcntl extention on cent os 6.5 php 5.4.28

I have dedicated server on bluehost having CentOS 6.5 and PHP 5.4.28
I have an issue with regards to starting a service on specific port no. I log in from PuTTY as the root user, go to home/fleeton/public_html/socket, and give the following command:
php -q server.php
server.php has script to start service on port no 10000
After executing the above command, it shows me:
This example requires PCNTL extention
Can you help me what steps I need to follow to install it?
For php 5.4.x and centos 6.5 64, try this.
First you will need php-devel and gcc if don't have yet
yum install php54w-devel
If you don't have gcc
yum install gcc.x86_64
download php source code for your php version, you have installed on your server, for example php-5.4.xx.tar.gz from http://www.php.net/releases/
cd php-5.4.xx/ext/pcntl
phpize
./configure
make
copy the extension to modules folder, first find the location
php-config --extension-dir
cp modules/pcntl.so /usr/lib

How do I upgrade PHP in Mac OS X?

I feel this is an awfully obtuse question to ask, but strangely, this problem is poorly documented.
I would like to upgrade PHP, but there are several problems:
There is no built-in package manager. MacPorts doesn't recognize php as an installed package because it didn't install PHP itself.
Running locate php indicates there are probably many dependencies.
I don't know HOW php was installed, as it was included with the OS, so I don't know whether I should install from source or download binaries. I also don't know the proper way to uninstall the previous version without breaking dependencies.
I am running on Leopard. I have a feeling Apple doesn't want you to upgrade. Would buying Snow Leopard and upgrade solve this problem (and future ones like it)?
You may want to check out Marc Liyanage's PHP package. It comes in a nice Mac OS X installer package that you can double-click. He keeps it pretty up to date.
http://php-osx.liip.ch/
Also, although upgrading to Snow Leopard won't help you do PHP updates in the future, it will probably give you a newer version of PHP. I'm running OS X 10.6.2 and it has PHP 5.3.0.
I use this: https://github.com/Homebrew/homebrew-php
The command is:
$ xcode-select --install
$ brew tap homebrew/dupes
$ brew tap homebrew/versions
$ brew tap homebrew/homebrew-php
$ brew options php56
$ brew install php56
Then config in your .bash_profile or .bashrc
# Homebrew PHP CLI
export PATH="$(brew --prefix homebrew/php/php56)/bin:$PATH"
I think one simple way to do it, is:
1 - Check you where is your current PHP:
$ which php
$ /usr/local/bin/php
You see? Usually, our commands that we run is a link in /usr/local/bin so...
2 - Unlink this current link of PHP
unlink /usr/local/bin/php
If you prefere, before unlink it, check the path and then remove php files (do ls -al /usr/local/bin | grep php and then rm -rf into desired path)
3 - Install PHP 7.1
curl -s http://php-osx.liip.ch/install.sh | bash -s 7.1
4 - Create new link (using php 7.1 bin that you have installed)
ln /usr/local/php5-7.1.9-20170914-100859/bin/php /usr/local/bin/php
Like I said, its a simple way I think.
There is no built-in package manager. MacPorts doesn't recognize php as an installed package because it didn't install PHP itself.
You could still install it with MacPorts. sudo port install php52 (or whichever version you want) will install PHP.
It won't overwrite the Apple-supplied version. It'll install it under /opt/local. You can add /opt/local to the beginning of your $PATH, and use the MacPorts version in your Apache config.
Option #1
As recommended here, this site provides a convenient, up-to-date one liner.
This doesn't overwrite the base version of PHP on your system, but instead installs it cleanly in /usr/local/php5.
Option #2
My preferred method is to just install via Homebrew.
Before I go on, I have the latest version (v5.0.15) of OS X Server (yes, horrible, I know...however, the web server seems to work A-OK). I searched high and low for days trying to update (or at least get Apache to point to) a new version of PHP. My mcrypt did not work, along with other extensions and I installed and reinstalled PHP countless times from http://php-osx.liip.ch/ and other tutorials until I finally noticed a tid-bit of information written in a comment in one of the many different .conf files OS X Server keeps which was that OS X Server loads it's own custom .conf file before it loads the Apache httpd.conf (located at /etc/apache2/httpd.conf). The server file is located:
/Library/Server/Web/Config/apache2/httpd_server_app.conf
When you open this file, you have to comment out this line like so:
#LoadModule php5_module libexec/apache2/libphp5.so
Then add in the correct path (which should already be installed if you have installed via the http://php-osx.liip.ch/ link):
LoadModule php5_module /usr/local/php5/libphp5.so
After this modification, my PHP finally loaded the correct PHP installation. That being said, if things go wonky, it may be because OS X is made to work off the native installation of PHP at the time of OS X installation. To revert, just undo the change above.
Anyway, hopefully this is helpful for anyone else spending countless hours on this.
Upgrading to Snow Leopard won't solve the your primary problem of keeping PHP up to date. Apple doesn't always keep the third party software that it bundles up to date with OS updates. And relying on Apple to get you the bug fix / security update you need is asking for trouble.
Additionally, I would recommend installing through MacPorts (and doing the config necessary to use it instead of Apple's PHP) rather than try to upgrade the Apple supplied PHP in place. Anything you do to /usr/bin risks being overwritten by some future Apple update.
Saving on keystrokes, this worked on MacOS Sierra:
$ brew install homebrew/php/php71
$ /usr/local/opt/php71/bin/php -v
PHP 7.1.4 (cli) (built: Apr 14 2017 15:02:16) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies
Check your current php version in terminal with the following command,
$ php -v
You see current php version in terminal, and next command run in terminal if you want to upgrade your php version with php concat with version liked as,
$ brew install homebrew/php/php71
Please restart terminal if you finished php version upgrade installed and run the command.
$ php -v
Now you see the current php version in terminal....thank
Use this Command:
curl -s http://php-osx.liip.ch/install.sh | bash -s 7.0
You can use curl to update php version.
curl -s http://php-osx.liip.ch/install.sh | bash -s 7.3
Last Step:
export PATH=/usr/local/php5/bin:$PATH
Check the upgraded version
php -v
best way to upgrade is
compile it from source
see this tutorial that may be helful for you
http://www.computersnyou.com/2012/09/how-to-upgrade-php-in-mac-osx-compiling.html
to upgrade php7 to latest stable version brew upgrade php7
or for php5.X to latest stable version
brew upgrade php56
use brew list to check installed version

Categories