php自动安装脚本(php-7.0.27.tar.gz)

#! /bin/bash

cd /opt
yum install -y wget

#安装依赖
yum install gcc            -y
yum install freetype-devel -y
yum install openssl-devel  -y
yum install openssl        -y
yum install curl-devel     -y
yum install libxml2        -y
yum install libxml2-devel  -y
yum install libjpeg-devel  -y
yum install libpng-devel   -y
yum install libXpm-devel   -y
wget ftp://mcrypt.hellug.gr/pub/crypto/mcrypt/libmcrypt/libmcrypt-2.5.7.tar.gz
tar zxf libmcrypt-2.5.7.tar.gz
cd libmcrypt-2.5.7
./configure

make && make install

cd /opt
wget http://192.168.3.200/package/gz/php-7.0.27.tar.gz

#yum install -y gunzip
yum install curl-devel     -y
#gunzip php-7.0.27.tar.gz

tar -zxf php-7.0.27.tar.gz

cd /opt/php-7.0.27


./configure --prefix=/usr/local/php         --with-config-file-path=/usr/local/php/etc         --with-config-file-scan-dir=/usr/local/php/etc/php.d         --disable-ipv6         --enable-bcmath         --enable-calendar         --enable-exif         --enable-fpm         --with-fpm-user=www         --with-fpm-group=www         --enable-ftp         --enable-gd-jis-conv         --enable-gd-native-ttf         --enable-inline-optimization         --enable-mbregex         --enable-mbstring         --enable-mysqlnd         --enable-opcache         --enable-pcntl         --enable-shmop         --enable-soap         --enable-sockets         --enable-static         --enable-sysvsem         --enable-wddx         --enable-xml         --with-curl         --with-gd         --with-jpeg-dir         --with-freetype-dir         --with-xpm-dir         --with-png-dir         --with-gettext         --with-iconv         --with-libxml-dir         --with-mcrypt         --with-mhash         --with-mysqli         --with-pdo-mysql         --with-pear         --with-openssl         --with-xmlrpc         --with-zlib         --disable-debug         --disable-phpdbgnable-sockets         --enable-static         --enable-sysvsem         --enable-wddx         --enable-xml         --with-curl         --with-gd         --with-jpeg-dir         --with-freetype-dir         --with-xpm-dir         --with-png-dir         --with-gettext         --with-iconv         --with-libxml-dir         --with-mcrypt         --with-mhash         --with-mysqli         --with-pdo-mysql         --with-pear         --with-openssl         --with-xmlrpc         --with-zlib         --disable-debug         --disable-phpdbg


make && make install

cp /opt/php-7.0.27/sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
chmod a+x /etc/init.d/php-fpm

mkdir -p /home/wwwlogs
useradd www -s /sbin/nologin


#创建php-fpm.conf和php.ini
cd /usr/local/php/etc
wget http://192.168.3.200/config/php-fpm.conf
wget http://192.168.3.200/config/php.ini

#先关掉模块增加,有需要时再开启
sed -i  's/extension=swoole.so/#extension=swoole.so/g' /usr/local/php/etc/php.ini 
sed -i  's/extension=mongodb.so/#extension=mongodb.so/g' /usr/local/php/etc/php.ini 
sed -i  's/extension=yar.so/#extension=yar.so/g' /usr/local/php/etc/php.ini 
sed -i  's/extension=redis.so/#extension=redis.so/g' /usr/local/php/etc/php.ini 
sed -i  's/extension=yaconf.so/#extension=yaconf.so/g' /usr/local/php/etc/php.ini 
sed -i  's/extension=zip.so/#extension=zip.so/g' /usr/local/php/etc/php.ini 
sed -i  's/zend_extension=\/usr\/local\/php\/lib\/php\/extensions\/no-debug-non-zts-20151012\/opcache.so/#zend_extension=\/usr\/local\/php\/lib\/php\/extensions\/no-debug-non-zts-20151012\/opcache.so/g' /usr/local/php/etc/php.ini 
sed -i  's/extension=imagick.so/#extension=imagick.so/g' /usr/local/php/etc/php.ini 
sed -i  's/extension=msgpack.so/#extension=msgpack.so/g' /usr/local/php/etc/php.ini 
sed -i  's/extension=ssh2.so/#extension=ssh2.so/g' /usr/local/php/etc/php.ini 

#启动
/etc/init.d/php-fpm start













  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
编译 ./configure --prefix=/usr/local/php --exec-prefix=/usr/local/php --bindir=/usr/local/php/bin --sbindir=/usr/local/php/sbin --includedir=/usr/local/php/include --libdir=/usr/local/php/lib/php --mandir=/usr/local/php/php/man --with-config-file-path=/usr/local/php/etc --with-mysql-sock=/var/run/mysql/mysql.sock --with-mcrypt=/usr/include --with-mhash --with-openssl --with-mysql=shared,mysqlnd --with-mysqli=shared,mysqlnd --with-pdo-mysql=shared,mysqlnd --with-gd --with-iconv --with-zlib --enable-zip --enable-inline-optimization --disable-debug --disable-rpath --enable-shared --enable-xml --enable-bcmath --enable-shmop --enable-sysvsem --enable-mbregex --enable-mbstring --enable-ftp --enable-gd-native-ttf --enable-pcntl --enable-sockets --with-xmlrpc --enable-soap --without-pear --with-gettext --enable-session --with-curl --with-jpeg-dir --with-freetype-dir --enable-opcache --enable-fpm --enable-fastcgi --with-fpm-user=www --with-fpm-group=www --without-gdbm --with-mcrypt=/usr/local/apps/libmcrypt --disable-fileinfo 报错:1, **configure: error: system libzip must be upgraded to version >=**0.11。 使用Yum最新版只到0.10,不足以达到要求。 一、先删除libzip yum remove libzip -y SSH执行以上命令,先删除libzip 和 libzip-devel 二、下载安装并手动编译 wget https://nih.at/libzip/libzip-1.2.0.tar.gz tar -zxvf libzip-1.2.0.tar.gz cd libzip-1.2.0 ./configure make && make install 三、(可忽略)另外最新版本请参考官网:https://nih.at/libzip/ 1.5.0的libzip需要cmake wget https://libzip.org/download/libzip-1.5.0.tar.gz tar -zxvf libzip-* cd libzip* mkdir build && cd build && cmake .. && make && make install 报错2: error: off_t undefined; check your library configuration 根据报错信息分析 configure: error: off_t undefined; check your library configuration 未定义的类型 off_t。 off_t 类型是在 头文件 unistd.h中定义的,在32位系统 编程成 long int ,64位系统则编译成 long long int ,这里题主的系统应该是 64位的吧,在进行编译的时候 是默认查找64位的动态链接库,但是默认情况下 centos 的动态链接库配置文件/etc/ld.so.conf里并没有加入搜索路径,这个时候需要将 /usr/local/lib64 /usr/lib64 这些针对64位的库文件路径加进去。 采用下面的方法。 添加搜索路径到配置文件 echo '/usr/local
编译 ./configure --prefix=/usr/local/php --exec-prefix=/usr/local/php --bindir=/usr/local/php/bin --sbindir=/usr/local/php/sbin --includedir=/usr/local/php/include --libdir=/usr/local/php/lib/php --mandir=/usr/local/php/php/man --with-config-file-path=/usr/local/php/etc --with-mysql-sock=/var/run/mysql/mysql.sock --with-mcrypt=/usr /i nclude --with-mhash --with-openssl --with-mysql=shared,mysqlnd --with-mysqli=shared,mysqlnd --with-pdo-mysql=shared,mysqlnd --with-gd --with-iconv --with-zlib --enable-zip --enable-inline-optimization --disable-debug --disable-rpath --enable-shared --enable-xml --enable-bcmath --enable-shmop --enable-sysvsem --enable-mbregex --enable-mbstring --enable-ftp --enable-gd-native-ttf --enable-pcntl --enable-sockets --with-xmlrpc --enable-soap --without-pear --with-gettext --enable-session --with-curl --with-jpeg-dir --with-freetype-dir --enable-opcache --enable-fpm --enable-fastcgi --with-fpm-user=www --with-fpm-group=www --without-gdbm --with-mcrypt=/usr/local/apps/libmcrypt --disable-fileinfo 报错:1, **configure: error: system libzip must be upgraded to version >=**0.11。 使用Yum最新版只到0.10,不足以达到要求。 一、先删除libzip yum remove libzip -y SSH执行以上命令,先删除libzip 和 libzip-devel 二、下载安装并手动编译 wget https://nih.at/libzip/libzip-1.2.0.tar.gz tar -zxvf libzip-1.2.0.tar.gz cd libzip-1.2.0 ./configure make && make install 三、(可忽略)另外最新版本请参考官网:https://nih.at/libzip/ 1.5.0的libzip需要cmake wget https://libzip.org/download/libzip-1.5.0.tar.gz tar -zxvf libzip-* cd libzip* mkdir build && cd build && cmake .. && make && make install 报错2: error: off_t undefined; check your library configuration 根据报错信息分析 configure: error: off_t undefined; check your library configuration 未定义的类型 off_t。 off_t 类型是在 头文件 unistd.h中定义的,在32位系统 编程成 long int ,64位系统则编译成 long long int ,这里题主的系统应该是 64位的吧,在进行编译的时候 是默认查找64位的动态链接库,但是默认情况下 centos 的动态链接库配置文件/etc/ld.so.conf里并没有加入搜索路径,这个时候需要将 /usr/local/lib64 /usr/lib64 这些针对64位的库文件路径加进去。 采用下面的方法。 添加搜索路径到配置文件 echo '/usr/local/lib64 /usr/local/lib /usr/lib /usr/lib64'>>/etc/ld.so.conf 然后 更新配置 ldconfig -v 再次执行 编译 成功 执行安装: make && make install 报错: /usr/local/include/zip.h:59:21: fatal error: zipconf.h: No such file or directory 解决: cp /usr/local/lib/libzip/include/zipconf.h /usr/local/include/zipconf.h 1 安装成功: 复制配置文件: cp php.ini-production /usr/local/php/lib/php.ini cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf ln -s /usr/local/php/sbin/php-fpm /usr/local/bin 修改配置: cd /usr/local/php/etc/php-fpm.d vim www.conf [www] //池子名 (pool) 设置 ;listen = /tmp/php-fcgi.sock // 监听的地址,可以监听socket ,也可以监听端口 listen = 127.0.0.1:8089 或者这样写,php-fpm 通常在本地使用,php和nginx 通常在一台机器,所以可写127.0.0.1,别的机器 连接,需用本机ip listen.mode = 666 //sock 文件的权限 listen.owner = nobody listen.group = nobody user = php-fpm group = php-fpm pm = dynamic pm.max_children = 50 pm.start_servers = 20 pm.min_spare_servers = 5 pm.max_spare_servers = 35 pm.max_requests = 500 rlimit_files = 1024 加入 systemtl 服务: cd /usr/local/src/php-7.3.0beta1/sapi/fpm cp php-fpm.service /usr/lib/systemd/system/ 启动: systemctl start php-fpm systemctl status php-fpm -l

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值