[LAMP]【轉載】——PHP7.0的安裝

來源:互聯網
上載者:User

標籤:

***原文連結:http://my.oschina.net/sallency/blog/541287

 

安裝 libmcrypt mhash mcrypt

CentOS 7 預設不包含這三個模組,所以得手動安裝,注意mcrypt依賴前兩者

libmcrypt-2.5.8.tar.gz

http://sourceforge.net/projects/mcrypt/files/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz

mhash-0.9.9.tar.gz

http://sourceforge.net/projects/mhash/files/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz

mcrypt-2.6.8.tar.gz

http://sourceforge.net/projects/mcrypt/files/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz/

問題:configure: error: *** libmcrypt was not found

 

解決辦法:

# export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH

或者

# ldconfig

 

 

php 編譯安裝

前幾天試著裝了一次,雖然最後也裝好了但感覺亂亂的,在鳥哥的指導下才知道 mysql 擴充已經被 7.0 廢除了,此後使用 mysqli pdo-mysql 並且推薦使用 php 內建的 mysqlnd 驅動 配置參數,並且 php-fpm 也已經被 php 納入,直接在選項中開啟即可,我在官網看 --enable-cgi 是預設配置且 --enable-fast-cgi 已經被廢除,--enable-cgi 即可讓 fpm 模式調用

ladp在64的系統裡可能存在寫庫關聯問題,執行下面的命令

cp -frp /usr/lib64/libldap* /usr/lib/

部分參數釋意

./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-mcrypt \                               # mcrypt 密碼編譯演算法--with-mhash \                                # mhash 密碼編譯演算法--with-mysqli=mysqlnd \                       # 推薦使用 mysqlnd 驅動 mysql已被廢棄--with-pdo-mysql=mysqlnd \                    # 推薦使用 mysqlnd 驅動 mysql已被廢棄--with-gd \                                   # gd庫--with-iconv --with-zlib --with-curl --with-jpeg-dir --with-freetype-dir --with-apxs2=/usr/bin/apxs \                  # 讓 php 直接編譯到 apache 的模組中去--with-apache=/etc/httpd \                    # 靜態編譯apache的模組 編譯完後去httpd.conf中載入so--with-openssl --with-xmlrpc --with-bz2 --with-gettext \                              # 多語言應用開發--with-readline \                             # readline只能在linux下win使用stream_get_line--with-recode --with-ldap \                                   # 目錄協議--with-fpm-user=nginx --with-fpm-group=nginx --enable-fpm \                                  # php-fpm 進程管理器--enable-cgi \                                  # 預設開啟php的cgi sapi  --enable-xml --enable-bcmath --enable-inline-optimization --enable-mbregex --enable-mbstring --enable-ftp --enable-gd-native-ttf --enable-pcntl \                                #pcntl 多進程擴充模組--enable-sockets --enable-sysvmsg \                              #訊息佇列--enable-sysvshm \                              #記憶體共用模組 linux --enable-shmop \                                #記憶體共用模組 linux/windows--enable-zip --enable-soap --enable-session --enable-opcache \                              # opcache 緩衝最佳化--enable-cli                                    # cli 其實預設就是開啟的 若禁用同時要--without-pear

編譯參數

./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-mcrypt --with-mhash --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-gd \                                  --with-iconv --with-zlib --with-curl --with-jpeg-dir --with-freetype-dir --with-apxs2=/usr/bin/apxs \                  --with-openssl --with-xmlrpc --with-bz2 --with-gettext --with-readline --with-recode --with-ldap --with-fpm-user=nginx --with-fpm-group=nginx --enable-fpm --enable-cgi --enable-xml --enable-bcmath --enable-inline-optimization --enable-mbregex --enable-mbstring --enable-ftp --enable-gd-native-ttf --enable-pcntl --enable-sockets --enable-sysvmsg --enable-sysvshm --enable-shmop --enable-zip --enable-soap --enable-session --enable-opcache --enable-cli

 

 

注意的地方:

1:--enable-cgi --disable-cgi : 

在 5.3.0後 enable-cgi 等同於--enable-fastcgi 也就是說此後不需要在額外聲明 --enable-fastcgi,且 --enable-force-cgi-redirect 也預設有效且被廢棄在編譯選項中,要禁用需修改php.ini的cgi.force_redirect為0

2:--with-apxs2  --with-apache:

--with-apxs2是直接把php編譯到apache的模組中去  --with-apache是置頂apache的serverRoot路徑,產生apache的php模組 修改apache設定檔手動載入:

AddType application/x-httpd-php .php .html .htm

3:php7.0廢除了--with-mysql編譯選項,且推薦使用mysqlnd驅動

 

 

 

複製源碼包中的 php.ini-development php.ini-production 至 php 安裝目錄下的 etc 中,或者放在系統的 /etc 下也可以

將 php 的 bin 和 sbin 加入環境變數

echo "export PATH=$PATH:/usr/local/php/bin:/usr/local/php/sbin" >> /etc/profilesource profile

 

[LAMP]【轉載】——PHP7.0的安裝

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.