归档文章 (2011-2017)

date
2017/05/15

一、安装依赖

libmcrypt-devel 需要使用 epel 源
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
安装必须的依赖
yum install -y \ gcc gcc-c++ \ freetype-devel libxml2-devel libcurl-devel libjpeg-turbo-devel libpng-devel openssl-devel libicu-devel libxslt-devel \ libmcrypt-devel

二、安装 imap

centOS7 已经没有了 libc-client,需要编译安装
注:epel 源可以找到 libc-client-devel uw-imap-devel uw-imap-static uw-imap-utils,但直接安装还是会出现一些问题。
编译安装
http://files.wangyan.org/src/lemp/imap-2007f.tar.gz
wget ftp://ftp.cac.washington.edu/imap/imap-2007f.tar.gz tar -zxf imap-2007f.tar.gz cd imap-2007f make lr5 PASSWDTYPE=std SSLTYPE=unix.nopwd EXTRACFLAGS=-fPIC IP=4 mkdir -p /usr/local/imap-2007f/{include,lib,c-client} cp c-client/*.h /usr/local/imap-2007f/include/ cp c-client/*.c /usr/local/imap-2007f/lib/ cp c-client/*.c /usr/local/imap-2007f/c-client/ cp c-client/c-client.a /usr/local/imap-2007f/lib/libc-client.a cp c-client/c-client.a /usr/local/imap-2007f/c-client/libc-client.a
备注:在 64 位下编译时 make 参数需要带 EXTRACFLAGS=-fPIC ,在 32 位下则不需要。

三、安装 PHP

tar zxf php-7.1.6.tar.gz cd php-7.1.6 ./configure \ --prefix=/usr/local/php \ --with-config-file-path=/usr/local/php/etc \ --with-config-file-scan-dir=/usr/local/php/conf.d \ --with-curl \ --with-fpm-user=www \ --with-fpm-group=www \ --with-freetype-dir \ --with-gd \ --with-gettext \ --with-iconv-dir \ --with-imap=/usr/local/imap-2007f \ --with-imap-ssl \ --with-jpeg-dir \ --with-libxml-dir \ --with-mcrypt \ --with-mhash \ --with-mysqli=mysqlnd \ --with-openssl \ --with-pdo-mysql=mysqlnd \ --with-png-dir \ --with-xmlrpc \ --with-xsl \ --with-zlib \ --enable-calendar \ --enable-bcmath \ --enable-exif \ --enable-fpm \ --enable-ftp \ --enable-gd-native-ttf \ --enable-intl \ --enable-mbstring \ --enable-mysqlnd \ --enable-shmop \ --enable-sockets \ --enable-sysvsem \ --enable-zip make -j4 make install

三、php 配置

ln -s /usr/local/php/bin/php /usr/bin/php mkdir -p /usr/local/php/conf.d /tmp/php cp php-7.1.6/php.ini-production /usr/local/php/etc/php.ini cp php-fpm.conf /usr/local/php/etc/php-fpm.conf
php.ini 设置
sed -i "s|;*date.timezone =.*|date.timezone = PRC|i" /usr/local/php/etc/php.ini && \ sed -i "s|;*memory_limit =.*|memory_limit = 512M|i" /usr/local/php/etc/php.ini && \ sed -i "s|;*upload_max_filesize =.*|upload_max_filesize = 128M|i" /usr/local/php/etc/php.ini && \ sed -i "s|;*max_file_uploads =.*|max_file_uploads = 25|i" /usr/local/php/etc/php.ini && \ sed -i "s|;*post_max_size =.*|post_max_size = 256M|i" /usr/local/php/etc/php.ini && \ sed -i "s|;\s*max_input_vars =.*|max_input_vars = 5000|i" /usr/local/php/etc/php.ini && \ sed -i "s|;*cgi.fix_pathinfo=.*|cgi.fix_pathinfo= 0|i" /usr/local/php/etc/php.ini && \ sed -i 's|;upload_tmp_dir =.*|upload_tmp_dir = \/tmp\/php|i' /usr/local/php/etc/php.ini && \ sed -i 's|max_execution_time =.*|max_execution_time = 300|i' /usr/local/php/etc/php.ini && \ sed -i 's|disable_functions =.*|disable_functions = passthru,exec,system,chroot,scandir,chgrp,chown,shell_exec,popen,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server|g' /usr/local/php/etc/php.ini
开机自启动
cp php-7.1.6/sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm chmod +x /etc/init.d/php-fpm chkconfig --add php-fpm service php-fpm restart
对于本文内容有任何疑问, 可与我联系.