所有操作需要在root用戶下本機測試案例系統信息:ubuntu安裝路徑:/usr/local/php8 解壓縮: wget https://downloads.php.net/~pollita/php-8.0.0alpha1.tar.gz tar -zxvf php-8.0.0alpha1.tar. ...
所有操作需要在root用戶下
本機測試案例系統信息:ubuntu
安裝路徑:/usr/local/php8
解壓縮:
wget https://downloads.php.net/~pollita/php-8.0.0alpha1.tar.gz
tar -zxvf php-8.0.0alpha1.tar.gz
cd php-8.0.0alpha1/
編譯:
./configure --prefix=/usr/local/php8 \ --with-config-file-path=/usr/local/php8 \ --enable-mbstring \ --enable-ftp \ --enable-gd \ --enable-gd-jis-conv \ --enable-mysqlnd \ --enable-pdo \ --enable-sockets \ --enable-fpm \ --enable-xml \ --enable-soap \ --enable-pcntl \ --enable-cli \ --with-openssl \ --with-mysqli=mysqlnd \ --with-pdo-mysql=mysqlnd \ --with-pear \ --with-zlib \ --with-iconv \ --with-curl \
make && make install
有依賴錯誤的,需要搜索解決一下
複製配置文件:
cp php.ini-production /usr/local/php8/php.ini
打開錯誤:
vim /usr/local/php8/php.ini
display_errors = On
複製fpm的啟動腳本:
cp ./sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm8.0
增加執行許可權
chmod +x /etc/init.d/php-fpm8.0
修改php-fpm配置文件:
cd /usr/local/php8/etc
cp php-fpm.conf.default php-fpm.conf
vim php-fpm.conf
去掉 pid = run/php-fpm.pid 前面的分號
修改啟動用戶:
user = www-data
group = www-data
修改監聽埠:
listen = 127.0.0.1:9080
配置nginx:
server { listen 80; server_name test.sopans.com; access_log /var/log/nginx/test.sopans.com.access.log main; root /var/www/html/test; index index.html index.htm index.php; location ~ \.php { fastcgi_pass 127.0.0.1:9080; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; # fastcgi_split_path_info ^(.+\.php)(/.*)$; # fastcgi_param PATH_INFO $fastcgi_path_info; include fastcgi_params; } }
啟動fpm
/etc/init.d/php-fpm8.0 start
訪問: