日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程语言 > php >内容正文

php

opencore0.6.3_Ubuntu 18.04 源码编译安装 PHP 7.3

發布時間:2025/3/12 php 40 豆豆
生活随笔 收集整理的這篇文章主要介紹了 opencore0.6.3_Ubuntu 18.04 源码编译安装 PHP 7.3 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

記錄在Ubuntu 18.04下源碼編譯安裝 PHP 7.3的過程步驟。

0.下載PHP源代碼

首先需要從PHP官網下載PHP7.3.1的源代碼,保存為php-7.3.1.tar.xz。

http://cn2.php.net/distributions/php-7.3.1.tar.xz

在上述文件保存的目錄中打開終端,使用命令將其解壓,并使用cd進入解壓后的目錄

tar -xvJf ./php-7.3.1.tar.xz

cd php-7.3.1

1.安裝依賴

其次,需要安裝一些編譯PHP所需要的依賴

sudo apt update

sudo apt install gcc

sudo apt install make

sudo apt install openssl

sudo apt install curl

sudo apt install libbz2-dev

sudo apt install libxml2-dev

sudo apt install libjpeg-dev

sudo apt install libpng-dev

sudo apt install libfreetype6-dev

sudo apt install libzip-dev

2.配置PHP

在編譯前,需要對PHP進行配置,以供其生成對應的makefile文件

./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --enable-fpm --with-fpm-user=www --with-fpm-group=www --with-mysqli --with-pdo-mysql --with-iconv-dir --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-mbstring --enable-ftp --with-gd --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --without-pear --with-gettext --disable-fileinfo --enable-maintainer-zts

配置成功后會出現如下字樣

+--------------------------------------------------------------------+

| License: |

| This software is subject to the PHP License, available in this |

| distribution in the file LICENSE. By continuing this installation |

| process, you are bound by the terms of this license agreement. |

| If you do not agree with the terms of this license, you must abort |

| the installation process at this point. |

+--------------------------------------------------------------------+

Thank you for using PHP.

在這一步中,如果出現無法找到某個依賴的情況,可以嘗試使用sudo apt install來重新安裝一下沒有找到的依賴。

3.編譯并安裝PHP

在完成配置后,可以直接使用make來進行編譯,可以使用參數-j來指定編譯線程數量來多線程編譯

make -j4

編譯需要一段比較長的時間,請稍作等待,編譯成功后會輸出如下內容

Build complete.

Don't forget to run 'make test'.

然后執行以下命令進行安裝

sudo make install

執行完成后,PHP將會被安裝到/usr/local/php/。

4.驗證PHP

可以使用如下指令來輸出PHP的版本,來驗證是否正確安裝

/usr/local/php/bin/php -v

如果正確安裝,將會出現如下內容

PHP 7.3.1 (cli) (built: Jan 18 2019 20:11:04) ( ZTS )

Copyright (c) 1997-2018 The PHP Group

Zend Engine v3.3.1, Copyright (c) 1998-2018 Zend Technologies

到這一步為止,PHP7.3.1便成功從源代碼編譯安裝了。

5.復制php.ini

編譯安裝后的目錄并不會有現成的php.ini,需要手動復制過去。

在解壓出來的源代碼目錄中,有供開發環境使用的php.ini-development和供生產環境使用的php.ini-production。

輸入命令來復制(以開發環境為例)

sudo cp php.ini-development /usr/local/php/etc/php.ini

總結

以上是生活随笔為你收集整理的opencore0.6.3_Ubuntu 18.04 源码编译安装 PHP 7.3的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。