Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 1b7785f

Browse files
author
Jordan Hall
committed
Documentation!
1 parent 57fb895 commit 1b7785f

File tree

1 file changed

+76
-2
lines changed

1 file changed

+76
-2
lines changed

‎README.md‎

Lines changed: 76 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,76 @@
1-
# php-switch-scripts
2-
Scripts to aid in the setup of and switching between multiple PHP versions in Ubuntu 16.04 LTS
1+
# PHP Switch Scripts
2+
3+
These scripts are designed to aid in the setup of and switching between multiple PHP versions in Ubuntu 16.04 LTS.
4+
5+
Currently they support switching between PHP 5.6 and PHP 7.0.
6+
7+
Please note that these scripts install packages from a third-party repository, provided by Ondřej Surý. More details are available at [the repository's PPA page on Launchpad](https://launchpad.net/~ondrej/+archive/ubuntu/php/).
8+
9+
## Requirements
10+
11+
* Ubuntu 16.04.* LTS
12+
* Apache 2.4.*
13+
14+
You can check you have the required versions by running the following command.
15+
16+
```
17+
lsb_release -a | grep Ubuntu && apache2 -v | grep Apache
18+
```
19+
20+
Yuo should see something similar to the below.
21+
22+
```
23+
Description: Ubuntu 16.04.3 LTS
24+
Server version: Apache/2.4.18 (Ubuntu
25+
```
26+
27+
## Setup
28+
29+
First, clone the repository, and change directory if you have not already done so.
30+
31+
```
32+
https://github.com/rapidwebltd/php-switch-scripts.git
33+
cd php-switch-scripts
34+
```
35+
36+
Next, to setup all the supported PHP versions and common PHP extensions for them, you just need to run the `setup.sh` script. This is shown below.
37+
38+
```
39+
./setup.php
40+
```
41+
42+
This may take some time depending on your system and connection speed. It will also require you to enter your password to install new packages.
43+
44+
When you see a message similar to the following, setup is complete and you are ready to switch between PHP versions at will.
45+
46+
```
47+
* Setup complete. You may now use the 'switch-to-php-*.*.sh' scripts.`
48+
```
49+
50+
## Usage
51+
52+
Once setup is complete, you can easily switch between different PHP versions using the appropriately named scripts. Examples are shown below.
53+
54+
```
55+
./switch-to-php-5.6.sh
56+
./switch-to-php-7.0.sh
57+
```
58+
59+
This will alter the versions of PHP running in Apache and the command line. Your password will be required to enable/disable Apache modules, restart the web server and altering the default PHP CLI version.
60+
61+
## Verification
62+
63+
If you wish, you can check that the switch was complete successfully.
64+
65+
You can verify the command line version of PHP has changed with the following command.
66+
67+
```
68+
php -v | grep PHP
69+
```
70+
71+
You can check the version of PHP running in Apache by creating a new PHP file, that calls the `phpinfo()` method, then accessing it via a web browser. An example is shown below.
72+
73+
```php
74+
<?php phpinfo(); ?>
75+
```
76+

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /