Compilation parameters
+++
# /usr/local/php/bin/php -i |grep configure
https://www.php.net/distributions/php-5.6.14.tar.gz
pro
Configure Command => './configure' '--prefix=/opt/server/php' '--with-mysql=/opt/server/mysql' '--with-mysql=mysqlnd' '--with-mysqli=mysqlnd' '--enable-pdo' '--with-freetype-dir' '--with-png-dir' '--with-libxml-dir=/usr' '--enable-xml' '--enable-safe-mode' '--enable-bcmath' '--enable-shmop' '--enable-fpm' '--with-mcrypt' '--with-gettext' '--enable-mbstring' '--with-curl' '--with-curlwrappers' '--disable-debug' '--disable-rpath' '--enable-inline-optimization' '--with-bz2' '--with-zlib' '--enable-sockets' '--with-xmlrpc' '--enable-dba' '--enable-sysvsem' '--enable-sysvshm' '--enable-pcntl' '--enable-mbregex' '--with-mhash' '--with-gdbm' '--enable-zip' '--enable-soap' '--enable-short-tags' '--enable-zend-multibyte' '--enable-static' '--with-xsl' '--with-fpm-user=www' '--with-fpm-group=www' '--with-pcre-regex' '--with-gd' '--enable-gd-native-ttf' '--with-jpeg-dir' '--with-openssl' '--enable-ftp' '--with-readline' '--enable-shared' '--with-pear' '--with-iconv'
ww
5.6
./configure --prefix=/usr/local/php \
--enable-fpm --disable-debug \
--with-fpm-user=www --with-fpm-group=www \
--with-mysql=/use/local/mysql \
--with-mysql=mysqlnd --with-mysqli=mysqlnd --enable-pdo \
--with-freetype-dir --with-png-dir --enable-xml \
--enable-bcmath --enable-shmop --with-gettext --enable-mbstring \
--disable-rpath --enable-inline-optimization --with-bz2 --with-zlib \
--enable-sockets --with-xmlrpc --enable-dba --enable-sysvsem --enable-sysvshm \
--enable-pcntl --enable-mbregex --with-mhash --with-gdbm --enable-zip --enable-soap \
--enable-short-tags --enable-static --with-xsl --enable-ftp --with-readline --enable-shared --with-pear \
--with-iconv --enable-gd-jis-conv --enable-gd-native-ttf --with-gd --with-jpeg-dir --with-pcre-regex \
--with-libxml-dir=/usr \
--with-curl=/usr/local/curl \
--with-openssl=/usr/local/openssl \
--with-mcrypt
X:
--enable-safe-mode, --with-curlwrappers,
--enable-zend-multibyte
yum install -y epel-release
yum install -y libmcrypt-devel2:
/usr/local/src/php-5.6.14/ext/mcrypt
/usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config
=====================================================================
7+
./configure --prefix=/usr/local/php \ --enable-fpm --disable-debug \ --with-fpm-user=www --with-fpm-group=www \ --with-mysqli=mysqlnd --enable-embedded-mysqli --with-pdo-mysql=mysqlnd --enable-mysqlnd \ --with-freetype-dir --with-png-dir --enable-xml \ --enable-bcmath --enable-shmop --with-gettext --enable-mbstring \ --disable-rpath --enable-inline-optimization --with-bz2 --with-zlib \ --enable-sockets --with-xmlrpc --enable-dba --enable-sysvsem --enable-sysvshm \ --enable-pcntl --enable-mbregex --with-mhash --with-gdbm --enable-zip --enable-soap \ --enable-short-tags --enable-static --with-xsl --enable-ftp --with-readline --enable-shared --with-pear \ --with-iconv --enable-gd-jis-conv --with-gd --with-jpeg-dir --with-pcre-regex \ --with-libxml-dir=/usr \ --with-curl=/usr/local/curl \ --with-openssl=/usr/local/openssl
X:
--with-mcrypt(2)
--enable-gd-native-ttf
YYY7-1:
./configure --prefix=/usr/local/php \ --with-mysqli --enable-embedded-mysqli --enable-pdo --with-pdo-mysql --enable-mysqlnd \ --enable-fpm --with-fpm-user=www --with-fpm-group=www \ --with-pcre-regex --enable-mbstring --with-zlib --with-curl --enable-soap --enable-zip --with-openssl \ --with-gd --enable-gd-jis-conv --with-freetype-dir --with-jpeg-dir --with-png-dir \ --with-readline --enable-shared --with-pear --with-iconv \ --with-libxml-dir --enable-xml --enable-bcmath --with-gettext --with-iconv-dir \ --enable-opcache --enable-gd-native-ttf \ --with-kerberos --with-libdir=lib64 \ --enable-short-tags --enable-static --enable-soap --enable-dba=shared --enable-sysvsem --enable-sysvshm \ --enable-pcntl --enable-shmop --enable-inline-optimization --enable-mbregex --enable-sockets \ --with-xsl --with-mhash --with-gdbm --with-xmlrpc --with-bz2 --with-zlib \
=====================================================================
Extension
extension=pdo_mysql.so
extension=pdo.so
extension=swoole.so
extension=redis.so
extension=imagick.so
extension=httpsqs.so
extension=xhprof.so
extension=mongo.so
yum -y install gcc+ gcc-c++ ------------------------------------
Dependency Library
libxml2==openssl==bzip2==curl==dba==libjpeg=libpng==freetype==readline==libxslt==autoconf
yum install freetype-devel
yum install gdbm-devel (DBA)
libxml2
autoconf
openssl
<?php
return [
'DB' => array(
'cms' => array(
"dbdriver" => 'pdo', //连接驱动 目前固定值 "pdo"
"host" => 'rm-xxx.mysql.rds.aliyuncs.com', //主机地址
"port" => '3306', //端口
"username" => '', //用户名
"password" => '', //密码
"dbname" => '', //数据库名
"dbprefix" => '' //表前缀
)
),
"DEFAULT_CONTROLLER" => 'index', //默认控制器
"DEFAULT_ACTION" => 'index', //默认方法
"BASE_HOST" => 'http://www.xxx.com/user/', //域名
"SERVER_PASSPORT" => 'http://www.xxx.com/user/', //域名
"URL_CONTROL_NAME" => 'c', // 默认控制器参数名
"URL_ACTION_NAME" => 'a', // 默认动作参数名
"URL_MODE" => 0, // 0 GET 1 PATHINFO
"REDIS_HOST" => "", //redis主机地址
"REDIS_PORT" => "6379", //redis端口
"REDIS_PWD" => "", //redis密码
"REDIS_TIMEOUT" => "60", //redis超时时间
//36
"DB_HOST" => 'rm-j6***********b8.mysql.rds.aliyuncs.com', //主机地址
"DB_PORT" => 3306,//端口
"DB_USERNAME" => '',//用户名
"DB_PASSWORD" => 'M*******3v!@9F*****1Rz',//密码
"DB_NAME" => 'bn_cms',//数据库名
"APPSTORE_MOBILE"=>array("17801122837"=>"655186",),
'APP_SESSION_DATA_KEY' => 'app:session:data:%s', # redis data type hash
'APP_SESSION_ID_KEY' => 'app:session:id:%d', # redis data type string
//内部rpc接口地址配置
"WHITE_IP_LIST" => "127.0.0.1",
"OPEN_API_CHECK" =>1, //开启api验证,1开启
"SERVICE_ACCOUNTS" => array(
//微信
"WECHAT" => array(
'appid' => 'wx',
'secret' => ''
),
//云信
"SMS_YX" => array(
'SMS_API' => 'http://',
'ACCOUNT' => '',
'SECRET' => ''
),
//速盾
"SMS_SD" => [
'SMS_API' => 'http://',
'ACCOUNT' => '',
'PSWD' => ''
],
//商信
"SMS_SX" => [
'SMS_API' => 'http://',
'ACCOUNT' => '',
'PSWD' => ''
]
),
'API_URL' =>'http://www.xxx.com/cms',
'OSS' => array(
'keyId' => 'LT************2',
'keySecret' => 'XH**************h',
'roleArn' => 'acs:ram::1111111111111111:role/aliyunosstokengeneratorrole',
'regionId' => 'cn-hongkong',
'endPoint' => 'sts.cn-hongkong.aliyuncs.com'
),
];
TCP是使用TCP端口连接127.0.0.1:9000
Socket是使用unix domain socket连接套接字/dev/shm/php-cgi.sock(很多教程使用路径/tmp,而路径/dev/shm是个tmpfs,速度比磁盘快得多)
fastcgi_pass unix:/tmp/php-cgi.sock
fastcgi_pass 127.0.0.1:9000
在服务器压力不大的情况下,tcp和socket差别不大,但在压力比较满的时候,用套接字方式,效果确实比较好。
/usr/local/php/etc/php-fpm.conf
;listen = 127.0.0.1:9000
listen = /dev/shm/php-cgi.sock
fastcgi_pass unix:/tmp/php-cgi.sock
fastcgi_pass 127.0.0.1:9000