No.6 basic configuration and optimization of PHP

Source: Internet
Author: User
Tags sapi

Php
Download
http://www.php.net/downloads.php
Installation
Yum-y Install libxml2-devel libcurl-devel libjpeg-devel libpng-devel freetype-devel libxslt-devel gcc gcc-c++
Openssl-devel
Tar XF php-7.2.3.tar.bz2-c/tmp
./configure--prefix=/usr/local/php--with-curl--with-freetype-dir--with-gd--with-gettext--with-iconv-dir--with-
Jpeg-dir--with-kerberos--with-libdir=lib64--with-libxml-dir--with-mysqli--with-openssl--with-pcre-regex--with-
Pdo-mysql--with-pdo-sqlite--with-pear--with-png-dir--with-xmlrpc--with-xsl--with-zlib--enable-fpm--enable-
Bcmath--enable-libxml--enable-inline-optimization--enable-mbregex--enable-mbstring--enable-opcache--
Enable-pcntl--enable-shmop--enable-soap--enable-sockets--enable-sysvsem--enable-xml--enable-zip--with-
Fpm-group=nginx--with-fpm-user=nginx
Make
Make install
CP sapi/fpm/init.d.php-fpm/etc/init.d/php-fpm && chmod 755/etc/init.d/php-fpm #RHEL6 startup script
CP sapi/fpm/php-fpm.service/usr/lib/systemd/system/#RHEL7 Startup script
cp/usr/local/php/etc/{php-fpm.conf.default,php-fpm.conf} #php The-FPM master configuration file
Cp/usr/local/php/etc/php-fpm.d/www.conf{.default,} # PHP-FPM child configuration file
CP Php.ini-production/usr/local/php/lib/php.ini # Main configuration file for PHP
Note: If you do not specify a path using the--with-config-file-path=/path parameter at./configure, the default PHP configuration file path
Under the/usr/local/php/lib; If the./configure is not using--with-fpm-group=nginx--with-fpm-user=nginx, the default php-
The owner and genus of the fpm process are nobody
[[email protected] php-fpm.d]# GREP-PV "^ ($|#|;)"/usr/local/php/etc/php-fpm.d/www.conf [www] user = Nginx
Group = Nginx Listen = 127.0.0.1:9000 #跟据环境所需改变绑定的IP与监听的port pm = Work of dynamic #php-FPM
mode, recommended dynamic Pm.max_children = 5 Pm.start_servers = 2 Pm.min_spare_servers = 1
Pm.max_spare_servers = 3
[Email protected] ~]# systemctl start php-fpm
[[email protected] ~]# lsof-i:9000 COMMAND PID USER FD TYPE DEVICE size/off NODE NAME php-fpm 84636
Root 6u IPv4 206840 0t0 tcp Localhost:cslistener (LISTEN) main process php-fpm 84637 nginx 0u IPv4 206840 0t0 TCP
Localhost:cslistener (LISTEN) worker process php-fpm 84638 nginx 0u IPv4 206840 0t0 TCP Localhost:cslistener
(LISTEN)
Add the module that calls fastcgi in the Nginx configuration file:

Description:/data/wwwroot is the path of PHP storage; PHP-FPM and Nginx can be detached (deployed on different servers)
Phpredis

Validation: Redis-related modules can be found when using the Phpinfo () function output
Optimization of PHP

No.6 basic configuration and optimization of PHP

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.