国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

php8.0.0安裝體驗和擴(kuò)展介紹流程

這篇具有很好參考價值的文章主要介紹了php8.0.0安裝體驗和擴(kuò)展介紹流程。希望對大家有所幫助。如果存在錯誤或未考慮完全的地方,請大家不吝賜教,您也可以點擊"舉報違法"按鈕提交疑問。

php8.0.0安裝體驗和擴(kuò)展介紹流程,PHP,php,開發(fā)語言

  • 安裝前的扯犢子科普工作

PHP 三大模塊:

  • SAPI:接受并處理請求。
  • Zend Engine:PHP 的核心,負(fù)責(zé)分析 PHP 代碼并轉(zhuǎn)為 opcode,然后在 Zend VM 虛擬機(jī)上執(zhí)行。
  • PHP 功能函數(shù)及擴(kuò)展層:實現(xiàn)各種功能,例如 curl 通信、連接 MySQL 等。

PHP 中,有以下幾種方式添加擴(kuò)展:

  • 把擴(kuò)展編譯進(jìn) PHP

  • 通過 pecl 命令或 Linux 發(fā)行版自帶的 yum、apt-get 等命令安裝,動態(tài)加載(Linux 下是 *.so 文件,Windows 下是 *.dll 文件)

  • 用 phpize 從源碼編譯共享 PECL 擴(kuò)展庫
    相比通過 yum install 或 apt-get 等各大 Linux 發(fā)行版自帶的安裝方向,源碼編譯安裝略顯復(fù)雜,但是靈活性也更高,比如要安裝 PCNTL 等擴(kuò)展,就只能通過源碼編譯安裝。

  • 注意:源碼編譯安裝時,只會安裝指定的擴(kuò)展,而好多擴(kuò)展是默認(rèn)不安裝的。對于常用的數(shù)據(jù)庫驅(qū)動、OpenSSL、GD 庫等都需要指定。如果安裝后發(fā)現(xiàn)遺漏,可以重新編譯,加上相應(yīng)的參數(shù)可得到驅(qū)動程序(Linux 下是 *.so 文件),然后復(fù)制到 PHP 的擴(kuò)展目錄(一般是 /usr/local/php/include/php/ext)下,并在 php.ini 配置文件中開啟擴(kuò)展既可以。

通過 yum list php72w-* 可以在 CentOS 中查看可以使用命令安裝的擴(kuò)展。

  • 概述啰嗦完成,接著來干正事

安裝環(huán)境

  • 1核2GB配置,建議玩家能高就高,下文就有編譯過程中低配置的問題體現(xiàn),仔細(xì)閱讀,謹(jǐn)慎跳躍查看
CentOS Linux release 7.7.1908 (Core)

Linux VM_0_12_centos 3.10.0-1062.9.1.el7.x86_64 #1 SMP Fri Dec 6 15:49:49 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux


0、下載地址

wget https://github.com/php/php-src/archive/php-8.0.0.tar.gz

安裝依賴

yum install -y autoconf libxml2-dev libsqlite3-dev \
libcurl4-openssl-dev libssl-dev libonig-dev libtidy-dev zlib1g-dev

1、壓縮包解壓常規(guī)操作 php-src-php-8.0.0.tar.gz

tar -zxvf php-src-php-8.0.0.tar.gz

2、從官方包中拿到的數(shù)據(jù)不含configure腳本,需要將安裝GNU autoconf,來生成configure


yum install autoconf
運(yùn)行 ./buildconf
``

然后 configure就可以安裝了
參考官網(wǎng)地址:https://www.php.net/manual/zh/faq.build.php

3、調(diào)用configure生成Makefile文件

執(zhí)行配置選項(例如 --prefix 可以指定安裝位置),判斷硬件及操作系統(tǒng)平臺,生成需要編譯的 Makefile 文件

執(zhí)行configure的前置操作

mkdir /usr/local/php800

配置擴(kuò)展參數(shù)

./configure \
--prefix=/usr/local/php800 \
--exec-prefix=/usr/local/php800 \
--bindir=/usr/local/php800/bin \
--sbindir=/usr/local/php800/sbin \
--includedir=/usr/local/php800/include \
--libdir=/usr/local/php800/lib/php \
--mandir=/usr/local/php800/php/man \
--with-config-file-path=/usr/local/php800/etc \
--enable-fpm \
--with-fpm-user=www \
--with-fpm-group=www \
--enable-inline-optimization \
--disable-debug \
--disable-rpath \
--enable-shared \
--enable-soap \
--with-libxml-dir \
--with-xmlrpc \
--with-openssl \
--with-mcrypt \
--with-mhash \
--with-pcre-regex \
--with-sqlite3 \
--with-zlib \
--enable-bcmath \
--with-iconv \
--with-bz2 \
--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-native-ttf \
--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-zlib-dir \
--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 \

錯誤清單

(1)configure: error: re2c 0.13.4 is required to generate PHP lexers.

需要安裝re2c

yum安裝rpm包
yum install https://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/r/re2c-0.14.3-2.el7.x86_64.rpm
源碼安裝
wget https://sourceforge.net/projects/re2c/files/0.16/re2c-0.16.tar.gz && tar zxf re2c-0.16.tar.gz && cd re2c-0.16

./configure && make && make install
安裝(git源碼編譯)
git clone https://git.code.sf.net/p/re2c/code-git re2c && cd re2c/
./autogen.sh && ./configure --prefix=/usr/local/re2c/
make && make install
ln -sf /usr/local/re2c/bin/re2c /usr/local/bin/re2c
re2c -v
re2c -h
git clone https://github.com/skvadrik/re2c.git re2c && cd re2c
./autogen.sh && ./configure
make && make install
(2)測試安裝 php 的 openssl 模塊的時候,分別使用了以下方式(以具體的openssl擴(kuò)展為例)
./configure
./configure --with-openssl
./configure --with-openssl=/usr/local
./configure --with-openssl=/usr/local/xxx

結(jié)果出現(xiàn)了不同的結(jié)果

第一種不會安裝 openssl 模塊
第二種可以正常安裝 openssl 模塊
第三種可以正常安裝 openssl 模塊 (我的電腦存在 /usr/local/include/openssl/evp.h)
第四種會報錯:configure: error: Cannot find OpenSSL's evp.h (我的電腦 /usr/local/xxx 是空目錄)

預(yù)編譯擴(kuò)展信息完成提示

+--------------------------------------------------------------------+
| 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.

configure: WARNING: unrecognized options: --enable-inline-optimization, --with-libxml-dir, --with-xmlrpc, --with-mcrypt, --with-pcre-regex, --with-pcre-dir, --with-gd, --with-jpeg-dir, --with-png-dir, --with-freetype-dir, --enable-gd-native-ttf, --enable-json, --enable-mbregex-backtrack, --with-libmbfl, --with-onig, --enable-wddx, --with-libxml-dir, --enable-zip


編譯參數(shù)-使用

./configure -h
在源代碼目錄中,該命令可以查看所有編譯參數(shù)以及對應(yīng)的英文解釋

編譯參數(shù)-說明

--prefix=/opt/php //指定 php 安裝目錄
--with-apxs2=/usr/local/apache/bin/apxs //整合Apache
--with-config-file-path=/opt/php/etc //指定php.ini位置
--with-config-file-scan-dir=/opt/php/etc/php.d //指定額外拓展配置歸放處文件夾
--enable-safe-mode //打開安全模式
--enable-ftp //打開ftp的支持
--enable-zip //打開對zip的支持
--with-bz2 //打開對bz2文件的支持
--with-jpeg-dir //打開對jpeg圖片的支持
--with-png-dir //打開對png圖片的支持
--with-freetype-dir //打開對freetype字體庫的支持
--without-iconv //關(guān)閉iconv函數(shù),各種字符集間的轉(zhuǎn)換
--with-libXML-dir //打開libxml2庫的支持
--with-XMLrpc //打開xml-rpc的c語言
--with-zlib-dir //打開zlib庫的支持
--with-gd //打開gd庫的支持
--enable-gd-native-ttf //支持TrueType字符串函數(shù)庫
--with-curl //打開curl瀏覽工具的支持
--with-curlwrappers //運(yùn)用curl工具打開url流
--with-ttf //打開freetype1.*的支持,可以不加了
--with-xsl //打開XSLT 文件支持,擴(kuò)展了libXML2庫 ,需要libxslt軟件
--with-gettext //打開gnu 的gettext 支持,編碼庫用到
--with-pear //打開pear命令的支持,PHP擴(kuò)展用的
--enable-calendar //打開日歷擴(kuò)展功能
--enable-mbstring //多字節(jié),字符串的支持
--enable-bcmath //精度計算,解決蛋疼的數(shù)字運(yùn)算精度問題
--enable-sockets //打開 sockets 支持
--enable-exif //圖片的元數(shù)據(jù)支持
--enable-magic-quotes //魔術(shù)引用的支持
--disable-rpath //關(guān)閉額外的運(yùn)行庫文件
--disable-debug //關(guān)閉調(diào)試模式
--with-ldap-dir //輕量目錄訪問協(xié)議

4、編譯和安裝

make && make install

錯誤提示

1、make: *** [ext/fileinfo/libmagic/apprentice.lo] Error 1

因為系統(tǒng)的內(nèi)存不足1G造成的,然后需要加上 --disable-fileinfo,然重新編譯即可;

即在執(zhí)行 ./configure 時–enable-fileinfo 改為 --disable-fileinfo

清除原編譯 make clean,重新生成makefile文件

成功make提示

Build complete.
Don't forget to run 'make test'.

成功make install 提示

[root@VM_0_12_centos php-src-php-8.0.0]# make install
Installing shared extensions:     /usr/local/php800/lib/php/extensions/no-debug-non-zts-20200930/
Installing PHP CLI binary:        /usr/local/php800/bin/
Installing PHP CLI man page:      /usr/local/php800/php/man/man1/
Installing PHP FPM binary:        /usr/local/php800/sbin/
Installing PHP FPM defconfig:     /usr/local/php800/etc/
Installing PHP FPM man page:      /usr/local/php800/php/man/man8/
Installing PHP FPM status page:   /usr/local/php800/php/php/fpm/
Installing phpdbg binary:         /usr/local/php800/bin/
Installing phpdbg man page:       /usr/local/php800/php/man/man1/
Installing PHP CGI binary:        /usr/local/php800/bin/
Installing PHP CGI man page:      /usr/local/php800/php/man/man1/
Installing build environment:     /usr/local/php800/lib/php/build/
Installing header files:          /usr/local/php800/include/php/
Installing helper programs:       /usr/local/php800/bin/
  program: phpize
  program: php-config
Installing man pages:             /usr/local/php800/php/man/man1/
  page: phpize.1
  page: php-config.1
Installing PEAR environment:      /usr/local/php800/lib/php/php/
--2020-11-26 12:29:14--  https://pear.php.net/install-pear-nozlib.phar
Resolving pear.php.net (pear.php.net)... 109.203.101.62
Connecting to pear.php.net (pear.php.net)|109.203.101.62|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 3634227 (3.5M)
Saving to: ‘pear/install-pear-nozlib.phar’

100%[==========================================================================================================================>] 3,634,227   17.5KB/s   in 2m 47s 

2020-11-26 12:32:02 (21.3 KB/s) - ‘pear/install-pear-nozlib.phar’ saved [3634227/3634227]

[PEAR] Archive_Tar    - installed: 1.4.9
[PEAR] Console_Getopt - installed: 1.4.3
[PEAR] Structures_Graph- installed: 1.1.1
[PEAR] XML_Util       - installed: 1.4.5
warning: pear/PEAR dependency package "pear/Archive_Tar" installed version 1.4.9 is not the recommended version 1.4.4
[PEAR] PEAR           - installed: 1.10.12
Warning! a PEAR user config file already exists from a previous PEAR installation at '/root/.pearrc'. You may probably want to remove it.
Wrote PEAR system config file at: /usr/local/php800/etc/pear.conf
You may want to add: /usr/local/php800/lib/php/php to your php.ini include_path
/home/humx/php-src-php-8.0.0/build/shtool install -c ext/phar/phar.phar /usr/local/php800/bin/phar.phar
ln -s -f phar.phar /usr/local/php800/bin/phar
Installing PDO headers:           /usr/local/php800/include/php/ext/pdo/


5、成功安裝的測試工作

進(jìn)入到/usr/local/php800/bin中運(yùn)行 ./php -m,查看擴(kuò)展安裝情況

[PHP Modules]
bcmath
bz2
calendar
Core
ctype
curl
date
dba
dom
exif
filter
ftp
gettext
gmp
hash
iconv
json
libxml
mbstring
mysqli
mysqlnd
openssl
pcre
PDO
pdo_mysql
pdo_sqlite
Phar
posix
readline
Reflection
session
shmop
SimpleXML
soap
sockets
SPL
sqlite3
standard
sysvmsg
sysvsem
sysvshm
tokenizer
xml
xmlreader
xmlwriter
xsl
zlib
[Zend Modules]


php8一些配置

配置php.ini

進(jìn)行到php8的源代碼根目錄中操作(編譯過程中制定了位置):

cp php.ini-production /usr/local/php800/etc/php.ini

配置環(huán)境變量


ln -s /usr/local/php800 /usr/bin/php8

或者添加 /etc/profile 進(jìn)行配置,在末尾追加如下記錄:

# PHP8
export PATH=$PATH:/usr/local/php800/bin

source /etc/profile 生效

配置php-fpm

配置下如下環(huán)境,可以修改監(jiān)聽的端口等

cd /usr/local/php800/etc
cp php-fpm.conf.default php-fpm.conf

cd /usr/local/php800/php-fpm.d
cp www.conf.default www.conf

配置php-fpm的pid文件

在php-fpm.conf中配置,將pid=run/php-fpm.pid前邊的“#”去掉,并修改為php-fpm800
重啟php-fpm即可生效

[global]
; Pid file
; Note: the default prefix is /usr/local/php800/var
; Default Value: none
pid = run/php-fpm800.pid

安裝composer

cd /usr/local/php800/bin/
curl -sS https://getcomposer.org/installer | php8
cp composer.phar /usr/bin/composer8

# 阿里云 Composer 全量鏡像
composer8 config -g repo.packagist composer https://mirrors.aliyun.com/composer/

# 中國全量鏡像
composer config -g repo.packagist composer https://packagist.phpcomposer.com

# 更新 composer:
composer selfupdate

init.d的php-fpm服務(wù)的添加(跟systemd配置一個即可,php738采用此法啟動)

/etc/init.d 是 /etc/rc.d/init.d 的軟鏈接

php源碼編譯目錄下的 sapi/fpm/init.d.php-fpm 文件拷貝到系統(tǒng)配置 /etc/init.d 目錄下并重命名為 php-fpm

cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm 
chmod +x /etc/init.d/php-fpm

# 啟動命令
service php-fpm start
service php-fpm stop
service php-fpm restart
service php-fpm reload
 或
/etc/init.d/php-fpm start
/etc/init.d/php-fpm stop
/etc/init.d/php-fpm restart
/etc/init.d/php-fpm reload


添加一個php8.0.0的systemd

vim /lib/systemd/system/php800-fpm.service

內(nèi)容如下

[Unit]
Description=The PHP 8.0.0 FastCGI Process Manager
Documentation=man:php-fpm800(8)
After=network.target

[Service]
Type=simple
PIDFile=/usr/local/php800/var/run/php800-fpm.pid
ExecStart=/usr/local/php800/sbin/php-fpm --nodaemonize --fpm-config /usr/local/php800/etc/php-fpm.conf
ExecReload=/bin/kill -USR2 $MAINPID

[Install]
WantedBy=multi-user.targe

opcache配置

[opcache]
zend_extension=opcache.so
opcache.enable=1 
opcache.jit_buffer_size=100M
opcache.jit=1255

systemctl運(yùn)行php800-fpm服務(wù)器

# 啟動
systemctl start php800-fpm
# 重啟
systemctl restart php800-fpm
# 停止
systemctl stop php800-fpm

laravel

創(chuàng)建一個laravel項目,名稱叫php8

cd /var/www/html
composer8 create-project --prefer-dist laravel/laravel php8

配置一下.env文件

nginx配置

server {
    listen 80;
    server_name bbs.ekanshu.com.cn;
    access_log  /tmp/php8.log main;
    root /var/www/html/php8/public;
    index index.php index.html index.htm;

    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }

    location ~ \.php {
        fastcgi_pass unix:/run/php/php800-fpm.sock;
        fastcgi_index /index.php;

        include fastcgi_params;

        fastcgi_split_path_info       ^(.+\.php)(/.+)$;
        fastcgi_param PATH_INFO       $fastcgi_path_info;
        fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    }
}


添加一個接口

laravel7的路由寫法在laravel8中有點問題,改下 RouteServiceProvider.php的寫法。比如API路由,將 $this->namespace改為 App\Http\Controllers\Api。


public function boot()
{
        $this->configureRateLimiting();

        $this->routes(function () {
            Route::prefix('api')
                ->middleware('api')
                ->namespace('App\Http\Controllers\Api')
                ->group(base_path('routes/api.php'));

            Route::middleware('web')
                ->namespace($this->namespace)
                ->group(base_path('routes/web.php'));
        });
}

其他一樣,不用修改。加個測試接口看看:

Route::get('/test','WxController@test');

test接口查一條數(shù)據(jù)并返回

<?php

namespace App\Http\Controllers\Api;

use App\Models\WareHouses;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Http\Request;
use Illuminate\Routing\Controller as BaseController;

class WxController extends BaseController
{
    use AuthorizesRequests, DispatchesJobs, ValidatesRequests;

    public function test(Request $request)
{
        return WareHouses::find(1)->toarray();
    }
}

對比測試PHP7

本次使用PHP7.3,接口代碼和PHP8一致,兩者都開啟opcache。

服務(wù)器配置是1核2G,用ab簡單測試下。文章來源地址http://www.zghlxwxcb.cn/news/detail-780746.html

先測試php8的ab結(jié)果

ab -n 100 -c 10 http://php8.humengxu.com/api/test
This is ApacheBench, Version 2.3 <$Revision: 1430300 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking php8.humengxu.com (be patient).....done


Server Software:        nginx
Server Hostname:        php8.humengxu.com
Server Port:            80

Document Path:          /api/test
Document Length:        2042 bytes

Concurrency Level:      10
Time taken for tests:   3.098 seconds
Complete requests:      100
Failed requests:        38
   (Connect: 0, Receive: 0, Length: 38, Exceptions: 0)
Write errors:           0
Non-2xx responses:      38
Total transferred:      409699 bytes
HTML transferred:       377214 bytes
Requests per second:    32.28 [#/sec] (mean)
Time per request:       309.770 [ms] (mean)
Time per request:       30.977 [ms] (mean, across all concurrent requests)
Transfer rate:          129.16 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    2   1.3      2       8
Processing:     8  273 351.5     94    1474
Waiting:        8  178 245.2     94    1473
Total:          9  275 351.8     96    1476

Percentage of the requests served within a certain time (ms)
  50%     96
  66%    115
  75%    280
  80%    627
  90%    823
  95%   1014
  98%   1476
  99%   1476
 100%   1476 (longest request)

再測試php7.4的ab結(jié)果

ab -n 100 -c 10 http://php74.humengxu.com/api/test

This is ApacheBench, Version 2.3 <$Revision: 1430300 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking php74.humengxu.com (be patient).....done


Server Software:        nginx
Server Hostname:        php74.humengxu.com
Server Port:            80

Document Path:          /api/test
Document Length:        2042 bytes

Concurrency Level:      10
Time taken for tests:   3.001 seconds
Complete requests:      100
Failed requests:        32
   (Connect: 0, Receive: 0, Length: 32, Exceptions: 0)
Write errors:           0
Non-2xx responses:      32
Total transferred:      379497 bytes
HTML transferred:       349896 bytes
Requests per second:    33.33 [#/sec] (mean)
Time per request:       300.061 [ms] (mean)
Time per request:       30.006 [ms] (mean, across all concurrent requests)
Transfer rate:          123.51 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    2   2.4      3      15
Processing:     9  249 379.7    102    1685
Waiting:        9  154 258.1     94    1487
Total:          9  251 379.7    106    1688

Percentage of the requests served within a certain time (ms)
  50%    106
  66%    122
  75%    213
  80%    219
  90%    685
  95%   1433
  98%   1557
  99%   1688
 100%   1688 (longest request)
 

到了這里,關(guān)于php8.0.0安裝體驗和擴(kuò)展介紹流程的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!

本文來自互聯(lián)網(wǎng)用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務(wù),不擁有所有權(quán),不承擔(dān)相關(guān)法律責(zé)任。如若轉(zhuǎn)載,請注明出處: 如若內(nèi)容造成侵權(quán)/違法違規(guī)/事實不符,請點擊違法舉報進(jìn)行投訴反饋,一經(jīng)查實,立即刪除!

領(lǐng)支付寶紅包贊助服務(wù)器費(fèi)用

相關(guān)文章

  • PHP開發(fā)日志 ━━ php8.3安裝與使用組件Xdebug

    PHP開發(fā)日志 ━━ php8.3安裝與使用組件Xdebug

    今天開頭寫點歷史: 二十年前流行asp,當(dāng)時用vb整合常用函數(shù)庫寫了一個dll給asp調(diào)用,并在此基礎(chǔ)上開發(fā)一套仿windows界面的后臺管理系統(tǒng); 后來asp逐漸沒落,于是在十多年前轉(zhuǎn)投php,不久后用php寫了一套mvc框架,同時參考asp仿windows經(jīng)驗,結(jié)合興起的jQuery重寫后臺管理系統(tǒng)。

    2024年02月02日
    瀏覽(34)
  • windows下全免費(fèi)手動搭建php8+mysql8開發(fā)環(huán)境及可視化工具安裝

    windows下全免費(fèi)手動搭建php8+mysql8開發(fā)環(huán)境及可視化工具安裝

    最近PHP項目少了,一直在研究UE5和Golang,但是考慮到政府、國企未來幾年國產(chǎn)化的要求,可能又要重拾PHP。于是近日把用了N年的框架重新更新至適合PHP8.2以上的版本,同時也乘著新裝機(jī),再次搭建php和mysql開發(fā)環(huán)境。本文留個記錄,以后方便操作。 選擇最新版下載 https://ww

    2024年01月20日
    瀏覽(42)
  • Mac 安裝php多版本,brew安裝php8.0

    Mac 安裝php多版本,brew安裝php8.0

    ?因為需要我要在mac上裝兩個php版本,先前我已經(jīng)裝過php7.4,下面我們逐步安裝php8.0 直接運(yùn)行安裝? brew install php@8.0 遇到問題懷疑是倉庫太老了,更新一下homebrew ,重新安裝 brew update 安裝成功了,不過看了下版本好像不能正常打印版本了 ?報錯相關(guān)文檔,查詢了下好像是icu4c 這個

    2024年02月10日
    瀏覽(39)
  • Docker dnmp 多版本php安裝 php8.2

    Docker dnmp 多版本php安裝 php8.2

    Laravel9 開發(fā)需要用到php8.1以上的版本,而dnmp只支持到php8.0。安裝php8.2的步驟如下: 1. 從/services/php80目錄復(fù)制一份出來,重命名為php82,extensions目錄只保留? install.sh ?和? install-php-extensions ?這兩個文件 2. 修改.env文件,添加php82的配置參數(shù): 3.?docker-compose.yml 文件 新增 php82

    2024年02月06日
    瀏覽(19)
  • ubuntu安裝php8.1

    ubuntu安裝php8.1

    PHP8是PHP最新的Release版本,在這個版本也加入了很多新的功能。 但是在Ubuntu的默認(rèn)apt庫里,找不到PHP8,因此需要稍微做一些額外操作才能安裝。 這個庫來自于Ond?ej Sury,他維護(hù)了一個包含了PHP最新版的庫。 安裝完成后,輸入php --version 可以看到版本信息 extension 可以替換任

    2024年02月03日
    瀏覽(22)
  • php8.2 編譯安裝(詳細(xì))+ bash腳本 (多l(xiāng)inux版本)

    php8.2 編譯安裝(詳細(xì))+ bash腳本 (多l(xiāng)inux版本)

    編譯安裝php8.2.10(2023.9.17更新) 以下操作在debian12(deb系-debianubuntu)和rocky9.2(red hat系-centosrocky linuxoracle linux)都測試過 僅限linux系統(tǒng) 在全文的最后,我寫了bash腳本(只支持deb系),可以參考,直接運(yùn)行bash腳本一鍵編譯安裝 1.下載并解壓源碼包 php官方下載頁面 在/usr/l

    2024年02月06日
    瀏覽(43)
  • PHP8的數(shù)據(jù)類型-PHP8知識詳解

    PHP8的數(shù)據(jù)類型-PHP8知識詳解

    在PHP8中,變量不需要事先聲明,賦值即聲明。 不同的數(shù)據(jù)類型其實就是所儲存數(shù)據(jù)的不同種類。在PHP8.0、8.1中都有所增加。以下是PHP8的15種數(shù)據(jù)類型: 1、字符串(String):用于存儲文本數(shù)據(jù),可以使用單引號或雙引號來定義字符串。 2、整數(shù)(Integer):用于存儲整數(shù)值,可

    2024年02月14日
    瀏覽(24)
  • PHP8條件控制語句-PHP8知識詳解

    PHP8條件控制語句-PHP8知識詳解

    我們昨天說了流程控制的結(jié)構(gòu)有順序結(jié)構(gòu)、選擇結(jié)構(gòu)和循環(huán)結(jié)構(gòu)。選擇結(jié)構(gòu)就是條件結(jié)構(gòu)。 條件控制語句就是對語句中不同條件的值進(jìn)行判斷,進(jìn)而根據(jù)不同的條件執(zhí)行不同的語句。 在本文中,學(xué)習(xí)的是if語句、if…else語句、if…elseif語句和switch語句。 1、if語句 if語句是最為

    2024年02月14日
    瀏覽(30)
  • Centos7.9服務(wù)器編譯安裝Nginx1.24.0和php8.3

    Centos7.9服務(wù)器編譯安裝Nginx1.24.0和php8.3

    服務(wù)器nginx原版本有安全漏洞,需要升級,由于原始是yum源安裝,通過yum直接升級,無法正常升級完成,故而需要卸載yum源,重新編譯安裝。 1、查看原來nginx版本,ps查看原來nginx進(jìn)程,運(yùn)行狀態(tài): 查看nginx版本號為1.20:

    2024年02月20日
    瀏覽(27)
  • PHP8中自定義函數(shù)-PHP8知識詳解

    PHP8中自定義函數(shù)-PHP8知識詳解

    1、什么是函數(shù)? 函數(shù),在英文中的單詞是function,這個詞語有功能的意思,也就是說,使用函數(shù)就是在編程的過程中,實現(xiàn)一定的功能。即函數(shù)就是實現(xiàn)一定功能的一段特定代碼。 在前面的教學(xué)中,我們已經(jīng)學(xué)習(xí)到了函數(shù)的使用了,比如,使用define()函數(shù)定義一個常量。在這

    2024年02月11日
    瀏覽(25)

覺得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請作者喝杯咖啡吧~博客贊助

支付寶掃一掃領(lǐng)取紅包,優(yōu)惠每天領(lǐng)

二維碼1

領(lǐng)取紅包

二維碼2

領(lǐng)紅包