1. 程式人生 > >debian 編譯安裝php

debian 編譯安裝php

1. 安裝基礎依賴

 apt-get install libxml2-dev libssl-dev libbz2-dev libjpeg-dev libpng-dev libxpm-dev libfreetype6-dev libgmp-dev libgmp3-dev libmcrypt-dev libpspell-dev librecode-dev libcurl4-gnutls-dev libgmp-dev libgmp3-dev librecode-dev libpspell-dev libmcrypt-dev libreadline-dev libtidy-dev libxslt1-dev -y

2. 下載原始碼包 

    2.1 cd /usr/local/src  

    2.2 wget wget http://cn2.php.net/distributions/php-7.2.7.tar.gz

    2.3 tar -xzvf php..

3. cd php..  

4. 進行配置

./configure --enable-fpm --prefix=/usr/local/php --sysconfdir=/usr/local/php/etc --with-config-file-path=/usr/local/php/etc --with-config-file-scan-dir=/usr/local/php/etc/php.d --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-iconv-dir --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-mbstring --with-gd --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --with-bz2 --enable-soap --without-pear

5. make && make install 

6.設定環境變數 不贅言  

//遇到了幾個小小的錯誤

錯誤configure: error: Please reinstall the libcurl distribution - easy.h should be in <curl-dir>/include/curl/,解決方案:

  1. cd /usr/local/include sudo ln -s /usr/include/x86_64-linux-gnu/curl curl
  2. sudo apt-get install libcurl4-gnutls-dev