php7安装步骤

去官网选择合适的镜像站点去下载源码包:https://secure.php.net/get/php-7.3.0.tar.gz/from/a/mirror

cd ~/installs
wget http://hk1.php.net/get/php-7.3.0.tar.gz/from/this/mirror
tar -zxf php-7.3.0.tar.gz
cd php-7.3.0
 
./configure  --prefix=/home/prod/softwares/php7 --exec-prefix=/home/prod/softwares/php7 --with-config-file-path=/home/prod/softwares/php7/conf --enable-bcmath --enable-mbstring --with-gettext --enable-fpm --enable-shmop --enable-soap --enable-opcache --with-curl --disable-debug --disable-rpath --enable-inline-optimization --with-bz2 --with-zlib --enable-sockets --enable-sysvsem --enable-sysvshm --enable-pcntl --enable-mbregex --with-mhash --enable-zip --with-pcre-regex --with-mysqli --with-gd --with-jpeg-dir --with-freetype-dir --enable-calendar
 
make && make install

  安装遇到的问题:

1.libzip安装:官网找到最新的1.5.1:https://libzip.org/

yum -y remove libzip-devel
yum -y install cmake
wget https://libzip.org/download/libzip-1.5.1.tar.gz
tar xvf libzip-1.5.1.tar.gz
cd libzip-1.5.1
mkdir build
cd build
cmake ..
make
make install

2.configure: error: off_t undefined; check your library configuration:转载于链接:https://segmentfault.com/q/1010000007346459 

根据报错信息分析 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

(其中ldconfig -v 是用来更新ld的缓存文件 ld.so.cache , 缓存文件的目的是记录动态编译库文件的路径,加快二进制文件运行时的速度)

待验证: ld默认搜索路径应该是 /usr/local/lib /usr/lib ,这个待验证
ld默认搜索路径是 /usr/local/lib /usr/lib

猜你喜欢

转载自www.cnblogs.com/phpcainiao/p/10369654.html
今日推荐