Replace unnecessary instructions with apt command

This commit is contained in:
Dominik Chrástecký 2020-07-13 20:51:37 +02:00 committed by GitHub
parent 3e5673d8f5
commit 8d4b739abd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -402,113 +402,9 @@ php-fpm7.4 -v
Install some required extensions: Install some required extensions:
```bash ```bash
sudo apt install php7.4-common php7.4-mysql php7.4-dev php7.4-mbstring php7.4-gd php7.4-imagick php7.4-opcache php7.4-soap php7.4-zip php7.4-cli php7.4-curl -y sudo apt install php7.4-common php7.4-mysql php7.4-dev php7.4-mbstring php7.4-gd php7.4-imagick php7.4-opcache php7.4-soap php7.4-zip php7.4-cli php7.4-curl php-mailparse php-gnupg -y
``` ```
Now we need to install the php-mailparse (for parsing emails) and php-gnupg (for encrypting emails) extensions.
Install the required tools:
```bash
sudo apt install autoconf libpcre3-dev
```
Check out the latest versions here:
https://pecl.php.net/package/mailparse
https://pecl.php.net/package/gnupg
At the time of writing this the latest version for mailparse is 3.0.4 and for gnupg is 1.4.0.
You need to switch to the root user in order to install these next two extensions
```bash
sudo su
```
### Method 1.
```bash
cd ~
wget http://pear.php.net/go-pear.phar
php go-pear.phar
pecl install mailparse
pecl install gnupg
```
When installing mailparse you may get an error stating: "The mailparse extension requires the mbstring extension" even though you do have it installed. This is a known bug, please install mailparse using Method 2 below.
If you get this error "configure: error: Please reinstall the gpgme distribution" then run
```bash
sudo apt install libgpgme11-dev
```
If you have issues with the above then follow the instructions below for option 2.
### Method 2.
First let's install mailparse
Set a couple of variables:
```bash
MODULE_NAME="mailparse"
MODULE_VERSION="3.1.0"
```
```bash
cd ~
# download using pecl
pecl download $MODULE_NAME
# or you can use wget if pecl is not found
wget https://pecl.php.net/get/$MODULE_NAME-$MODULE_VERSION.tgz
tar -zxvf $MODULE_NAME-$MODULE_VERSION.tgz
cd $MODULE_NAME-$MODULE_VERSION
# Ignore the error that appears if you have never compiled it before
make clean
phpize7.4 -clean
phpize7.4
./configure --with-libdir=lib64 CFLAGS='-O2 -fPIE -fstack-protector-strong -Wformat -Werror=format-security -Wall -pedantic -fsigned-char -fno-strict-aliasing'
# For mailparse only! Due to a known bug where it thinks mbstring is not installed even though it is
sed -i 's/#if\s!HAVE_MBSTRING/#ifndef MBFL_MBFILTER_H/' ./mailparse.c
make install
echo "extension=$MODULE_NAME.so" > /etc/php/7.4/mods-available/$MODULE_NAME.ini
# Create symbolic links
ln -s /etc/php/7.4/mods-available/$MODULE_NAME.ini /etc/php/7.4/fpm/conf.d/20-$MODULE_NAME.ini
ln -s /etc/php/7.4/mods-available/$MODULE_NAME.ini /etc/php/7.4/cli/conf.d/20-$MODULE_NAME.ini
service php7.4-fpm restart
```
Follow the steps above again for gnupg but make sure to change `MODULE_NAME` and `MODULE_VERSION` like below:
```bash
MODULE_NAME="gnupg"
MODULE_VERSION="1.4.0"
```
Check the installed modules to see if both are there.
```bash
php -m
```
If you are still logged in as the root user `exit` back to johndoe.
```bash ```bash
sudo nano /etc/php/7.4/fpm/pool.d/www.conf sudo nano /etc/php/7.4/fpm/pool.d/www.conf
``` ```