首页 >> PHP >> 内容页

ubuntu1804编译安装php7.4

在ubuntu1804中编译安装php7.4
编译前安装编译所需的库

apt install libxml2-dev libsqlite3-dev libcurl4-openssl-dev libssl-dev libpng-dev libwebp-dev libjpeg-dev libxslt-dev libbz2-dev libldap2-dev libonig-dev libzip-dev

配置(没有加php-fpm 按所需添加)

./configure --prefix=/usr/local/php --with-config-file-path=/etc --with-config-file-scan-dir=/usr/local/php/conf.d --enable-mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-iconv-dir --with-zlib --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-mbstring --enable-intl --enable-pcntl --enable-ftp --enable-gd --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --with-zip --enable-soap --with-gettext  --enable-opcache --with-xsl

编译

make

安装

make install

链接到环境变量的目录,以便调用

ln -sf /usr/local/php/bin/php /usr/bin/php
ln -sf /usr/local/php/bin/phpize /usr/bin/phpize
ln -sf /usr/local/php/bin/pear /usr/bin/pear
ln -sf /usr/local/php/bin/pecl /usr/bin/pecl