博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
centos7.5环境下编译安装php7.0.30并安装redis和mongo扩展
阅读量:6354 次
发布时间:2019-06-22

本文共 12089 字,大约阅读时间需要 40 分钟。

1.安装php7.0.30的脚本# vim install_php.sh#!/bin/bash# 安装基本依赖yum install -y gcc gcc-c++ htop telnet iotop iptraf iftop make logrotate xinetd ntsysv  sysstat perl autoconf libjpeg libjpeg-devel libpng libpng-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel e2fsprogs e2fsprogs-devel krb5-devel libidn libidn-devel libxml2 libxml2-devel libxslt-devel libevent-devel libtool libtool-ltdl bison  ntpdate  patch vim wget openssh-clients bind-utilsyum -y install libicu-devel libpng12 libpng12-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel mysql pcre-devel  libxslt-devel  curl-devel## zlibecho "*******************install zlib start*******************"cd /usr/local/src && wget http://www.zlib.net/zlib-1.2.11.tar.gztar -xvzf zlib-1.2.11.tar.gzcd zlib-1.2.11./configure --prefix=/usr/local/zlibmake && make installls -l /usr/local/zlibecho "*******************install zlib end*******************"## opensslecho "*******************install openssl start*******************"cd /usr/local/src && wget https://www.openssl.org/source/openssl-1.1.0e.tar.gz --no-check-certificatetar -xzf openssl-1.1.0e.tar.gzcd openssl-1.1.0e/./config --prefix=/usr/local/openssl./config -tmake && make installls /usr/local/bin/openssl  -lecho "*******************install openssl end*******************"## freetypeecho "*******************install freetype start*******************"cd /usr/local/src && wget https://download.savannah.gnu.org/releases/freetype/freetype-2.4.0.tar.gz --no-check-certificatetar -zxvf freetype-2.4.0.tar.gzcd freetype-2.4.0/./configure --prefix=/usr/local/freetypemake && make installecho "*******************install freetype end*******************"## PHP安装echo "*******************install php-7.0.30 start*******************"cd /usr/local/src && wget http://cn2.php.net/distributions/php-7.0.30.tar.gztar -zxvf php-7.0.30.tar.gzcd php-7.0.30./configure  \--prefix=/usr/local/php7.0.30 \--mandir=/usr/local/php7.0.30/share/man  \--infodir=/usr/local/php7.0.30/share/info  \--enable-fpm \--enable-mbstring \--enable-zib \--enable-bcmath \--enable-opcache \--enable-pcnt \--enable-soa \--enable-calenda \--enable-exif \--enable-ftp \--enable-intl \--with-curl \--with-gd \--with-jpeg-dir=/usr/local/zlib \--with-png-dir=/usr/local/zlib \--with-mysql \--with-pdo_mysql \--with-mcrypt \--with-freetype-dir=/usr/local/freetype \--with-zlib=/usr/local/zlib \--with-opensslmake && make installif [ $? != 0 ];thenexit 7filn -s /usr/local/php7.0.30  /usr/local/phpcp /usr/local/src/php-7.0.30/php.ini-development /usr/local/php7.0.30/lib/php.inicp /usr/local/php7.0.30/etc/php-fpm.conf.default /usr/local/php7.0.30/etc/php-fpm.confcp  /usr/local/php7.0.30/etc/php-fpm.d/www.conf.default /usr/local/php7.0.30/etc/php-fpm.d/www.confecho "*******************install php-7.0.30 end*******************"## Mongo扩展echo "*******************install Mongo扩展 start*******************"cd /usr/local/src && wget http://pecl.php.net/get/mongodb-1.5.2.tgztar -zxvf mongodb-1.5.2.tgzcd mongodb-1.5.2//usr/local/php7.0.30/bin/phpize./configure --with-php-config=/usr/local/php7.0.30/bin/php-configmake && make installls /usr/local/php7.0.30/lib/php/extensions/no-debug-non-zts-20151012/echo "*******************install Mongo扩展 end*******************"## Redis扩展echo "*******************install Redis扩展 start*******************"cd /usr/local/src && wget http://pecl.php.net/get/redis-4.0.2.tgztar -zxvf redis-4.0.2.tgzcd redis-4.0.2//usr/local/php7.0.30/bin/phpize./configure --with-php-config=/usr/local/php7.0.30/bin/php-configmake && make installls /usr/local/php7.0.30/lib/php/extensions/no-debug-non-zts-20151012/echo "*******************install Redis扩展 end*******************"## tideways扩展echo "*******************install tideways扩展 start*******************"cd /usr/local/src && wget https://s3-eu-west-1.amazonaws.com/tideways/extension/5.0.18/tideways-php-5.0.18-x86_64.tar.gz --no-check-certificatetar -zxf tideways-php-5.0.18-x86_64.tar.gzcd tideways-5.0.18/usr/local/php7.0.30/bin/phpizecp tideways-php-7.0.so /usr/local/php7.0.30/lib/php/extensions/no-debug-non-zts-20151012/cd /usr/local/php7.0.30/lib/php/extensions/no-debug-non-zts-20151012/mv tideways-php-7.0.so tideways.soecho "*******************install tideways扩展 end*******************"## ioncube_loaders 扩展echo "*******************install ioncube_loaders start*******************"cd /usr/local/src && wget https://downloads.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz --no-check-certificatetar -zxvf  ioncube_loaders_lin_x86-64.tar.gzcd ioncube/lscp ioncube_loader_lin_7.0.so  /usr/local/php7.0.30/lib/php/extensions/no-debug-non-zts-20151012/echo "*******************install ioncube_loaders end*******************"2.修改配置文件# php.ini配置文件# vim /usr/local/php7.0.30/lib/php.ini[dba]extension_dir=/usr/local/php/lib/php/extensions/no-debug-non-zts-20151012/extension=redis.soextension=mongodb.so[tideways]extension=tideways.so;不需要自动加载,在程序中控制就行tideways.auto_prepend_library=0;频率设置为100,在程序调用时能改tideways.sample_rate=100[ionCube Loader]zend_extension=ioncube_loader_lin_7.0.so# php-fpm.conf文件[root@eus_filmora_file01:/usr/local/php]# egrep -v '^$|^;' /usr/local/php/etc/php-fpm.conf[global] process.max = 256rlimit_files = 65535events.mechanism = epollinclude=/usr/local/php7.0.30/etc/php-fpm.d/*.confsed -i 's#user = nobody#user = apache#g' /usr/local/php7.0.30/etc/php-fpm.d/www.confsed -i 's#group = nobody#group = users#g' /usr/local/php7.0.30/etc/php-fpm.d/www.conf# www.conf文件[root@eus_filmora_file01:/usr/local/php]# egrep -v '^$|^;' /usr/local/php/etc/php-fpm.d/www.conf[www]user = apachegroup = userslisten = 127.0.0.1:9000pm = dynamicpm.max_children = 500pm.start_servers = 32pm.min_spare_servers = 16pm.max_spare_servers = 64pm.process_idle_timeout = 10s;pm.max_requests = 10240request_terminate_timeout = 100rlimit_core = 8##################启动脚本# 生成软连接[root@eus_filmora_file02:/usr/local/src]# rm -f /usr/local/php[root@eus_filmora_file02:/usr/local/src]# ln -s /usr/local/php7.0.30/ /usr/local/php[root@eus_filmora_file01:/usr/local/src/tideways-5.0.18]# vim /etc/init.d/php-fpm#! /bin/sh### BEGIN INIT INFO# Provides:          php-fpm# Required-Start:    $remote_fs $network# Required-Stop:     $remote_fs $network# Default-Start:     2 3 4 5# Default-Stop:      0 1 6# Short-Description: starts php-fpm# Description:       starts the PHP FastCGI Process Manager daemon### END INIT INFOprefix=/usr/local/phpexec_prefix=${prefix}php_fpm_BIN=${exec_prefix}/sbin/php-fpmphp_fpm_CONF=${prefix}/etc/php-fpm.confphp_fpm_PID=${prefix}/var/run/php-fpm.pidphp_opts="--fpm-config $php_fpm_CONF --pid $php_fpm_PID"wait_for_pid () {    try=0    while test $try -lt 35 ; do        case "$1" in            'created')            if [ -f "$2" ] ; then                try=''                break            fi            ;;            'removed')            if [ ! -f "$2" ] ; then                try=''                break            fi            ;;        esac        echo -n .        try=`expr $try + 1`        sleep 1    done}case "$1" in    start)        echo -n "Starting php-fpm "        $php_fpm_BIN --daemonize $php_opts        if [ "$?" != 0 ] ; then            echo " failed"            exit 1        fi        wait_for_pid created $php_fpm_PID        if [ -n "$try" ] ; then            echo " failed"            exit 1        else            echo " done"        fi    ;;    stop)        echo -n "Gracefully shutting down php-fpm "        if [ ! -r $php_fpm_PID ] ; then            echo "warning, no pid file found - php-fpm is not running ?"            exit 1        fi        kill -QUIT `cat $php_fpm_PID`        wait_for_pid removed $php_fpm_PID        if [ -n "$try" ] ; then            echo " failed. Use force-quit"            exit 1        else            echo " done"        fi    ;;    force-quit)        echo -n "Terminating php-fpm "        if [ ! -r $php_fpm_PID ] ; then            echo "warning, no pid file found - php-fpm is not running ?"            exit 1        fi        kill -TERM `cat $php_fpm_PID`        wait_for_pid removed $php_fpm_PID        if [ -n "$try" ] ; then            echo " failed"            exit 1        else            echo " done"        fi    ;;    restart)        $0 stop        $0 start    ;;    reload)        echo -n "Reload service php-fpm "        if [ ! -r $php_fpm_PID ] ; then            echo "warning, no pid file found - php-fpm is not running ?"            exit 1        fi        kill -USR2 `cat $php_fpm_PID`        echo " done"    ;;    *)        echo "Usage: $0 {start|stop|force-quit|restart|reload}"        exit 1    ;;esac#######################测试的域名# vim /usr/local/nginx/conf/vhost.d/film.chinasoft.com.confserver {        listen 80;        server_name     film.chinasoft.com;        proxy_connect_timeout 1800s;        proxy_read_timeout 1800s;        proxy_send_timeout 1800s;            access_log      /data/www/logs/nginx_log/access/film.chinasoft.com_access.log main ;        access_log on;            error_log       /data/www/logs/nginx_log/error/film.chinasoft.com_error.log ;            root            /data/www/vhosts/film.chinasoft.com/httpdocs/api/public ;            index           index.html index.shtml index.php ;        error_page  404 403              /404.html;                        location / {                    index  index.php index.html index.htm;                    try_files $uri $uri/ /index.php?$query_string;            }            location ~ \.php$ {                    #fastcgi_pass   unix:/tmp/php-cgi.sock;                    fastcgi_pass 127.0.0.1:9000;                    fastcgi_index  index.php;                    fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;                    include        fastcgi_params;            }                    location ^~ /logs/            {                    deny all;            }    }server {        listen 443;        ssl on;        ssl_certificate         cert2016/chinasoft_com.crt;        ssl_certificate_key     cert2016/chinasoft_com.key;        ssl_dhparam     cert2016/dh_2048.pem;        ssl_session_timeout     5m;        ssl_protocols   TLSv1 TLSv1.1 TLSv1.2;        ssl_ciphers     "ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:!AES128-GCM-SHA256:!AES256-GCM-SHA384:!AES128-SHA256:!AES256-SHA256:!AES128-SHA:!AES256-SHA:AES:!CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA";        ssl_prefer_server_ciphers       on;        server_name     film.chinasoft.com;        access_log      /data/www/logs/nginx_log/access/film.chinasoft.com_access.log main ;        error_log       /data/www/logs/nginx_log/error/film.chinasoft.com_error.log ;        root            /data/www/vhosts/film.chinasoft.com/httpdocs/api/public ;        index           index.html index.shtml index.php ;        error_page  404 403              /404.html;        location / {                index  index.php index.html index.htm;                try_files $uri $uri/ /index.php?$query_string;        }        location ~ \.php$ {                                fastcgi_pass 127.0.0.1:9000;                fastcgi_index  index.php;                fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;                include        fastcgi_params;        }           }# 创建测试页面[root@eus_filmora_file01:/usr/local/php]# mkdir -p /data/www/vhosts/film.chinasoft.com/httpdocs/api/public[root@eus_filmora_file01:/usr/local/php]# echo "
"> /data/www/vhosts/film.chinasoft.com/httpdocs/api/public/index.php

 

转载于:https://www.cnblogs.com/reblue520/p/9689622.html

你可能感兴趣的文章
JVM(五)垃圾回收器的前世今生
查看>>
Spring Boot 自动配置之@EnableAutoConfiguration
查看>>
web前端笔记
查看>>
finally知识讲解
查看>>
Matplotlib绘图与可视化
查看>>
openstack ocata版(脚本)控制节点安装
查看>>
【微信公众号开发】获取并保存access_token、jsapi_ticket票据(可用于微信分享、语音识别等等)...
查看>>
datatable 获取最大值
查看>>
sqlserver2012一直显示正在还原(Restoring)和从单用户转换成多用户模式(单用户连接中)...
查看>>
spark复习总结02
查看>>
李瑞红201771010111《第九周学习总结》
查看>>
[译]ZOOKEEPER RECIPES-Barriers
查看>>
NFC 鏈表操作
查看>>
pymongo模块
查看>>
第0次作业
查看>>
Ubuntu里设置python默认版本为python3(转载)
查看>>
快排+折半查找
查看>>
c# GC 新典型
查看>>
ssh bash 通配符
查看>>
seajs在jquery多个版本下引用jquery的插件的方案
查看>>