【10.15】PHP、Nginx

4.27/28/29 php编译安装

1、下载php安装包
https://www.php.net/distributions/php-7.3.0.tar.bz2
2、解压
可能需要先安装 bzip2

[root@localhost src]# tar xvf php-7.3.0.tar.bz2

3、编译

[root@localhost src]# cd php-7.3.0
[root@localhost php-7.3.0]# ./configure --prefix=/usr/local/php-fpm --with-config-file-path=/usr/local/php-fpm/etc --enable-fpm --with-fpm-user=php-fpm --with-fpm-group=php-fpm --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-pdo-mysql=/usr/local/mysql --with-mysql-sock=/tmp/mysql.sock --with-libxml-dir --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir --with-iconv-dir --with-zlib-dir --with-mcrypt --enable-soap --enable-gd-native-ttf --enable-ftp --enable-mbstring --enable-exif --with-pear --with-curl  --with-openssl

4、解决问题

  • 常遇到报错及结局
    1、gcc … no
    安装 gcc
    2、xml2-config not found.
    需要安装 libxml2-devel
    3、少cURL
    安装 libcurl-devel
    4、少OpenSSL’s <evp.h>
    安装 openssl、openssl-devel
    5、jpeglib.h not found.
    安装 libjpeg-devel
    6、png.h not found.
    安装 libpng-devel
    7、freetype-config not found.
    安装 freetype-devel
    8、mcrypt.h not found.
    安装 libmcrypt-devel
    9、wrong mysql library version or lib not found
    安装旧版本的 mysql 或 mariadb,,直接下载http://mirrors.163.com/mysql/Downloads/MySQL-5.6/mysql-5.6.45-linux-glibc2.12-x86_64.tar.gz
    解压后将文件夹移动到/usr/local/ 下并改名为 mysql5.6
[root@localhost src]# tar xvf mysql-5.6.39-linux-glibc2.12-x86_64.tar.gz
[root@localhost src]# mv mysql-5.6.39-linux-glibc2.12-x86_64 /usr/local/mysql5.6
[root@localhost src]# cd !$
cd /usr/local/mysql5.6
[root@localhost mysql5.6]# ls
bin  COPYING  data  docs  include  lib  man  mysql-test  README  scripts  share  sql-bench  support-files
  • 再重新编译,注意 /usr/local/mysql5.6 才是文件目录,注意更改
    ./configure --prefix=/usr/local/php-fpm --with-config-file-path=/usr/local/php-fpm/etc --enable-fpm --with-fpm-user=php-fpm --with-fpm-group=php-fpm --with-mysql=/usr/local/mysql5.6 --with-mysqli=/usr/local/mysql5.6/bin/mysql_config --with-pdo-mysql=/usr/local/mysql5.6 --with-mysql-sock=/tmp/mysql.sock --with-libxml-dir --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir --with-iconv-dir --with-zlib-dir --with-mcrypt --enable-soap --enable-gd-native-ttf --enable-ftp --enable-mbstring --enable-exif --with-pear --with-curl --with-openssl

5、重新编译

[root@localhost mysql5.6]# cd ../src/php-7.3.0
[root@localhost php-7.3.0]# ./configure --prefix=/usr/local/php-fpm --with-config-file-path=/usr/local/php-fpm/etc --enable-fpm --with-fpm-user=php-fpm --with-fpm-group=php-fpm --with-mysql=/usr/local/mysql5.6 --with-mysqli=/usr/local/mysql5.6/bin/mysql_config --with-pdo-mysql=/usr/local/mysql5.6 --with-mysql-sock=/tmp/mysql.sock --with-libxml-dir --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir --with-iconv-dir --with-zlib-dir --with-mcrypt --enable-soap --enable-gd-native-ttf --enable-ftp --enable-mbstring --enable-exif --with-pear --with-curl  --with-openssl

提示:configure: WARNING: unrecognized options: --with-mysql, --with-mcrypt, --enable-gd-native-ttf,以上几个参数已经不适用新版本php编译了,编译时可以取消

6、make && make install

[root@localhost php-7.3.0]# make && make install

7、拷贝配置文件

[root@localhost php-7.3.0]# cd /usr/local/php-fpm/etc/    
[root@localhost etc]# cp php-fpm.conf.default php-fpm.conf
[root@localhost etc]# cp /usr/local/src/php-7.3.0/php.ini-development ./php.ini
[root@localhost etc]# ls
pear.conf  php-fpm.conf  php
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值