]> BookStack Code Mirror - website/blob - content/docs/admin/updating-php.md
Merge branch 'v24-05'
[website] / content / docs / admin / updating-php.md
1 +++
2 title = "Updating PHP & Composer"
3 date = "2024-05-08"
4 type = "admin-doc"
5 +++
6
7 While we try to ensure a fairly steady & stable path for BookStack updates, requirements do change
8 as software develops & moves on. In particular, the minimum required version of PHP will increase
9 about once per year. Every so often we also may require a new minimum version of composer to be used
10 for BookStack. This page details the common steps required to update these both.
11
12 ---
13
14 ## Updating PHP
15
16 Currently the minimum version of PHP required by BookStack is PHP 8.1. You'll need to update PHP if using a version lower than 8.1. 
17 You can usually check your installed PHP version by running `php -v` but in some cases your web-server could be running a different PHP version than what the command line reflects. 
18
19 <details>
20 <summary>Updating to PHP 8.3 on most Debian & Ubuntu based systems using Apache</summary>
21
22 The commands below provide an example of how PHP can be updated to the PHP 8.3 on most Debian & Ubuntu based systems
23 that are running PHP via Apache using mod-php.
24
25 **Warnings:** 
26   - In most cases, especially if installed using our scripts and updating from a recent BookStack version, you won't need to update PHP using the below as you'll already be using PHP 8.1 or greater.
27   - If you run other applications on this machine, PHP applications in particular, then those may also be affected by these changes.
28
29 ```bash
30 sudo apt update
31 sudo apt install software-properties-common
32 sudo add-apt-repository ppa:ondrej/php
33 sudo apt update
34 sudo apt install -y php8.3 php8.3-curl php8.3-mbstring php8.3-ldap php8.3-xml php8.3-zip php8.3-gd php8.3-mysql libapache2-mod-php8.3
35 sudo a2dismod php7.4 php8.0 php8.1 php8.2
36 sudo a2enmod php8.3
37 sudo systemctl restart apache2
38 ```
39
40 You may also need to [update `composer`](#updating-composer) to be compatible with php8.3.
41
42 </details>
43
44 ---
45
46 ## Updating Composer
47
48 You can check your current composer version by running `composer -V`. 
49 You can often update composer by running `sudo composer self-update` (Or you may be prompted to run `sudo composer self-update --2`).
50 Typically it's fine, and best practice, to be using the latest version of composer rather than a specific version near our minimum requirements.
51
52 If you're using a system-supplied composer package you may need to first uninstall that (eg. `sudo apt remove composer`) then follow the [composer download documentation](https://getcomposer.org/download/) to get the latest version. Take notice of the `sudo mv composer.phar /usr/local/bin/composer` command shown in the documentation to install composer globally for easier usage.