PHP 安裝配置

2022-04-10 04:19:14 字數 2497 閱讀 3291

apt install libjpeg-turbo8-dev libmcrypt-dev
./configure  --prefix=/usr/local/php --with-libdir=/lib/x86_64-linux-gnu --with-config-file-path=/usr/local/php/etc --with-mysqli=mysqlnd --with-iconv-dir=/usr/local/libiconv --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --enable-bcmath --enable-inline-optimization --with-curl --with-fpm-user=www --with-fpm-group=www --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-sockets --enable-zip --enable-ftp --without-pear --enable-pdo --with-pdo-mysql=mysqlnd --disable-fileinfo --with-xmlrpc --enable-opcache --enable-fpm
編譯安裝完後,php.ini檔案從原始碼裡複製過去

上面有乙個編譯引數with-config-file-path指定自己的php.ini路徑,原始碼裡面有 php.ini-development 和 php.ini-production 選乙個複製過去

php.ini 建議修改的地方:

[php]

;時區date.timezone = asia/shanghai

;下面這行可以寫上你用不到但又有潛在安全風險的函式,他們將不會被執行。

disable_functions = system,passthru,exec,shell_exec,popen,phpinfo

php-fpm.conf 檔案(樹莓派可用預設):

[global]

pid = /tmp/php-fpm.pid

error_log = /tmp/php-fpm.log

log_level = error

daemonize = no

[mainwebsite]

listen = /tmp/php-fpm.sock

listen.group = www

user = www

group = www

pm = static

pm.max_children = 3

pm.start_servers = 2

pm.min_spare_servers = 1

pm.max_spare_servers = 3

rlimit_files = 51200

/usr/lib/systemd/system/php.socket 檔案

[socket]

listenstream=/tmp/php-fpm.sock

[install]

wantedby=sockets.target

/usr/lib/systemd/system/php.service 檔案

[unit]

description=the php fastcgi process manager

after=syslog.target network.target php.socket

[service]

environment="fpm_sockets=/tmp/php-fpm.sock=3"

execstart=/usr/local/php/sbin/php-fpm -c /home/etc/php.ini -y /home/etc/php-fpm.conf

restartsec=1s

restart=on-failure

[install]

wantedby=multi-user.target

/usr/lib/systemd/system/php.service 檔案

[unit]

description=the php fastcgi process manager

after=syslog.target network.target

[service]

execstart=/usr/local/php/sbin/php-fpm -c /usr/local/php/php.ini -y /usr/local/php/php-fpm.conf -r

restartsec=1s

restart=on-failure

[install]

wantedby=multi-user.target

~

PHP安裝配置

tar zxvf php 5.2.9.tar.gz c software cd software php 5.2.9 make make install 編譯,進行安裝。cp php.ini dist usr local php lib php.ini 在apache2中修改配置檔案 並在後面加入 ...

PHP安裝配置

php的安裝與配置 1 安裝apache伺服器 2 安裝php 2.2 將安裝包下的php.ini dist改為php.ini,版本更新後該檔案改名為了php.ini developer,將該檔案改名為php.ini即可 2.3 開啟安裝包下的install.txt檔案,找到如下內容 for php...

Linux安裝配置php

1.獲取安裝檔案 php 5.3.8.tar.gz 獲取安裝php需要的支援檔案 libxml2 2.6.32.tar.gz 2.安裝libxml2 1 tar zxvf libxml2 2.6.32.tar.gz 2 cd libxml2 2.6.32 3 configure prefix usr...