php ubuntu server environment to build simple

Chinese support for installation, to avoid some of the language related to pit

1
2
3
4
5
6
7
8
sudo apt-get install language-pack-zh-hans

sudo vim /etc/default/locale


LANG="en_US.UTF-8"
LANGUAGE="zh_CN.utf8"
LC_ALL="zh_CN.utf8"

Installing PHP

Here is the installation of PHP 7.2, for simplicity, we directly use the ready-made package (of course, you can also use the source code to compile).

1
2
3
4
5
6
7
8
9
10
# Install the software before you can use it PPA
sudo apt-get install -y software- properties-common

# Install PPA
sudo ppa the Add-APT-Repository: Ondrej / PHP

sudo apt-get update

# Install PHP 7.2, if additional expansion, the latter can then install
sudo apt-get install php7.2

Tuning php

We are about to use nginx with php-fpm to use, so the configuration file path /etc/php/7.2/fpm/php.ini

Easily lead to the question of amending a memory overflow php.ini

modify pcre.recursion_limit=5000

Other adjustments

1
2
3
Big Box   ubuntu server php environment to build simple ass = "code">
max_input_vars = 20000

post_max_size = 50M

Installation fpm

1
sudo apt-get install php7.2-fpm

Tuning php-fpm

Modify /etc/php/7.1/fpm/php-fpm.conf

1
2
emergency_restart_threshold = 10 
emergency_restart_interval = 1m

FPM-/etc/php/7.2/fpm/pool.d/ modify PHP www.conf

1
2
3
4
5
6
7
8
9
10
listen = 127.0.0.1:9000 
listen.allowed_clients = 127.0.0.1
pm.max_children = 51
pm.start_servers = 3
pm.min_spare_servers = 2
pm.max_spare_servers = 4
pm.max_requests = 1000

slowlog = /var/log/$pool.log.slow
request_slowlog_timeout = 5s

Install nginx

sudo apt-get install nginx

PHP7.2 expand

1
sudo apt-get install php7.2-mbstring php7.2-xml php7.2-intl

Guess you like

Origin www.cnblogs.com/lijianming180/p/12370481.html