目录
# yum -y install libsqlite3x-devel db4-devel gdbm-devel oniguruma-devel libtiff-devel libwebp-devel libimagequant-devel libxml2 libxml2-devel openssl openssl-devel bzip2 bzip2-devel libcurl libcurl-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel gmp gmp-devel libmcrypt libmcrypt-devel readline readline-devel libxslt libxslt-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel ncurses curl gdbm-devel db4-devel libXpm-devel libX11-devel gd-devel gmp-devel expat-devel xmlrpc-c xmlrpc-c-devel libicu-devel libmcrypt-devel libmemcached-devel gcc-c++ openldap openldap-devel readline-devel libsodium-devel libargon2-devel libxslt-devel pcre2-devel # ln -sv /usr/lib64/libldap* /usr/lib/
# wget https://ftp.pcre.org/pub/pcre/pcre2-10.37.tar.gz # tar xf pcre2-10.37.tar.gz # cd pcre2-10.37 # ./configure --prefix=/usr/local/pcre2-10.37 --enable-pcre2-16 --enable-pcre2-32 --enable-jit --enable-jit-sealloc # make -j 8 && make install # ln -sv /usr/local/pcre2-10/lib/pkgconfig/* /usr/lib64/pkgconfig/
# wget https://libzip.org/download/libzip-1.8.0.tar.gz # tar xf libzip-1.8.0.tar.gz # cd libzip-1.8.0 # mkdir build && cd build # /usr/local/cmake-3.21.3/bin/cmake .. # make -j 8 # make install # ln -sv /usr/local/lib64/pkgconfig/libzip.pc /usr/lib64/pkgconfig/回到顶部
# groupadd -r -g 2001 nginx && useradd -r -m -s /sbin/nologin -u 2001 -g 2001 nginx回到顶部
# wget https://www.php.net/distributions/php-7.4.24.tar.gz # tar xf php-7.4.24.tar.gz # cd php-7.4.24 # ./configure --prefix=/usr/local/php-7.4.24 --enable-fpm --with-fpm-user=www --with-fpm-group=www --with-config-file-path=/usr/local/php-7.4.24/conf --disable-rpath --enable-option-checking=fatal --with-pic --enable-ftp --enable-soap --with-xmlrpc --with-openssl --with-mhash --with-external-pcre --with-zlib --enable-bcmath --with-bz2 --enable-calendar --with-curl --enable-exif --with-openssl-dir --with-jpeg --with-zlib-dir --with-freetype --with-gettext --with-gmp --enable-mbstring --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-readline --enable-shmop --enable-sockets --enable-sysvmsg --with-xsl --with-zip --with-pear --enable-opcache --enable-session --enable-xml --with-webp --with-xpm --with-gdbm --with-ldap=shared --with-sodium=shared --with-password-argon2 --with-libxml # make -j 8 && make install回到顶部
# mkdir -pv /usr/local/php-7.4.24/conf # cp php.ini-production /usr/local/php-7.4.24/conf/php.ini #php源码包目录 # chmod 644 /usr/local/php-7.4.24/conf/php.ini回到顶部
# cd ext/gd/ #php源码包 # /usr/local/php-7.4.24/bin/phpize # ./configure --with-php-config=/usr/local/php-7.4.24/bin/php-config --with-freetype --with-jpeg --enable-gd --enable-gd-jis-conv # make -j 8 && make install # echo "extension=gd" >> /usr/local/php-7.4.21/conf/php.ini
# yum install ImageMagick ImageMagick-devel -y # /usr/local/php-7.4.24/bin/pecl install imagick # echo "extension=imagick.so" >> /usr/local/php-7.4.21/conf/php.ini
# yum -y install libmemcached-devel # /usr/local/php-7.4.24/bin/pecl install memcached # echo "extension=memcached.so" >> /usr/local/php-7.4.24/conf/php.ini
# /usr/local/php-7.4.24/bin/pecl install psr # echo "extension=psr.so" >> /usr/local/php-7.4.24/conf/php.ini
# /usr/local/php-7.4.24/bin/pecl install igbinary # echo "extension=igbinary.so" >> /usr/local/php-7.4.24/conf/php.ini
# /usr/local/php-7.4.24/bin/pecl install mcrypt # echo "extension=mcrypt.so" >> /usr/local/php-7.4.24/conf/php.ini
# /usr/local/php-7.4.24/bin/pecl install phalcon # echo "extension=phalcon.so" >> /usr/local/php-7.4.24/conf/php.ini
回到顶部
# cat /lib/systemd/system/php-fpm_9200.service [Unit] Description=The PHP FastCGI Process Manager After=syslog.target network.target [Service] Type=forking PIDFile=/usr/local/php-7.4.24/var/run/php-fpm.pid ExecStart=/usr/local/php-7.4.24/sbin/php-fpm --daemonize --fpm-config /usr/local/php-7.4.24/etc/php-fpm.conf --pid /usr/local/php-7.4.24/var/run/php-fpm.pid ExecReload=/bin/kill -USR2 $MAINPID ExecStop=/bin/kill -SIGINT $MAINPID [Install] WantedBy=multi-user.target systemctl enable php-fpm_9200 systemctl start php-fpm_9200 systemctl status php-fpm_9200
回到顶部
# egrep -v "^;|^$" php.ini [PHP] engine = On short_open_tag = Off precision = 14 output_buffering = 4096 zlib.output_compression = Off implicit_flush = Off unserialize_callback_func = serialize_precision = -1 disable_functions = disable_classes = zend.enable_gc = On zend.exception_ignore_args = On expose_php = Off max_execution_time = 30 max_input_time = 60 memory_limit = 128M error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT display_errors = Off display_startup_errors = Off log_errors = On log_errors_max_len = 1024 ignore_repeated_errors = Off ignore_repeated_source = Off report_memleaks = On variables_order = "GPCS" request_order = "GP" register_argc_argv = Off auto_globals_jit = On post_max_size = 8M auto_prepend_file = auto_append_file = default_mimetype = "text/html" default_charset = "UTF-8" doc_root = user_dir = enable_dl = Off file_uploads = On upload_max_filesize = 2M max_file_uploads = 20 allow_url_fopen = On allow_url_include = Off default_socket_timeout = 60 [CLI Server] cli_server.color = On [Date] [filter] [iconv] [imap] [intl] [sqlite3] [Pcre] [Pdo] [Pdo_mysql] pdo_mysql.default_socket= [Phar] [mail function] SMTP = localhost smtp_port = 25 mail.add_x_header = Off [ODBC] odbc.allow_persistent = On odbc.check_persistent = On odbc.max_persistent = -1 odbc.max_links = -1 odbc.defaultlrl = 4096 odbc.defaultbinmode = 1 [MySQLi] mysqli.max_persistent = -1 mysqli.allow_persistent = On mysqli.max_links = -1 mysqli.default_port = 3306 mysqli.default_socket = mysqli.default_host = mysqli.default_user = mysqli.default_pw = mysqli.reconnect = Off [mysqlnd] mysqlnd.collect_statistics = On mysqlnd.collect_memory_statistics = Off [OCI8] [PostgreSQL] pgsql.allow_persistent = On pgsql.auto_reset_persistent = Off pgsql.max_persistent = -1 pgsql.max_links = -1 pgsql.ignore_notice = 0 pgsql.log_notice = 0 [bcmath] bcmath.scale = 0 [browscap] [Session] session.save_handler = files session.use_strict_mode = 0 session.use_cookies = 1 session.use_only_cookies = 1 session.name = PHPSESSID session.auto_start = 0 session.cookie_lifetime = 0 session.cookie_path = / session.cookie_domain = session.cookie_httponly = session.cookie_samesite = session.serialize_handler = php session.gc_probability = 1 session.gc_divisor = 1000 session.gc_maxlifetime = 1440 session.referer_check = session.cache_limiter = nocache session.cache_expire = 180 session.use_trans_sid = 0 session.sid_length = 26 session.trans_sid_tags = "a=href,area=href,frame=src,form=" session.sid_bits_per_character = 5 [Assertion] zend.assertions = -1 [COM] [mbstring] [gd] [exif] [Tidy] tidy.clean_output = Off [soap] soap.wsdl_cache_enabled=1 soap.wsdl_cache_dir="/tmp" soap.wsdl_cache_ttl=86400 soap.wsdl_cache_limit = 5 [sysvshm] [ldap] ldap.max_links = -1 [dba] [opcache] [curl] [openssl] [ffi] extension=imagick.so extension=phalcon.so extension=psr.so extension=memcached.so extension=mcrypt extension=gd
# egrep -v "^;|^$" etc/php-fpm.d/www.conf [www] user = nginx group = nginx listen = 127.0.0.1:9200 pm = dynamic pm.max_children = 500 pm.start_servers = 100 pm.min_spare_servers = 100 pm.max_spare_servers = 300 pm.max_requests = 500000 pm.status_path = /pm_status ping.path = /ping ping.response = pong slowlog = log/$pool.log.slow php_admin_value[error_log] = /var/log/fpm-php.www.log php_admin_flag[log_errors] = on