首页 软件

CentOS-7.6源码安装php-7.3.0

2021-09-01 23:18

# yum install epel-release -y

# yum install libxml2 libxml2-devel openssl openssl-devel bzip2 bzip2-devel libcurl \libcurl-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel gmp \gmp-devel libmcrypt libmcrypt-devel readline readline-devel libxslt libxslt-devel \zlib zlib-devel glibc glibc-devel glib2 glib2-devel ncurses curl gdbm-devel db4-devel \libXpm-devel libX11-devel gd-devel gmp-devel expat-devel xmlrpc-c xmlrpc-c-devel \libicu-devel libmcrypt libmcrypt-devel libmemcached-devel -y

# 由于CentOS-7中安装PHP-7.3环境对libzip和cmake的版本要求较高,因此,如果系统中原先已经安装过libzip和cmake软件的,需要先卸载这两个软件包,然后再重新安装高版本软件包。

# 首先安装cmake软件包# 由于cmake官网直接下载有时很慢,下载不了,所以到百度网盘首先下载cmake源码包,然后上传再源码安装。https://pan.baidu.com/s/15jjEJYeMTpF9-8cqDuTnmw 提取码:atah

# yum remove cmake

# cd /usr/local/src

# tar -zxf cmake-3.13.0-rc2.tar.gz

# cd cmake-3.13.0-rc2

# ./configure

# make && make install

# 然后安装libzip软件包

# yum remove libzip

# cd ..

# wget https://down.24kplus.com/linux/libzip-1.5.2.tar.gz

# tar -zxf libzip-1.5.2.tar.gz

# cd libzip-1.5.2

# mkdir build && cd build

# /usr/local/bin/cmake ..

# make && make install

# 源码安装php-7.3.0

# cd /usr/local/src && wget http://mirrors.sohu.com/php/php-7.3.0.tar.gz

# cd php-7.3.0

# ./configure --prefix=/usr/local/php73 --with-config-file-path=/usr/local/php73/etc --enable-fpm --enable-inline-optimization --disable-debug --disable-rpath --enable-shared --enable-soap --with-xmlrpc --with-openssl --with-mcrypt --with-pcre-regex --with-sqlite3 --with-zlib --enable-bcmath --with-iconv --with-bz2 --enable-calendar --with-curl --with-cdb --enable-dom --enable-exif --enable-fileinfo --enable-filter --with-pcre-dir --enable-ftp --with-gd --with-openssl-dir --with-jpeg-dir --with-png-dir --with-freetype-dir --enable-gd-native-ttf --enable-gd-jis-conv --with-gettext --with-gmp --with-mhash --enable-json --enable-mbstring -enable-mbregex --enable-mbregex-backtrack --with-libmbfl --with-onig --enable-pdo --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-zlib-dir --with-pdo-sqlite --with-readline --enable-session --enable-shmop --enable-simplexml --enable-sockets --enable-sysvmsg --enable-sysvsem --enable-sysvshm --enable-wddx --with-libxml-dir --with-xsl --enable-zip --enable-mysqlnd-compression-support --with-pear --enable-opcache

# make && make install

# cp php.ini-production /usr/local/php73/etc/php.ini

# cp /usr/local/php73/etc/php-fpm.conf.default /usr/local/php73/etc/php-fpm.conf

# cp sapi/fpm/init.d.php-fpm /etc/init.d/php73-fpm

# chmod +x /etc/init.d/php73-fpm

# chkconfig --add php73-fpm

# chkconfig --list php73-fpm

# service php73-fpm start

注意:在编译过程中遇到如下错误,请按照步骤处理完再进行编译安装:

configure: error: off_t undefined; check your library configuration

# vim /etc/ld.so.conf

# 添加如下几行

/usr/local/lib64/usr/local/lib/usr/lib/usr/lib64

# 保存退出:wq

# ldconfig -v # 使之生效

返回首页
返回顶部