标签:etc conf efi listen deb bre sem 路径 字符集
1.查看系统是否安装httpd和apr、apr-util并卸载#rpm -qa|grep apr
apr-util-1.5.2-6.el7.x86_64
apr-1.4.8-3.el7.x86_64
#rpm -e --nodeps --allmatches apr-util-1.5.2-6.el7
#rpm -e --nodeps --allmatches apr-1.4.8-3.el7
#rpm -qa httpd
httpd-2.4.6-31.el7.centos.x86_64
#rpm -e --nodeps --allmatches httpd-2.4.6-31.el7.centos
重新安装httpd和apr、apr-util
2.首先安装apr、apr-util、apr-iconv、pcre
在root用户,给其他用户赋予了连接网卡的root权限
chown -R user.user apache-${APACHE}
chown -h user.user apache
if [ ${OS_VERSION} -ge 6 ];then
chown user.user apache-${APACHE}/bin/httpd
/usr/sbin/setcap ‘cap_net_bind_service=+ep‘ apache-${APACHE}/bin/httpd //赋予了网卡的执行权限
else
chown user.user apache-${APACHE}/bin/httpd
chmod 4750 apache-${APACHE}/bin/httpd
fi
2.php
./configure --prefix=/home1/irteam/apps/php-7.2.11 --with-zlib --enable-mbstring --with-curl --with-gd --enable-fpm --enable-mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --enable-opcache
./configure --prefix=/usr/local/php \ [php安装的根目录]
--exec-prefix=/usr/local/php \ [php执行文件所在目录]
--bindir=/usr/local/php/bin \ [php/bin目录]
--sbindir=/usr/local/php/sbin \ [php/sbin目录]
--includedir=/usr/local/php/include \ [php包含文件所在目录]
--libdir=/usr/local/php/lib/php \ [php/lib目录]
--mandir=/usr/local/php/php/man \ [php/man目录]
--with-config-file-path=/usr/local/php/etc \ [php的配置目录]
--with-mysql-sock=/tmp/mysql.sock \ [php的Unix socket通信文件]
--with-mcrypt \ [是php里面重要的加密支持扩展库,linux环境下该库在默认情况下不开启]
--with-mhash \ [Mhash是基于离散数学原理的不可逆向的php加密方式扩展库,其在默认情况下不开启]
--with-openssl \ [OpenSSL 是一个安全套接字层密码库]
--with-mysqli=shared,mysqlnd \ [php依赖mysql库]
--with-pdo-mysql=shared,mysqlnd \ [php依赖mysql库]
--with-gd \ [gd库]
--with-iconv \ [关闭iconv函数,种字符集间的转换]
--with-zlib \ [zlib是提供数据压缩用的函式库]
--enable-zip \ [打开对zip的支持]
--enable-inline-optimization \ [优化线程]
--disable-debug \ [关闭调试模式]
--disable-rpath \ [关闭额外的运行库文件]
--enable-shared \ [启用动态库]
--enable-xml \ [开启xml扩展]
--enable-bcmath \ [打开图片大小调整,用到zabbix监控的时候用到了这个模块]
--enable-shmop \ [共享内存]
--enable-sysvsem \ [内存共享方案]
--enable-mbregex \ [开启多字节正则表达式的字符编码。]
--enable-mbstring \ [开启多字节字符串函数]
--enable-ftp \ [开启ftp]
--enable-gd-native-ttf \ [开启gd库原有字体]
--enable-pcntl \ [PHP的进程控制支持实现了Unix方式的多进程创建]
--enable-sockets \ [开启套节字]
--with-xmlrpc \ [打开xml-rpc的c语言]
--enable-soap \ [开启简单对象访问协议简单对象访问协议]
--without-pear \ [开启php扩展与应用库]
--with-gettext \ [开户php在当前域中查找消息]
--enable-session \ [允许php会话session]
--with-curl \ [允许curl扩展]
--with-jpeg-dir \ [指定jpeg安装目录yum安装过后不用再次指定会自动找到]
--with-freetype-dir \ [指定freetype安装目录yum安装过后不用再次指定会自动找到]
--enable-opcache \ [开启使用opcache缓存]
--enable-fpm \ [开启fpm]
--with-fpm-user=nginx \ [php-fpm的用户]
--with-fpm-group=nginx \ [php-fpm的用户组]
--without-gdbm \ [数据库函数使用可扩展散列和类似于标准UNIX dbm的工作]
--enable-fast-install \ [为快速安装优化]
--disable-fileinfo
直接使用编译后未经优化处理的配置
cp php.ini-production /usr/local/php7/etc/php.ini
cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
修改配置文件
vim /usr/local/php7/etc/php.ini
######避免PHP信息暴露在http头中
expose_php = Off
######避免暴露php调用mysql的错误信息
display_errors = Off
######在关闭display_errors后开启PHP错误日志(路径在php-fpm.conf中配置)
log_errors = On
######设置PHP的扩展库路径
extension_dir = "/usr/local/php7/lib/php/extensions/no-debug-non-zts-20170718/"
######设置PHP的opcache和mysql动态库
zend_extension=opcache.so
extension=mysqli.so
extension=pdo_mysql.so
extension=ldap.so
######设置PHP的时区
date.timezone = PRC
######开启opcache
[opcache]
opcache.enable=1
######设置PHP脚本允许访问的目录(需要根据实际情况配置)
open_basedir = /etc/nginx/html;
vim /usr/local/php7/etc/php-fpm.conf
[global]
pid = /usr/local/php7/var/run/php-fpm.pid
error_log = /usr/local/php7/var/log/php-fpm.log
log_level = notice
[www]
listen = /var/run/php-fpm/php-fpm.sock ### 或者 127.0.0.1:9000
listen.backlog = -1
listen.allowed_clients = 127.0.0.1
listen.owner = nginx
listen.group = nginx
listen.mode = 0666
user = nginx
group = nginx
pm = dynamic
pm.max_children = 80
pm.start_servers = 40
pm.min_spare_servers = 40
pm.max_spare_servers = 80
request_terminate_timeout = 100
request_slowlog_timeout = 10s
slowlog = /var/log/php-fpm/$pool-slow.log
标签:etc conf efi listen deb bre sem 路径 字符集
原文地址:http://blog.51cto.com/10884109/2315749