Coder Social home page Coder Social logo

jalendport / switch-php Goto Github PK

View Code? Open in Web Editor NEW
123.0 123.0 28.0 21.43 MB

Easily switch between PHP versions on your Mac. Requires Homebrew and works with Laravel Valet. πŸ”€

Home Page: https://www.npmjs.com/package/switch-php

License: MIT License

Shell 100.00%
cli laravel-valet php php-versions php5 php7 php70 php71 php72 shell shell-script shell-scripts terminal valet

switch-php's Introduction

Hi there πŸ‘‹

switch-php's People

Contributors

danielwaghorn avatar jalendport avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

switch-php's Issues

Stuck on [email protected] after attempting to switch to [email protected]

I have [email protected] and [email protected] installed with brew. Running php switcher gives the following:

$ switch-php 5.6 -v
 πŸ‘€  Verifying that Valet is installed...
Password:
 πŸ”  Checking which PHP versions are installed...
 πŸ›‘  Stopping Valet...
 ==>  Stopping nginx...
 βœ…  Valet stopped
 πŸ”€  Switching to [email protected]...
 ==>  Stopping [email protected]...
 ==>  Unlinking [email protected]...
 ==>  Stopping [email protected]...
 ==>  Unlinking [email protected]...
 ==>  Linking [email protected]...
 ==>  Starting [email protected]...
 βœ…  PHP switched
 βš™  Starting Valet...
 ==>  Starting nginx...
 βœ…  Valet started

You are now using PHP 7.1.20

Showing the version gives php 7.1.20

php -v 
PHP 7.1.20 (cli) (built: Jul 20 2018 10:27:12) ( NTS )

Exited terminal, restarted and reading the #2 issue fired the following:

$ brew link --overwrite php
Error: No such keg: /usr/local/Cellar/php

Brew doctor:

Warning: Broken symlinks were found. Remove them with `brew prune`:
  /usr/local/bin/php

Then tried manually unlink 7.1:

$ brew unlink [email protected]
Unlinking /usr/local/Cellar/[email protected]/7.1.20... 0 symlinks removed

and relink 5.6:

$Β brew link --overwrite --force [email protected]

Linking /usr/local/Cellar/[email protected]/5.6.37... 25 symlinks created

If you need to have this software first in your PATH instead consider running:
  echo 'export PATH="/usr/local/opt/[email protected]/bin:$PATH"' >> ~/.bash_profile
  echo 'export PATH="/usr/local/opt/[email protected]/sbin:$PATH"' >> ~/.bash_profile

..but phpinfo() show me 7.1.20 yet

Command won't change PHP version at all on mac

I'm running mac 10.13 High Sierra. My macos came with php7.1 installed, but I'm trying to use 7.3.

This is the outcome of "php -v" in terminal:

Captura de Tela 2021-04-26 aΜ€s 11 06 31

I've installed php 7.3 via HomeBrew and now whenever I try to swicth versions, I get this:

Captura de Tela 2021-04-26 aΜ€s 11 07 44

First it says that I'm already using php7.3 which is not true since my php -v command returned php 7.1.
Second, it says that is starting php7.3 and immediately returns saying that I am now using php7.1.

Any ideas as to why this is happening?

Use platform from composer.json

When platform is specified in composer.json, this should be used for switch-php (possibly abbreviated to minor level).
This should work analog to nvm by not specifying any further arguments.

Stuck on [email protected] after attempting to switch to [email protected]

I love the idea for this but I can't seem to get it to work correctly. I originally had only PHP 7.1 installed with Homebrew and I use Valet... To test the script I went ahead and just now installed 7.2 with Homebrew then tried to switch:

> switch-php 72 -v -m 512M                                                                               

 πŸ‘€  Verifying that Valet is installed...
Password:
 πŸ”  Checking which PHP versions are installed...
 πŸ›‘  Stopping Valet...
 ==>  Stopping nginx...
 βœ…  Valet stopped
 πŸ”€  Switching to php72...
 ==>  Stopping php71...
 ==>  Unlinking php71...
 ==>  Stopping php72...
 ==>  Unlinking php72...
 ==>  Linking php72...
 ==>  Starting php72...
 βœ…  PHP switched
 βš™  Starting Valet...
 ==>  Starting nginx...
 ==>  Starting dnsmasq...
 βœ…  Valet started
 πŸŽ›  Configuring PHP...
 ==>  Setting PHP memory to 512M...
 ==>  Restarting PHP...
 βœ…  PHP configured

You are now using PHP 7.1.14

Bug? Did I maybe not install 7.2 correctly? I installed 7.2 with brew install php72 php72-igbinary php72-imagick php72-memcached

Imagemagick works on 7.3, but not on 7.2

I've installed imagemagick php and [email protected]

switch-php 7.3
PHP switched βœ”

You are now using PHP 7.3.4

switch-php 7.2      
PHP switched βœ”
PHP Warning:  PHP Startup: Unable to load dynamic library 'imagick.so' (tried: /usr/local/lib/php/pecl/20170718/imagick.so (dlopen(/usr/local/lib/php/pecl/20170718/imagick.so, 9): image not found), /usr/local/lib/php/pecl/20170718/imagick.so.so (dlopen(/usr/local/lib/php/pecl/20170718/imagick.so.so, 9): image not found)) in Unknown on line 0

You are now using PHP 
Warning: PHP Startup: Unable to load dynamic library 'imagick.so' (tried: /usr/local/lib/php/pecl/20170718/imagick.so (dlopen(/usr/local/lib/php/pecl/20170718/imagick.so, 9): image not found), /usr/local/lib/php/pecl/20170718/imagick.so.so (dlopen(/usr/local/lib/php/pecl/20170718/imagick.so.so, 9): image not found)) in Unknown on line 0
7.2.17

How do I have imagemagick work for both 7.3 and 7.2

Changed formula names in brew

I stumbled across this software when looking through random twitter posts. Since homebrew recently merged all the php formulas in to the core distribution you might want to consider changing the formula names to the new ones.

False "PHP switched" message

$ switch-php 7.2
PHP switched βœ”

You are now using PHP 5.4.45
$ which php
/usr/local/bin/php
$ php --version
PHP 5.4.45 (cli) (built: Nov  9 2017 14:09:48)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2014 Zend Technologies

I assume it's because my PHP is not installed via brew. It'd be nice if the tool can show error instead of saying it was successful

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.