ubuntu20/mac 安装php8.0

下载php8源码并编译安装

wget https://www.php.net/distributions/php-8.0.0.tar.gz

tar xvf php-8.0.0.tar.gz

cd php-8.0.0

./configure --help

apt install pkg-config
apt install libxml2
apt install libxml2-dev
apt install libsqlite3-dev

sudo mkdir /usr/local/php

./configure --prefix=/usr/local/php/ --enable-debug --enable-fpm --with-config-file-path=/usr/local/php/etc/ --with-config-file-scandir=/usr/local/php/etc/php.d/

make

sudo make install

mac编译php8

根据提示安装了下libiconv
brew install libiconv
修改安装命令,加上下面代码
--with-iconv=/usr/local/opt/libiconv/

mac xdebug编译(扩展安装的默认目录/usr/local/php/lib/php/extensions)

wget https://xdebug.org/files/xdebug-3.0.0.tgz
cd xdebug-3.0.0/xdebug-3.0.0
phpize
./configure --with-php-config=/usr/local/php/bin/php-config
make
sudo make install

Ubuntu系统中开启HugePages, 然后开启Opcache的huge_code_pages.
sudo sysctl vm.nr_hugepages=512
cat /proc/meminfo | grep Huge

php8 Opcache JIT配置 添加如下配置到php.ini
zend_extension=opcache.so
opcache.enable=1
opcache.enable_cli=1
opcache.huge_code_pages=1
opcache.file_cache=/tmp
opcache.jit=1205
opcache.jit_buffer_size=64M

 

 

Ubuntu彻底删除PHP7.x的方法

删除php的相关包及配置
sudo apt autoremove php
删除关联
sudo find /etc -name "*php*" |xargs rm -rf
清除dept列表
sudo apt purge `dpkg -l | grep php| awk '{print $2}' |tr "\n" " "`
检查是否卸载干净(无返回就是卸载完成)
dpkg -l | grep php7

 

参考链接

https://www.laruence.com/2015/12/04/3086.html          //opcache
https://www.laruence.com/2020/06/27/5963.html          //jit
https://www.jb51.net/article/144572.htm

posted @ 2020-11-27 10:36  boybai  阅读(2027)  评论(0编辑  收藏  举报