跳轉到內容
View in the app

A better way to browse. Learn more.

PHP論壇人

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

安裝PHP 8.3 與配置PHP、安裝redis、安裝exif、安裝imagick

精選回覆

發表於

安裝PHP 8.3 與配置PHP、安裝redis、安裝exif、安裝imagick

-----------------------------
安裝sury.org的PHP源
-----------------------------

apt install wget

wget -O /usr/share/keyrings/php.gpg https://packages.sury.org/php/apt.gpg


echo "deb [signed-by=/usr/share/keyrings/php.gpg] https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list


更新源
apt update


apt upgrade -y


apt dist-upgrade -y


apt install curl vim wget gnupg dpkg apt-transport-https lsb-release ca-certificates


apt install php-pear


瀏覽pear版本
pear version



apt install php8.3-{fpm,cli,mysql,curl,gd,mbstring,xml,zip,imap,soap,gmp,bcmath,redis} -y





如果要安裝其他元件,可以搜尋看看有無對應的套件
apt-cache search php8.3* | grep php




修改 php.ini 防止跨目录攻击
sed -i 's/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/' /etc/php/8.3/fpm/php.ini




設置系統預設的PHP版本
update-alternatives --list php


update-alternatives --set php /usr/bin/php8.3


update-alternatives --config php


重啟PHP
systemctl restart php8.3-fpm

---------------------------------------

安裝redis、安裝exif、安裝imagick

---------------------------------------

apt install redis -y

apt install php-redis -y

apt install exif -y

apt install imagemagick -y

ldconfig /usr/local/lib

apt install php8.3-imagick -y

重啟PHP

systemctl restart php8.3-fpm

已安裝的PHP擴展,確定已安裝了 exif、gmp、imagick、redis

/bin/php8.3 -m

------------------
修改php.ini
------------------

vi /etc/php/8.3/fpm/php.ini


使用Xshell 8軟體上面的選項,編輯 -> 尋找 -> 尋找目標,將能快速找到以下這些要修改的地方

停用危險函數
搜尋 
disable_functions =

修改为
disable_functions = passthru,exec,system,chroot,chgrp,chown,shell_exec,proc_open,proc_get_status,popen,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server,pcntl_exec



搜尋以下這些,並修改它們的值

max_execution_time = 300

max_input_time = 180

memory_limit = 512M




顯示PHP程式錯誤,正式運作的論壇通常是 Off 關閉狀態
display_errors = Off


post_max_size = 100M

upload_max_filesize = 100M

max_file_uploads = 100

default_socket_timeout = 180



ESC儲存並離開
:wq




重啟PHP
systemctl restart php8.3-fpm




瀏覽PHP的版本,確定你是安裝PHP 8.3
php -v



開機啟動PHP8.3
systemctl enable php8.3-fpm


啟動PHP8.3
systemctl start php8.3-fpm


瀏覽狀態
systemctl status php8.3-fpm



重開機
reboot



瀏覽狀態,確認重開機後,PHP有自動啟動
systemctl status php8.3-fpm


按 ctrl + z 停止

本文章最後於,由Jack編輯

建立帳號或登入後發表意見

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.