TA的每日心情 | 奋斗 昨天 07:53 |
---|
签到天数: 319 天 [LV.8]以坛为家I
|
楼主 |
发表于 2023-5-22 13:57:02
|
显示全部楼层
--安装PHP
13安装yasm
[root@localhost soft]# tar zxf yasm-1.3.0.tar.gz
[root@localhost soft]# cd yasm-1.3.0/
[root@localhost yasm-1.3.0]# ./configure
[root@localhost yasm-1.3.0]# make && make install
BashCopy
14 安装libmcrypt
[root@localhost soft]# tar zxf libmcrypt-2.5.8.tar.gz
[root@localhost soft]# cd libmcrypt-2.5.8/
[root@localhost libmcrypt-2.5.8]# ./configure
[root@localhost libmcrypt-2.5.8]# make && make install
BashCopy
15 安装libvpx
[root@localhost soft]# tar zxf libvpx-1.10.0.tar.gz
[root@localhost soft]# cd libvpx-1.10.0/
[root@localhost libvpx-1.10.0]# ./configure --prefix=/usr/local/libvpx --enable-shared --enable-vp9
[root@localhost libvpx-1.10.0]# make && make install
BashCopy
16 安装tiff
[root@localhost soft]# tar zxf tiff-4.0.7.tar.gz
[root@localhost soft]# cd tiff-4.0.7/
[root@localhost tiff-4.0.7]# ./configure --prefix=/usr/local/tiff --enable-shared
[root@localhost tiff-4.0.7]# make && make install
BashCopy
17 安装libpng
[root@localhost soft]# tar zxf libpng-1.6.37.tar.gz
[root@localhost soft]# cd libpng-1.6.37/
[root@localhost libpng-1.6.37]# ./configure --prefix=/usr/local/libpng --enable-shared
[root@localhost libpng-1.6.37]# make && make install
BashCopy
18 安装freetype
[root@localhost soft]# tar zxf freetype-2.10.4.tar.gz
[root@localhost soft]# cd freetype-2.10.4/
[root@localhost freetype-2.10.4]# ./configure --prefix=/usr/local/freetype --enable-shared
[root@localhost freetype-2.10.4]# make && make install
BashCopy
19 安装jpeg
[root@localhost soft]# tar zxf jpegsrc.v9d.tar.gz
[root@localhost soft]# cd jpeg-9d/
[root@localhost jpeg-9d]# ./configure --prefix=/usr/local/jpeg --enable-shared
[root@localhost jpeg-9d]# make && make install
BashCopy
20 安装新版本GD库
新版本GD库适用于PHP 5.4.x及以上
[root@localhost soft]# tar zxf libgd-2.3.1.tar.gz
[root@localhost soft]# cd libgd-2.3.1/
[root@localhost libgd-2.3.1]# ./configure --prefix=/usr/local/libgd --enable-shared --with-jpeg=/usr/local/jpeg --with-png=/usr/local/libpng --with-freetype=/usr/local/freetype --with-fontconfig=/usr/local/freetype --with-xpm=/usr/lib64 --with-tiff=/usr/local/tiff
[root@localhost libgd-2.3.1]# make && make install
BashCopy
21 安装旧版本GD库
旧版本GD库知用于PHP 5.3.x以下
[root@localhost soft]# tar zxf gd-2.0.35.tar.gz
[root@localhost soft]# cd gd-2.0.35/
[root@localhost gd-2.0.35]# ./configure --prefix=/usr/local/gd --enable-shared --with-jpeg=/usr/local/jpeg --with-png=/usr/local/libpng --with-freetype=/usr/local/freetype --with-fontconfig=/usr/local/freetype --with-xpm=/usr/lib64 --with-tiff=/usr/local/tiff --with-vpx=/usr/local/libvpx
[root@localhost gd-2.0.35]# make && make install
BashCopy
22 安装t1lib
[root@localhost soft]# tar zxf t1lib-5.1.2.tar.gz
[root@localhost soft]# cd t1lib-5.1.2/
[root@localhost t1lib-5.1.2]# ./configure --prefix=/usr/local/t1lib --enable-shared
[root@localhost t1lib-5.1.2]# make without_doc && make install
BashCopy
23 安装libzip
[root@localhost soft]# tar zxf libzip-1.7.3.tar.gz
[root@localhost soft]# cd libzip-1.7.3/
[root@localhost libzip-1.7.3]# mkdir build
[root@localhost libzip-1.7.3]# cd build/
[root@localhost build]# cmake ..
[root@localhost build]# make
[root@localhost build]# make install
BashCopy
24 安装低版本 openssl
适用于PHP7.3.x以下编译安装
[root@localhost soft]# tar zxf openssl-1.0.2k.tar.gz
[root@localhost soft]# cd openssl-1.0.2k/
[root@localhost openssl-1.0.2k]# ./config -fPIC shared zlib --prefix=/usr/local/ssl
[root@localhost openssl-1.0.2k]# make && make install
BashCopy
[root@localhost soft]# mv /usr/bin/openssl /usr/bin/openssl._1.1.1g
[root@localhost soft]# mv /usr/include/openssl/ /usr/include/openssl._1.1.1g
[root@localhost soft]# mv /usr/lib64/libssl.so /usr/lib64/libssl.so._1.1.1g_bak
[root@localhost soft]# ln -s /usr/local/ssl/bin/openssl /usr/bin/openssl
[root@localhost soft]# ln -s /usr/local/ssl/include/openssl /usr/include/openssl
[root@localhost soft]# ln -s /usr/local/ssl/lib/libssl.so /usr/lib64/libssl.so
[root@localhost soft]# echo "/usr/local/ssl/lib" >> /etc/ld.so.conf
[root@localhost soft]# ldconfig -v
[root@localhost soft]# openssl version
OpenSSL 1.0.2k 26 Jan 2017
BashCopy
25 安装curl
[root@localhost soft]# tar zxf curl-7.76.1.tar.gz
[root@localhost soft]# cd curl-7.76.1/
[root@localhost curl-7.76.1]# ./configure --without-nss --prefix=/usr/local/curl --with-ssl=/usr/local/ssl
BashCopy
26 安装 expat
[root@localhost soft]# tar zxf expat-2.4.1.tar.gz
[root@localhost soft]# cd expat-2.4.1/
[root@localhost expat-2.4.1]# ./configure --prefix=/usr/local/expat --enable-shared
[root@localhost expat-2.4.1]# make && make install
BashCopy
27 链接lib库
[root@localhost]# cp -frp /usr/lib64/libltdl.so* /usr/lib/
[root@localhost]# cp -frp /usr/lib64/libXpm.so* /usr/lib/
BashCopy
-- 编译安装 PHP 5.3.29
yum install -y expat-devel
[root@localhost php-5.3.29]# ./configure --prefix=/usr/local/php53 --with-config-file-path=/usr/local/php53/etc --with-pdo-mysql=mysqlnd --enable-mysqlnd-compression-support --with-gd=/usr/local/gd --with-png-dir=/usr/lib --with-jpeg-dir=/usr/lib --with-freetype-dir=/usr/lib --with-iconv --with-zlib-dir=/usr/local/zlib --enable-xml --enable-magic-quotes --enable-safe-mode --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curlwrappers --enable-mbregex --enable-fpm --enable-mbstring --enable-ftp --enable-gd-native-ttf --with-openssl=/usr/local/ssl --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --without-pear --with-gettext --enable-session --with-mcrypt --with-curl=/usr/local/curl --enable-ctype --enable-mysqlnd
BashCopy
28 删除系统默认php.ini
[root@localhost php-5.3.29]# rm -f /etc/php.ini
[root@localhost php-5.3.29]# cp php.ini-production /usr/local/php53/etc/php.ini
[root@localhost php-5.3.29]# ln -s /usr/local/php53/etc/php.ini /etc/php.ini
[root@localhost php-5.3.29]# cp /usr/local/php53/etc/php-fpm.conf.default /usr/local/php53/etc/php-fpm.conf
BashCopy
29 配置php-fpm.conf
[root@localhost etc]# grep -Ev "^#|^$|^;" php-fpm.conf
[global]
pid = run/php-fpm.pid
[www]
user = www
group = www
listen = 127.0.0.1:9053
pm = dynamic
pm.max_children = 5
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 3
BashCopy
30 设置php-fpm开机启动
[root@localhost soft]# cd php-5.3.29/
[root@localhost php-5.3.29]# cp /opt/soft/php-5.3.29/sapi/fpm/init.d.php-fpm /etc/rc.d/init.d/php53-fpm
[root@localhost php-5.3.29]# chmod +x /etc/rc.d/init.d/php53-fpm
[root@localhost php-5.3.29]# chkconfig php53-fpm on
BashCopy
31 编辑php-fpm启动脚本
[root@localhost php-5.3.29]# grep -Ev "^#|^$|^;" /etc/rc.d/init.d/php53-fpm
prefix=/usr/local/php53
exec_prefix=${prefix}
php_fpm_BIN=${exec_prefix}/sbin/php53-fpm #修改当前行
php_fpm_CONF=${prefix}/etc/php-fpm.conf
php_fpm_PID=${prefix}/var/run/php-fpm.pid
php_opts="--fpm-config $php_fpm_CONF --pid $php_fpm_PID"
BashCopy
32 启动 php-fpm
[root@localhost php-5.3.29]# mv /usr/local/php53/sbin/php-fpm /usr/local/php53/sbin/php53-fpm
[root@localhost php-5.3.29]# service php53-fpm start
[root@localhost php-5.3.29]# ss -tnlp |grep 9053
LISTEN 0 128 127.0.0.1:9053 0.0.0.0:* users("php53-fpm",pid=1434960,fd=0),("php53-fpm",pid=1434959,fd=0),("php53-fpm",pid=1434958,fd=9))
BashCopy
33 配置php.ini文件
[PHP]
engine = On
short_open_tag = On
asp_tags = Off
precision = 14
y2k_compliance = On
output_buffering = 4096
zlib.output_compression = Off
implicit_flush = Off
unserialize_callback_func =
serialize_precision = 17
allow_call_time_pass_reference = Off
safe_mode = Off
safe_mode_gid = Off
safe_mode_include_dir =
safe_mode_exec_dir =
safe_mode_allowed_env_vars = PHP_
safe_mode_protected_env_vars = LD_LIBRARY_PATH
disable_functions = passthru,exec,system,chroot,scandir,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server,escapeshellcmd,dll,popen,disk_free_space,checkdnsrr,checkdnsrr,getservbyname,getservbyport,disk_total_space,posix_ctermid,posix_get_last_error,posix_getcwd, posix_getegid,posix_geteuid,posix_getgid, posix_getgrgid,posix_getgrnam,posix_getgroups,posix_getlogin,posix_getpgid,posix_getpgrp,posix_getpid, posix_getppid,posix_getpwnam,posix_getpwuid, posix_getrlimit, posix_getsid,posix_getuid,posix_isatty, posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid, posix_setpgid,posix_setsid,posix_setuid,posix_strerror,posix_times,posix_ttyname,posix_uname #禁用函数
disable_classes =
zend.enable_gc = On
expose_php = Off
max_execution_time = 30
max_input_time = 60
memory_limit = 128M
error_reporting = E_ALL & ~E_DEPRECATED
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
track_errors = Off
html_errors = Off
variables_order = "GPCS"
request_order = "GP"
register_globals = Off
register_long_arrays = Off
register_argc_argv = Off
auto_globals_jit = On
post_max_size = 8M
magic_quotes_gpc = Off
magic_quotes_runtime = Off
magic_quotes_sybase = Off
auto_prepend_file =
auto_append_file =
default_mimetype = "text/html"
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
[Date]
date.timezone = PRC
[filter]
[iconv]
[intl]
[sqlite]
[sqlite3]
[Pcre]
[Pdo]
[Pdo_mysql]
pdo_mysql.cache_size = 2000
pdo_mysql.default_socket=
[Phar]
[Syslog]
define_syslog_variables = Off
[mail function]
SMTP = localhost
smtp_port = 25
mail.add_x_header = On
[SQL]
sql.safe_mode = Off
[ODBC]
odbc.allow_persistent = On
odbc.check_persistent = On
odbc.max_persistent = -1
odbc.max_links = -1
odbc.defaultlrl = 4096
odbc.defaultbinmode = 1
[Interbase]
ibase.allow_persistent = 1
ibase.max_persistent = -1
ibase.max_links = -1
ibase.timestampformat = "%Y-%m-%d %H:%M:%S"
ibase.dateformat = "%Y-%m-%d"
ibase.timeformat = "%H:%M:%S"
[MySQL]
mysql.allow_local_infile = On
mysql.allow_persistent = On
mysql.cache_size = 2000
mysql.max_persistent = -1
mysql.max_links = -1
mysql.default_port =
mysql.default_socket =
mysql.default_host =
mysql.default_user =
mysql.default_password =
mysql.connect_timeout = 60
mysql.trace_mode = Off
[MySQLi]
mysqli.max_persistent = -1
mysqli.allow_persistent = On
mysqli.max_links = -1
mysqli.cache_size = 2000
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
[Sybase-CT]
sybct.allow_persistent = On
sybct.max_persistent = -1
sybct.max_links = -1
sybct.min_server_severity = 10
sybct.min_client_severity = 10
[bcmath]
bcmath.scale = 0
[browscap]
[Session]
session.save_handler = files
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.serialize_handler = php
session.gc_probability = 1
session.gc_divisor = 1000
session.gc_maxlifetime = 1440
session.bug_compat_42 = Off
session.bug_compat_warn = Off
session.referer_check =
session.entropy_length = 0
session.cache_limiter = nocache
session.cache_expire = 180
session.use_trans_sid = 0
session.hash_function = 0
session.hash_bits_per_character = 5
url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=fakeentry"
[MSSQL]
mssql.allow_persistent = On
mssql.max_persistent = -1
mssql.max_links = -1
mssql.min_error_severity = 10
mssql.min_message_severity = 10
mssql.compatability_mode = Off
mssql.secure_connection = Off
[Assertion]
[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
[mcrypt]
[dba]
[xsl]
BashCopyashCopy
Nginx 配置文件
user www www;
worker_processes auto;
error_log /data/wwwlogs/error_nginx.log crit;
pid /var/run/nginx.pid;
worker_rlimit_nofile 51200;
events {
use epoll;
worker_connections 51200;
multi_accept on;
}
http {
include mime.types;
default_type application/octet-stream;
server_names_hash_bucket_size 128;
client_header_buffer_size 32k;
large_client_header_buffers 4 32k;
client_max_body_size 1024m;
client_body_buffer_size 10m;
sendfile on;
tcp_nopush on;
keepalive_timeout 120;
server_tokens off;
tcp_nodelay on;
fastcgi_connect_timeout 300;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
fastcgi_buffer_size 64k;
fastcgi_buffers 4 64k;
fastcgi_busy_buffers_size 128k;
fastcgi_temp_file_write_size 128k;
fastcgi_intercept_errors on;
gzip on;
gzip_buffers 16 8k;
gzip_comp_level 6;
gzip_http_version 1.1;
gzip_min_length 256;
gzip_proxied any;
gzip_vary on;
gzip_types
text/xml application/xml application/atom+xml application/rss+xml application/xhtml+xml image/svg+xml
text/javascript application/javascript application/x-javascript
text/x-json application/json application/x-web-app-manifest+json
text/css text/plain text/x-component
font/opentype application/x-font-ttf application/vnd.ms-fontobject
image/x-icon;
gzip_disable "MSIE [1-6]\.(?!.*SV1)";
server {
listen 80;
server_name _;
access_log /data/wwwlogs/access_nginx.log combined;
root /data/wwwroot/default;
index index.html index.htm index.php;
location /nginx_status {
stub_status on;
access_log off;
allow 127.0.0.1;
deny all;
}
location ~ [^/]\.php(/|$) {
fastcgi_index index.php;
include fastcgi.conf;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|mp4|ico)$ {
expires 30d;
access_log off;
}
location ~ .*\.(js|css)?$ {
expires 7d;
access_log off;
}
location ~ ^/(\.user.ini|\.ht|\.git|\.svn|\.project|LICENSE|README.md) {
deny all;
}
}
include vhost/*.conf;
}
BashCopy
38 虚拟主机
server {
listen 80;
listen [::]:80;
server_name localhost;
access_log /data/wwwlogs/localhost_nginx.log combined;
index index.html index.htm index.php;
root /data/wwwroot/default/;
#include /usr/local/nginx/conf/rewrite/typecho.conf;
#error_page 404 /404.html;
#error_page 502 /502.html;
location ~ .*\.(wma|wmv|asf|mp3|mmf|zip|rar|jpg|gif|png|swf|flv|mp4)$ {
#valid_referers none blocked *.localhost localhost;
if ($invalid_referer) {
return 403;
}
}
location ~ .*\.php(\/.*)*$ {
root /data/wwwroot/default/;
fastcgi_pass 127.0.0.1:9053;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|mp4|ico)$ {
expires 30d;
access_log off;
}
location ~ .*\.(js|css)?$ {
expires 7d;
access_log off;
}
location ~ /(\.user\.ini|\.ht|\.git|\.svn|\.project|LICENSE|README\.md) {
deny all;
}
}
|
|