Giter Club home page Giter Club logo

phpversionswitcher's Introduction

PhpVersionSwitcher

PhpVersionSwitcher screenshot

Installation

  1. Download and extract a release archive to directory of your choice

  2. Create a base directory for PHP with the following structure:

    %phpDir%/
    ├── configurations/
    │   ├── 5.x.x.ini        # php.ini options for all 5.x.x versions
    │   ├── 5.3.x.ini        # php.ini options for all 5.3.x versions
    │   ├── 5.3.7.ini        # php.ini options specific for 5.3.7 version
    │   └── ...
    └── versions/
        ├── 5.3.7/
        │   ├── ext/
        │   ├── ...
        │   └── php.exe
        ├── 5.6.0-rc3/
        │   ├── ext/
        │   ├── ...
        │   └── php.exe
        └── ...
    
  3. Create php.ini files in the configurations directory. In all php.ini files you can use %phpDir% variable. This is especially useful for zend_extension, e.g.

    zend_extension = "%phpDir%\ext\php_opcache.dll"
    zend_extension = "%phpDir%\ext\php_xdebug.dll"
    
  4. The active PHP version is always symlinked to %phpDir%\active. You may want to add this directory to PATH.

  5. Update phpDir option in PhpVersionSwitcher.json to contain path to the base PHP directory.

Apache + PHP module

  1. Add Apache service definition under services key:

    {
    	"services": [
    		{
    			"label": "Apache 2.4",
    			"name": "Apache2.4"
    		}
    	]
    }
    
  2. Update Apache configuration to contain something like this:

    LoadModule php5_module "C:/web/php/active/php5apache2_4.dll"
    PHPIniDir "C:/web/php/active"
    AddHandler application/x-httpd-php .php
    
  3. You can use PHP_VERSION_MAJOR variable in Apache configuration file. This is useful when you switch between PHP 5 and PHP 7 versions:

    LoadModule php${PHP_VERSION_MAJOR}_module "C:/web/php/active/php${PHP_VERSION_MAJOR}apache2_4.dll"
    

Nginx + PHP FastCGI

  1. Add Nginx and PHP FastCGI definitions under executables key:

    {
    	"executables": [
    		{
    			"label": "Nginx 1.9",
    			"path": "C:\\web\\nginx\\nginx.exe"
    		},
    		{
    			"label": "PHP FastCGI",
    			"path": "C:\\web\\php\\active\\php-cgi.exe",
    			"multiple": [
    				{"args": "-b 127.0.0.1:9300", "label": "PHP FastCGI (9300)"},
    				{"args": "-b 127.0.0.1:9301", "label": "PHP FastCGI (9301)"},
    				{"args": "-b 127.0.0.1:9302", "label": "PHP FastCGI (9302)"},
    				{"args": "-b 127.0.0.1:9303", "label": "PHP FastCGI (9303)"},
    				{"args": "-b 127.0.0.1:9304", "label": "PHP FastCGI (9304)"},
    				{"args": "-b 127.0.0.1:9305", "label": "PHP FastCGI (9305)"},
    				{"args": "-b 127.0.0.1:9306", "label": "PHP FastCGI (9306)"},
    				{"args": "-b 127.0.0.1:9307", "label": "PHP FastCGI (9307)"},
    				{"args": "-b 127.0.0.1:9308", "label": "PHP FastCGI (9308)"},
    				{"args": "-b 127.0.0.1:9309", "label": "PHP FastCGI (9309)"}
    			]
    		},
    	]
    }
    
  2. Update Nginx configuration to contain something like this:

    upstream php_farm {
    	server 127.0.0.1:9300 weight=1;
    	server 127.0.0.1:9301 weight=1;
    	server 127.0.0.1:9302 weight=1;
    	server 127.0.0.1:9303 weight=1;
    	server 127.0.0.1:9304 weight=1;
    	server 127.0.0.1:9305 weight=1;
    	server 127.0.0.1:9306 weight=1;
    	server 127.0.0.1:9307 weight=1;
    	server 127.0.0.1:9308 weight=1;
    	server 127.0.0.1:9309 weight=1;
    }
    
    location ~ \.php$ {
    	fastcgi_pass   php_farm;
    	fastcgi_index  index.php;
    	fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
    	include        fastcgi_params;
    }
    

PHP built-in server

  1. Add definition under executables key:

    {
    	"executables": [
    		{
    			"label": "PHP built-in server",
    			"path": "C:\\web\\php\\active\\php.exe",
    			"args": "-S 127.0.0.1:9990 -t C:\\projects"
    		}
    	]
    }
    

License

The MIT License (MIT)

Copyright (c) 2014 Jan Tvrdík

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Icons

Application icon made by Picol, state icons by Freepik from www.flaticon.com, all are modified by Jan Skrasek and licensed under CC BY 3.0.

phpversionswitcher's People

Contributors

hrach avatar jantvrdik avatar martinhorsky avatar

Watchers

 avatar  avatar

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.