PHP编译安装

PHP编译安装

身为一名PHP开发者,技术栈自不用多说。平常接触最多的就是环境搭建,网上各种集成环境,安装之后也并不明白其中运行流程,今天分享一下关于PHP源码的编译:

所有操作需要在root用户下
本机测试案例系统信息:ubuntu16.04
安装路径:/usr/local/php
下载PHP7.2.0安装包,点此下载 [密码:us9h]

1、安装依赖包
sudo apt-get update -y
sudo apt-get install zip -y
sudo apt-get install libpcre3-dev
libssl-dev perl make build-essential curl -y
sudo apt-get install autoconf -y
sudo apt-get install libpcre3-dev -y
tar -zxvf php-7.2.0.tar.gz
sudo apt install -y build-essential &&
sudo apt install -y bison &&
sudo apt install -y re2c &&
sudo apt install -y pkg-config &&
sudo apt-get install -y libxml2-dev &&
sudo apt-get install -y libxml2 &&
sudo apt install -y build-essential &&
sudo apt install -y bison &&
sudo apt install -y re2c &&
sudo apt install -y pkg-config &&
sudo apt install -y libbz2-dev &&
sudo apt install -y libcurl4-openssl-dev &&
sudo apt install -y libjpeg-dev &&
sudo apt install -y libpng12-dev &&
sudo apt install -y libfreetype6-dev &&
sudo apt install -y libgmp-dev &&
sudo apt install -y libreadline6-dev &&
sudo apt install -y libxslt1-dev &&
sudo apt install -y --allow-unauthenticated libzip-dev

2、编译安装
tar -zxvf libzip-1.3.2.tar.gz

cd php-7.2.0

./configure \    --prefix=/usr/local/php \          --with-config-file-path=/etc \    --enable-fpm \    --enable-inline-optimization \    --disable-debug \    --disable-rpath \    --enable-shared  \    --with-libxml-dir=/usr \    --with-xmlrpc \    --with-mhash \    --with-pcre-regex \    --with-sqlite3 \    --with-zlib \    --with-libzip=../libzip-1.3.2 \    --enable-bcmath \    --with-iconv \    --with-openssl \    --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-zlib-dir \    --with-freetype-dir \    --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-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
############# --with-apxs2=/usr/local/apache2/bin/apxs

make && sudo make install

cp php.ini-development /etc/php.ini

cd /home
echo “export PATH=$PATH:/usr/local/php/bin” >> ~/.bash_profile
source ~/.bash_profile

你可能感兴趣的:(PHP环境安装)