您的位置 首页 php

ubuntu16安装php7.2实践

今天重新编译安装了php ,每次安装都会遇到一些问题,顺便记录一下:

首先声明一下环境,php-7.2.19 ,ubuntu 16.04

因为不同的 Linux 发行版的包管理和包名不太一样,

编译选项如下

可以通过./configure -h 查看编译选项,下面的选项可以根据自己的实际情况自行调整

./configure –prefix=/usr/local/php7 –exec-prefix=/usr/local/php7 –bindir=/usr/local/php7/bin –sbindir=/usr/local/php7/sbin –includedir=/usr/local/php7/include –libdir=/usr/local/php7/lib/php –mandir=/usr/local/php7/php/man –with-config-file-path=/usr/local/php7/etc –with-mysql-sock=/var/run/mysql/mysql.sock –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 –enable-opcache –enable-fpm –enable-fastcgi –with-fpm-user=nginx–with-fpm-group=nginx –without-gdbm –disable-fileinfo –enable-maintainer-zts –enable-posix –enable-json –enable-pthreads=shared –with-tsrm-pthreads

下面是常见 的一些错误和处理方法,供各位参考

1. configure: WARNING: unrecognized options: –with-mcrypt, –with-mysql, –enable-gd-native-ttf, –enable-fastcgi, –enable-pthreads

没有对应的扩展源代码

把没有的扩展去掉

2. configure: error: no acceptable C compiler found in $PATH

缺少编译器,安装 gcc

apt-get update

apt install gcc

3. configure: error: libxml2 not found. Please check your libxml2 installation.

缺少libxml库

apt install libxml2 libxml2-dev

4. configure: error: Cannot find openssl ‘s <evp.h>

缺少openssl库

redhet centos yum install openssl openssl-devel

apt install openssl libssl-dev

Cannot find OpenSSL’s libraries

apt-get install build-essential libexpat1-dev libgeoip-dev libpng-dev libpcre3-dev libssl-dev libxml2-dev rcs zlib1g-dev libmcrypt-dev libcurl4-openssl-dev libjpeg-dev libpng-dev libwebp-dev pkg-config

最后成功了,

unrecognized options: –with-mcrypt, –enable-gd-native-ttf, –enable-fastcgi, –with-mcrypt, –enable-pthreads

需要单独安装的扩展,加解密mcrypt

–with-mcrypt=/usr/local/related/libmcrypt

–enable-pthreads 多线程的支持

–enable-fastcgi 以去除,默认开启

config完成后

make && make install

安装结果

复制源码目录的php.ini-development 到安装目录的etc下 ,php.ini

最后:遇到问题多多百度,你遇到的问题可能很多人已经踩过坑了。

文章来源:智云一二三科技

文章标题:ubuntu16安装php7.2实践

文章地址:https://www.zhihuclub.com/78906.shtml

关于作者: 智云科技

热门文章

网站地图