Alibaba Cloud server deployment php-7.3.13.tar.gz

4) Install libzip library

[root@nextcloud ~]# wget -c https://nih.at/libzip/libzip-1.2.0.tar.gz
[root@nextcloud ~]# tar xf libzip-1.2.0.tar.gz -C /usr/src/
[root@nextcloud ~]# cd /usr/src/libzip-1.2.0/
[root@nextcloud libzip-1.2.0]# ./configure && make -j 8 && make install -j 8 && cd ~
[root@nextcloud ~]# cp /usr/local/lib/libzip/include/zipconf.h /usr/local/include/zipconf.h
[root@nextcloud ~]# cat > /etc/ld.so.conf.d/local.conf << EOF
/usr/local/lib64
/usr/local/lib
/usr/lib
/usr/lib64
EOF
[root@nextcloud ~]# ldconfig -v

5) Deploy PHP

1. Download and install PHP

[root@nextcloud ~]# wget -c https://www.php.net/distributions/php-7.3.13.tar.gz
[root@nextcloud ~]# tar xf php-7.3.13.tar.gz -C /usr/src/
[root@nextcloud ~]# cd /usr/src/php-7.3.13/
[root@nextcloud php-7.3.13]# ./configure --prefix=/usr/local/php7 --with-config-file-path=/usr/local/php7 --enable-mbstring --enable-fpm \
--with-gd --with-zlib --enable-inline-optimization --with-jpeg-dir=/usr/lib --disable-debug --disable-rpath \
--enable-shared --with-libxml-dir --with-xmlrpc --enable-soap  --with-openssl --enable-exif --enable-fileinfo \
--enable-filter --with-pcre-dir --enable-ftp --with-openssl-dir --with-jpeg-dir --with-png-dir --with-zlib-dir \
--with-freetype-dir --with-gettext --with-gmp --enable-json --enable-mbregex --enable-mbregex-backtrack \
--with-onig --enable-pdo --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-zlib-dir  --with-pdo-sqlite  --enable-session --enable-shmop \
--enable-simplexml --enable-sockets --enable-sysvmsg --enable-sysvsem --enable-sysvshm --enable-wddx --with-libxml-dir --with-xsl --enable-zip \
--enable-mysqlnd-compression-support --with-pear --enable-opcache --with-mhash --with-pcre-regex --with-sqlite3 --enable-bcmath --with-iconv --with-bz2 \
--enable-calendar --with-curl --with-cdb --enable-dom --without-pear --disable-phar && make -j 8 && make install -j 8

2. Copy the reference file and create a soft link for PHP

[root@nextcloud php-7.3.13]# cp php.ini-production /usr/local/php7/php.ini
[root@nextcloud php-7.3.13]# ln -s /usr/local/php7/bin/* /usr/local/bin/
[root@nextcloud php-7.3.13]# ln -s /usr/local/php7/sbin/* /usr/local/sbin/ && cd ~

11) Edit the PHP configuration file and optimize the corresponding parameters to improve performance

Note: There are almost all the configuration items in the PHP configuration file, but they are all comments. Just open it and adjust the corresponding parameters.

[root@nextcloud ~]# cp /usr/local/php7/php.ini /usr/local/php7/php.ini.bak
[root@nextcloud ~]# vim /usr/local/php7/php.ini
memory_limit = 1024M
max_execution_time = 0
post_max_size = 10800M
upload_max_filesize = 10240M
opcache.enable=1
opcache.enable_cli=1
opcache.fast_shutdown = 1
opcache.save_comments = 1
opcache.revalidate_freq = 5
opcache.validate_timestamps = 0
opcache.memory_consumption = 512
opcache.interned_strings_buffer = 8
opcache.max_accelerated_files = 10000
zend_extension = /usr/local/php7/include/php/ext/opcache.so

12) Copy the template file and change the path of the PID to an absolute path

[root@nextcloud ~]# cp /usr/local/php7/etc/php-fpm.conf.default  /usr/local/php7/etc/php-fpm.conf
[root@nextcloud ~]# cp /usr/local/php7/etc/php-fpm.d/www.conf.default  /usr/local/php7/etc/php-fpm.d/www.conf
[root@nextcloud ~]# sed -i 's#;pid = run/php-fpm.pid#pid = /usr/local/php7/var/run/php-fpm.pid#' /usr/local/php7/etc/php-fpm.conf

13) Change the owner and group, and open the dynamic mode, adjust the dynamic parameters, and finally need to open the environment variables and variables

[root@nextcloud ~]# cp /usr/local/php7/etc/php-fpm.d/www.conf /usr/local/php7/etc/php-fpm.d/www.conf.bak
[root@nextcloud ~]# vim /usr/local/php7/etc/php-fpm.d/www.conf
user = nginx
group = nginx
pm = dynamic
pm.max_children = 130
pm.start_servers = 15
pm.min_spare_servers = 6
pm.max_spare_servers = 35
 
env[HOSTNAME] = $HOSTNAME
env[PATH] = /usr/local/bin:/usr/bin:/bin
env[TMP] = /tmp
env[TMPDIR] = /tmp
env[TEMP] = /tmp

14) When starting the php-fpm service, everyone first checks it with the -t option, and then you can start the php-fpm service. If there are errors, then follow the prompts to check, and finally use the -m option to see which modules you have installed

[root@nextcloud ~]# /usr/local/sbin/php-fpm -t  #检查
[20-Dec-2019 15:14:12] NOTICE: configuration file /usr/local/php7/etc/php-fpm.conf test is successful
[root@nextcloud ~]# echo $?
0
 
[root@nextcloud ~]# /usr/local/sbin/php-fpm    #以上检查成果之后就使用此命令启动 php-fpm 服务
 
[root@nextcloud ~]# /usr/local/sbin/php-fpm -m  #使用 -m 选项、查看自己安装了那些模块
bcmath
bz2
calendar
cgi-fcgi
Core
ctype
curl
date
dba
dom
exif
fileinfo
filter
ftp
gd
gettext
gmp
hash
iconv
imagick
intl
json
libxml
mbstring
mysqli
mysqlnd
openssl
pcre
PDO
pdo_mysql
pdo_sqlite
posix
redis
Reflection
session
shmop
SimpleXML
soap
sockets
SPL
sqlite3
standard
sysvmsg
sysvsem
sysvshm
tokenizer
wddx
xml
xmlreader
xmlrpc
xmlwriter
xsl
zip
zlib
Published 20 original articles · Like 98 · Visit 4510

Guess you like

Origin blog.csdn.net/sadcd/article/details/104934784