1. 下载解压PHP7.4
- php源码包下载地址 各版本源码包 https://www.php.net/releases/
- 解压缩 tar -zxvf 命令
tar -zxvf php-7.4.33.tar.gz
2. 安装PHP + FPM
- 进入解压后的 PHP源码 目录 php-7.4.33
cd php-7.4.33
- 执行./configure 指令
./configure --with-config-file-path=/usr/local/etc --with-openssl --with-curl --with-pdo_mysql --with-sqlite3 \
--with-zip --enable-bcmath --enable-ctype --enable-gd -enable-calendar --enable-fileinfo --enable-gd --enable-json --enable-mbstring --enable-pdo \
--enable-filter --enable-session --enable-simplexml --enable-sockets --enable-xml --enable-xmlreader \
--enable-fpm
- 其中可能会不通过 需要安装相应的开发包
apt install libpng-dev libzip-dev libonig-dev libsqlite3-dev libcurl4-gnutls-dev
- 再次执行 第二步操作
- 执行make安装命令
需要在 root 用户环境下执行,完成安装make && make install
- 拷贝 配置文件
cp php-7.4.33/php.ini-development /usr/local/etc/php.ini
- 配置 www.conf
user www-data
group www-data
3. Nginx 1.14配置
server_name xxx.cc;
root /xxx/fastadmin/public;
index index.html index.htm index.php;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass 127.0.0.1:9000;
}