Skip to content

Commit d1d005a

Browse files
nmelehanGuaris
authored andcommitted
Update LAMP on Debian 8 to use PHP 7.3 (#2223)
1 parent d6f148d commit d1d005a

File tree

1 file changed

+33
-27
lines changed
  • docs/web-servers/lamp/lamp-on-debian-8-jessie

1 file changed

+33
-27
lines changed

docs/web-servers/lamp/lamp-on-debian-8-jessie/index.md

Lines changed: 33 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ author:
55
description: 'Get your website or web application online by setting up Apache, MySQL, and PHP'
66
keywords: ["debian 8 LAMP server", "debian LAMP", "LAMP howto", "lamp", "debian", "debian 8", "websites", "apache", "mysql", "php", "apache 2.4", "lamp debian"]
77
license: '[CC BY-ND 4.0](https://creativecommons.org/licenses/by-nd/4.0)'
8-
modified: 2015-12-01
8+
modified: 2019-01-02
99
modified_by:
10-
name: Alex Fornuto
10+
name: Linode
1111
published: 2015-06-29
1212
title: 'LAMP on Debian 8 (Jessie)'
1313
aliases: ['websites/lamp/lamp-server-debian-8/','websites/lamp/lamp-on-debian-8-jessie/']
@@ -50,15 +50,8 @@ Prior to installing your LAMP stack ensure that:
5050

5151
sudo apt-get install apache2
5252

53-
2. Edit the main Apache configuration file and turn off the `KeepAlive` setting:
5453

55-
{{< file "/etc/apache2/apache2.conf" aconf >}}
56-
KeepAlive Off
57-
58-
{{< /file >}}
59-
60-
61-
3. Open `/etc/apache2/mods-available/mpm_prefork.conf` in your text editor and edit the values as needed. The following is optimized for a 2GB Linode:
54+
1. Open `/etc/apache2/mods-available/mpm_prefork.conf` in your text editor and edit the values as needed. The following is optimized for a 2GB Linode:
6255

6356
{{< file "/etc/apache2/mods-available/mpm_prefork.conf" aconf >}}
6457
# prefork MPM
@@ -82,15 +75,15 @@ KeepAlive Off
8275

8376

8477
{{< note >}}
85-
These settings are good starting points, but should be adjusted to best suite your specific stack's needs.
78+
These settings are good starting points, but they should be adjusted to best suit your deployment's needs.
8679
{{< /note >}}
8780

88-
4. On Debian 8, the *event module* is enabled by default. This should be disabled, and the *prefork module* enabled:
81+
1. On Debian 8, the *event module* is enabled by default. This should be disabled, and the *prefork module* enabled:
8982

9083
sudo a2dismod mpm_event
9184
sudo a2enmod mpm_prefork
9285

93-
5. Restart Apache:
86+
1. Restart Apache:
9487

9588
sudo systemctl restart apache2
9689

@@ -106,7 +99,7 @@ There can be as many virtual hosts files as needed to support the amount of doma
10699

107100
Repeat the process if you intend on hosting multiple websites on your Linode.
108101

109-
2. Create an `example.com.conf` file in `/etc/apache2/sites-available` with your text editor, replacing instances of `example.com` with your own domain URL in both the configuration file and in the file name:
102+
1. Create an `example.com.conf` file in `/etc/apache2/sites-available` with your text editor, replacing instances of `example.com` with your own domain URL in both the configuration file and in the file name:
110103

111104
{{< file "/etc/apache2/sites-available/example.com.conf" aconf >}}
112105
<VirtualHost *:80>
@@ -136,7 +129,7 @@ There can be as many virtual hosts files as needed to support the amount of doma
136129
{{< /file >}}
137130

138131

139-
3. Symbolically link your virtual hosts files from the `sites-available` directory to the `sites-enabled` directory. Replace the filename with your own:
132+
1. Symbolically link your virtual hosts files from the `sites-available` directory to the `sites-enabled` directory. Replace the filename with your own:
140133

141134
sudo a2ensite example.com.conf
142135
sudo a2ensite example.org.conf
@@ -145,7 +138,7 @@ There can be as many virtual hosts files as needed to support the amount of doma
145138
Should you need to disable a site, you can use `a2dissite example.com`.
146139
{{< /note >}}
147140

148-
4. Restart Apache:
141+
1. Restart Apache:
149142

150143
sudo systemctl restart apache2
151144

@@ -162,7 +155,7 @@ MySQL is a *relational database management system* (RDBMS) and is a popular comp
162155

163156
Input a secure password when prompted by the installation.
164157

165-
2. Run `mysql_secure_installation` to remove the test database and any extraneous user permissions added during the initial installation process:
158+
1. Run `mysql_secure_installation` to remove the test database and any extraneous user permissions added during the initial installation process:
166159

167160
sudo mysql_secure_installation
168161

@@ -178,26 +171,39 @@ Next, you can create a database and grant your users permissions to use database
178171

179172
Enter MySQL's root password when prompted.
180173

181-
2. Create a database and grant your users permissions on it. Change the database name (`webdata`) and username (`username`). Change the password (`password`):
174+
1. Create a database and grant your users permissions on it. Change the database name (`webdata`) and username (`username`). Change the password (`password`):
182175

183176
create database webdata;
184177
grant all on webdata.* to 'username' identified by 'password';
185178

186-
3. Exit MySQL:
179+
1. Exit MySQL:
187180

188181
quit
189182

190183
## PHP
191184

192185
PHP makes it possible to produce dynamic and interactive pages using your own scripts and popular web development frameworks.
193186

194-
1. Install PHP 5 and the PHP Extension and Application Repository:
187+
### Install PHP
188+
189+
PHP 7.3 is the [latest version available](http://php.net/supported-versions.php) and has the longest period of support offered as of this guide's publishing:
190+
191+
1. Add the [sury.org](https://deb.sury.org) repository, which packages PHP 7.3 for Debian 8:
192+
193+
sudo apt install lsb-release apt-transport-https ca-certificates
194+
sudo wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
195+
echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/php7.3.list
196+
sudo apt update
197+
198+
1. Install PHP 7.3 and the PHP Extension and Application Repository:
199+
200+
sudo apt-get install php7.3 php-pear
195201

196-
sudo apt-get install php5 php-pear
202+
### Configure PHP
197203

198-
2. Open `/etc/php5/apache2/php.ini` in your text editor, and edit the following values. These settings are optimized for the 2GB Linode:
204+
1. Open `/etc/php/7.3/apache2/php.ini` in your text editor and edit the following values. These settings are optimized for the 2GB Linode:
199205

200-
{{< file "/etc/php5/apache2/php.ini" ini >}}
206+
{{< file "/etc/php/7.3/apache2/php.ini" ini >}}
201207
error_reporting = E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR
202208
error_log = /var/log/php/error.log
203209
max_input_time = 30
@@ -209,15 +215,15 @@ max_input_time = 30
209215
Ensure that all values are uncommented, by making sure they do not start with a semicolon (**;**).
210216
{{< /note >}}
211217

212-
3. Create the log directory for PHP and give the Apache user ownership:
218+
1. Create the log directory for PHP and give the Apache user ownership:
213219

214220
sudo mkdir /var/log/php
215221
sudo chown www-data /var/log/php
216222

217-
4. If you need support for MySQL in PHP, then you must install the php5-mysql package:
223+
1. If you need support for MySQL in PHP, then you must install the php7.3-mysql package:
218224

219-
sudo apt-get install php5-mysql
225+
sudo apt-get install php7.3-mysql
220226

221-
5. Restart Apache:
227+
1. Restart Apache:
222228

223229
sudo systemctl restart apache2

0 commit comments

Comments
 (0)