手動編譯安裝php7,php編譯安裝和極速安裝

本文目錄一覽:

ubuntu如何編譯安裝官方php7?

.

$ git clone git@github.com:php/php-src.git php-src

$ cd php-src

$ ./buildconf

$ sudo apt-get install autoconf bison libxml2-dev apache2-dev systemtap-sdt-dev openssl pkg-config libssl-dev libcurl4-openssl-dev libbz2-dev libgdbm-dev libjpeg62 libjpeg62-dev libpng12-0 libpng12-dev libfreetype6-dev libicu-dev libiodbc2-dev libxslt1-dev

$ ./configure –prefix=/usr/local/php7/7.0.0 –localstatedir=/usr/local/var –sysconfdir=/usr/local/etc/php/7 –with-config-file-path=/usr/local/etc/php/7 –with-config-file-scan-dir=/usr/local/etc/php/7/conf.d –mandir=/usr/local/php7/7.0.0/share/man –enable-bcmath –enable-calendar –enable-dba –enable-exif –enable-ftp –enable-gd-native-ttf –enable-intl –enable-mbregex –enable-mbstring –enable-shmop –enable-soap –enable-sockets –enable-sysvmsg –enable-sysvsem –enable-sysvshm –enable-wddx –enable-zip –with-freetype-dir=/usr/local/opt/freetype –with-gd –with-gettext=/usr/local/opt/gettext –with-iconv-dir=/usr –with-icu-dir=/usr/local/opt/icu4c –with-jpeg-dir=/usr/local/opt/jpeg –with-kerberos=/usr –with-libedit –with-mhash –with-ndbm=/usr –with-openssl=/usr/local/opt/openssl –with-pdo-odbc=unixODBC,/usr/local/opt/unixodbc –with-png-dir=/usr/local/opt/libpng –with-unixODBC=/usr/local/opt/unixodbc –with-xmlrpc –with-zlib=/usr/local/opt/zlib –with-apxs2=/usr/bin/apxs –libexecdir=/usr/local/php7/7.0.0/libexec –with-bz2=/usr –disable-debug –enable-fpm –with-fpm-user=_www –with-fpm-group=_www –with-curl –with-xsl=/usr –with-ldap –with-ldap-sasl=/usr –with-mysql-sock=/tmp/mysql.sock –with-mysqli=mysqlnd –with-pdo-mysql=mysqlnd –disable-opcache –enable-pcntl –enable-dtrace –disable-phpdbg –enable-zend-signals

$ make 

$ sudo make install

$ php -v

centos7 怎麼編譯安裝php7

PHP不用添加啟動,啟動nginx 時候會自動載入php,只要把nginx添加到啟動項就行了 。

centos編譯安裝php7怎麼加入apache

直接下載PHP7.0.2的安裝包解壓,編譯,安裝:

下載php7,並解壓

$ cd /usr/src/

$ wget

#解壓

$ tar -xzxvf php-7.0.2.tar.gz

$ cd php-7.0.2

解壓完後先不要編譯,請檢查是否安裝了gcc ,沒有的話執行yum install gcc

檢查是否安裝了libxml2 ,沒有的話執行yum install libxml2

檢查是否安裝了libxml2-devel,沒有的話執行yum install libxml2-devel

註:因為改為用nginx了,所以編譯參數中的–with-apxs2=/usr/bin/apxs去掉了,如果要配置apache用,安裝PHP前,請先安裝apache。

望採納。

PHP7安裝intl擴展和linux安裝icu

一 PHP intl 是國際化擴展,是ICU 庫的一個包裝器。所以在安裝PHP intl擴展前要先安裝ICU庫,安裝ICU庫的具體步驟::

二 安裝intl擴展

1:進入php7.2.5源碼:

2:運行:phpize ,找不到命令時,將路徑補全:/usr/local/php7/bin/phpize(是php的安裝路徑),出現如下:

Configuring for:

PHP Api Version: 20100412

Zend Module Api No: 20100525

Zend Extension Api No: 220100525

3:運行配置

./configure –enable-intl –with-icu-dir=/usr/local/icu/ –with-php-config=/usr/local/php7/bin/php-config

注:前面路徑為icu的安裝路徑,後面路徑為php的安裝路徑。

4:編譯擴展:make

5:複製擴展到目標文件夾

cp /user/local/php/php7.2.5/ext/intl/modules/intl.so /user/local/php7/lib/php/extensions/no-debug-non-zts-20170718

注意:也可以find / -name intl.so 查找。

6:設置擴展加入配置文件中:

[intl]

extension_dir = “/usr/local/php7/lib/php/extensions/no-debug-non-zts-20170718/”

extension=intl.so

大坑:::採用phpinfo()時,無法找到配置的intl擴展,說明配置沒有生效。。。。。。

原因:在編譯php時沒有 –with-config-file-path=PATH 指定php.ini路徑,默認的路徑為/usr/local/php7/lib,只需要將php.ini放入這個默認的路徑即可。你也可以安裝配置php時加入,如下:

./configure –prefix=/usr/local/php7 –with-config-file-path=/usr/local/php7/etc –with-curl –with-freetype-dir –with-gd –with-gettext –with-iconv-dir –with-kerberos –with-libdir=lib64 –with-libxml-dir –with-mysqli –with-openssl –with-pcre-regex –with-pdo-mysql –with-pdo-sqlite –with-pear –with-png-dir –with-xmlrpc –with-xsl –with-zlib –enable-fpm –enable-bcmath -enable-inline-optimization –enable-gd-native-ttf –enable-mbregex –enable-mbstring –enable-opcache –enable-pcntl –enable-shmop –enable-soap –enable-sockets –enable-sysvsem –enable-xml –enable-zip –enable-pcntl –with-curl –with-fpm-user=nginx –enable-ftp –enable-session –enable-xml –with-apxs2=/usr/bin/apxs

訪問:index.php中phpinfo()文件。

原創文章,作者:小藍,如若轉載,請註明出處:https://www.506064.com/zh-tw/n/312666.html

(0)
打賞 微信掃一掃 微信掃一掃 支付寶掃一掃 支付寶掃一掃
小藍的頭像小藍
上一篇 2025-01-06 09:47
下一篇 2025-01-06 09:47

相關推薦

  • PHP和Python哪個好找工作?

    PHP和Python都是非常流行的編程語言,它們被廣泛應用於不同領域的開發中。但是,在考慮擇業方向的時候,很多人都會有一個問題:PHP和Python哪個好找工作?這篇文章將從多個方…

    編程 2025-04-29
  • PHP怎麼接幣

    想要在自己的網站或應用中接受比特幣等加密貨幣的支付,就需要對該加密貨幣擁有一定的了解,並使用對應的API進行開發。本文將從多個方面詳細闡述如何使用PHP接受加密貨幣的支付。 一、環…

    編程 2025-04-29
  • 使用PHP foreach遍歷有相同屬性的值

    本篇文章將介紹如何使用PHP foreach遍歷具有相同屬性的值,並給出相應的代碼示例。 一、基礎概念 在講解如何使用PHP foreach遍歷有相同屬性的值之前,我們需要先了解幾…

    編程 2025-04-28
  • PHP獲取301跳轉後的地址

    本文將為大家介紹如何使用PHP獲取301跳轉後的地址。301重定向是什麼呢?當我們訪問一個網頁A,但是它已經被遷移到了另一個地址B,此時若伺服器端做了301重定向,那麼你的瀏覽器在…

    編程 2025-04-27
  • PHP登錄頁面代碼實現

    本文將從多個方面詳細闡述如何使用PHP編寫一個簡單的登錄頁面。 1. PHP登錄頁面基本架構 在PHP登錄頁面中,需要包含HTML表單,用戶在表單中輸入賬號密碼等信息,提交表單後服…

    編程 2025-04-27
  • PHP與Python的比較

    本文將會對PHP與Python進行比較和對比分析,包括語法特性、優缺點等方面。幫助讀者更好地理解和使用這兩種語言。 一、語法特性 PHP語法特性: <?php // 簡單的P…

    編程 2025-04-27
  • PHP版本管理工具phpenv詳解

    在PHP項目開發過程中,我們可能需要用到不同版本的PHP環境來試驗不同的功能或避免不同版本的兼容性問題。或者我們需要在同一台伺服器上同時運行多個不同版本的PHP語言。但是每次手動安…

    編程 2025-04-24
  • PHP數組去重詳解

    一、array_unique函數 array_unique是php中常用的數組去重函數,它基於值來判斷元素是否重複,具體使用方法如下: $array = array(‘a’, ‘b…

    編程 2025-04-24
  • PHP導出Excel文件

    一、PHP導出Excel文件列寬調整 當我們使用PHP導出Excel文件時,有時需要調整單元格的列寬。可以使用PHPExcel類庫中的setWidth方法來設置單元格的列寬。下面是…

    編程 2025-04-24
  • php擴展庫初探

    一、什麼是php擴展庫? PHP擴展庫(PHP extension)是一些用C語言編寫的動態鏈接庫,用於擴展PHP的功能。PHP擴展庫使得PHP可以與各種資料庫系統相連、SMTP、…

    編程 2025-04-23

發表回復

登錄後才能評論