How to have two version of PHP installed and switch easily?

1

On your system, if you have installed multiple versions of PHP (eg PHP 7.1 and PHP 5.6 both). PHP 7.1 is running as default PHP for Apache and CLI. For any requirement, you need to use PHP 5.6. Then you don’t need to remove PHP 7.1. You can simply switch your PHP version to default used for Apache and command line.

For example, your server has PHP 7.1 and PHP 5.6 both version’s installed. Now following example will help you to switch between both versions. The PHP 5.6 is configured as default PHP version for Apache and CLI. Let’s make PHP 7.1 as default PHP for Apache server and CLI.

Switch From PHP 5.6 => PHP 7.1

Default PHP 5.6 is set on your system and you need to switch to PHP 7.1. Run the following commands to switch for Apache and command line.

Apache:-

sudo a2dismod php5.6 sudo a2enmod php7.1 sudo service apache2 restart

Command Line:-

sudo update-alternatives --set php /usr/bin/php7.1 sudo update-alternatives --set phar...
0 0
2

You can download whatever versions of PHP you need and place them into their own directories, e.g.

c:\php5\

c:\php7\

All you need to do is tell your web server (Apache) which version of PHP to use, which you do by loading the appropriate module. In Apache you can do this by finding the file httpd.conf and then editing the appropriate line:

LoadModule php7_module c:\php7\libphp7.so

You'll have to figure out the correct paths of course - this is just for illustration.

Save httpd.conf and restart your server. Note, if you don't restart it, the changes won't take effect.

There's no GUI switch to be able to do this, you need to edit the .conf file and then restart Apache. Doing this only takes a couple of seconds and you could even comment out a version so "switching" only takes a couple of keystrokes, e.g.

Use PHP 5:

LoadModule php5_module c:\php5\libphp5.so #LoadModule php7_module c:\php7\libphp7.so

Use PHP 7:

...
0 0
3
...
0 0
4

This post will be for Wamp server users. I will explain, how to have both PHP 4 and 5 installed, and switch them at any time.

Wamp server is a brilliant tool for web developers (sadly it is Windows-only). It takes care of installing the big 3 (so you don’t have to do it manually):

Apache web server PHP scripting language module for Apache MySQL database server

And the installation is pretty easy and straightforward. But the really cool part, is the two click configuration of Wamp. After you install it, it sits in the Windows system tray. If you want to enable/disable an Apache module or change a PHP setting, all you have to do is click on the system tray icon of Wamp, then go to the menu of the respective application, dive into Apache modules, or PHP settings/extensions, and just put/remove a tick next to the setting you want changed. That’s it! No need for searching for configuration files and modifying them. The webserver is also automatically restarted, to make...

0 0
5

Versions

Vagrant: Vagrant 1.9.6 Provider: Virtualbox 5.1.24 Homestead: Laravel Homestead 2.2.2 (but 6.0.2 via composer install/upgrade ????)

Host operating system

Window 10 latest upgrades

Homestead.yaml

ip: 192.168.10.15
memory: 2048
cpus: 1
provider: virtualbox
authorize: ~/.vagrantssl/id_rsa.pub
keys:
- ~/.vagrantssl/id_rsa
folders:
- map: "C:/vagrant/gnu/staging_constantholidays_html"
to: "/home/vagrant/staging_constantholidays_html"
type: rsync
options:
# do build empty storage and cp_resources folders for Craft's needs
# don't avoid uploading imagess, but do avoid disturbing their _/ tranform folders
rsync__exclude: [".git/", ".git", ".vagrant/", "cp_resources/", "_notes/", ".idea/",
"buildtools/", "node_modules/", "storage/", "runtime/", "scss/", ".sass-cache/",
"vagrant."]
rsync__args: ["--verbose", "--archive", "--delete", "-z", "--copy-links"]

sites:
...

0 0
6

Is it possible to upgrade the version of PHP running on my server without any significant downtime?

What I want to avoid is my sites being down for minutes (or longer if something goes wrong) while I upgrade PHP. I don't mind if they're down for a few seconds.

Ideally I would like to have two versions of PHP installed on a server and just flick a switch to flip between them. That way if there are unforeseen problems with the new version I can flick the switch back again to go back to the old version.

The only way I can think of is to have two servers running different version of PHP and use DNS to choose which one users see. Is it possible with a single server?

Edit

I should have mentioned that I'm using an Ubuntu 10.04 server running Nginx and...

0 0
7

I’ve used XAMPP for as long as I can remember. I used it originally so I could learn and practice PHP without having to purchase hosting, however I use it now-a-days to develop sites locally before putting them into the public domain.

Each version of XAMPP comes by default with a specific version of PHP and MySQL. As we all know though, for whatever reason, different projects might require different versions of this software so I needed a way to move between them quickly.

If you do have XAMPP installed but, for example, require a different version of PHP then the obvious approach is to simply delete the current version of XAMPP and install the version which comes with the right version of PHP for the project in question.

Although this approach would work, this is not only going to make you lose all of your existing sites, but also make it very time consuming going forward if using different versions of XAMPP becomes common practice.

The Better/Easier...

0 0
8

Normally while we are in the development phase, we normally deal with a single version of PHP which is bundled with WAMP, MAMP or XAMPP. But how about if you want to switch your PHP [PHP Templates]version just to test your application on the different version of PHP? Also, what if you want to run your different application on the different version of PHP on the same machine? Just like Ruby and Python we now have the same tool available for PHP as well.

In this article, we will be talking about two different tools which provide the facility to run a multiplr version of PHP on a single machine and you can easily switch those versions from one to another. These tools are PHPBrew and VirtPHP. We will see how to get started with these best php tools.

PHPBrew

Key Features:

– Build PHP with different variants like PDO, MySQL, SQLite, debug

– Build and install PHP(s) in your home directory, so you don’t need root permission.

– Switch versions very...

0 0
9

This post describes how to configure IIS to support multiple versions of PHP on the same server. This kind of setup is useful in development environments where it is necessary to test an application with different PHP versions. Also, it is often used in production environments, where many PHP applications are hosted on the same server and some of them have dependency on a particular PHP version.

In order to setup multiple versions of PHP side by side on the same IIS server it is necessary to install PHP manually by following the steps described in php.net documentation for IIS 5.1 and IIS 6.0 and for IIS 7.0 and later. Do not use PHP Windows installer because it does not support side by side installations.

After a particular version of PHP has been installed in accordance to the instructions, download another version of PHP, extract it into a separate directory and configure it in accordance to Manual Installation Steps. After that proceed to configuring an IIS server...

0 0
10

This is a very strange topic: even though a cursory google search using the words “multiple php versions apache” spits out a considerable amount of informative howtos and blog entries, when I recently mentioned in a mailing list that it is in fact quite easy to have multiple php installs running in parallel using Apache virtual hosts, I immediately received a private request for my configuration.
Well, here it is, along with a few details on how to set up the complete environment.

The desired goal is having “alot” of php installations running in parallel, so that php scripts can be quickly tested against as many versions of php as possible. It is very useful f.e. when

you are migrating an existing app from php 4 to version 5 you are deploying your applications on a large base of servers where different versions of php are installed, but develop all the different apps on the same workstation you develop a popular open source php library or shrink wrapped application,...
0 0
11

Here at Site5, we offer multiple versions of PHP. Below we have outlined the current versions available and how to use them.

Currently, the default version of PHP is 5.5.x. If you want to use PHP 5.3.x, 5.4.x, or 5.5.x explicitly, just add one of the following commands to your .htaccess file.

PHP 5.5 (Default)

PHP 5.6

PHP 7.0

Note: Below is the direct PHP 5.5, 5.6, and 7.0 binary paths.

Also, please be aware that if you have CRON jobs that execute php scripts, you will need to update your CRON jobs so that they run the correct version of PHP that you wish to use. You can do this by prefixing your CRON jobs with the binary paths above.

For example, instead of using:
“php /home/username/public_html/script.php”

you would use:
“/usr/local/php70/bin/php /home/username/public_html/script.php” (please note the space between /php and/home)

That example would use PHP...

0 0