ubuntu21.04:编译安装php8.4.1
一,官网:
https://www.php.net/
下载地址:
https://www.php.net/downloads.php
二,下载
用wget下载源码:
$ wget https://www.php.net/distributions/php-8.4.1.tar.gz
解压:
$ tar -zxvf php-8.4.1.tar.gz
三,安装
1,configure
$ ./configure --prefix=/usr/local/soft/php8.4.1 --with-config-file-path=/usr/local/soft/php8.4.1/etc --with-curl
--with-freetype --enable-gd --with-jpeg --with-gettext --with-libdir=lib64 --with-libxml --with-mysqli
--with-openssl --with-pdo-mysql --with-pdo-sqlite --with-pear --enable-sockets --with-mhash --with-ldap-sasl
--with-xsl --with-zlib --with-zip -with-bz2 --with-iconv --enable-fpm --enable-pdo --enable-bcmath
--enable-mbregex --enable-mbstring --enable-opcache --enable-pcntl --enable-shmop --enable-soap --enable-ftp
--with-xpm --enable-xml --enable-sysvsem --enable-cli --enable-intl --enable-calendar --enable-static
--enable-ctype --enable-mysqlnd --enable-session
2,编译安装:
四,报错和解决:
1,报错:
configure: error: in '/usr/local/source/php/php-8.4.1':
configure: error: The pkg-config script could not be found or is too old. Make sure it
is in your PATH or set the PKG_CONFIG environment variable to the full
path to pkg-config.
解决:
$ apt-get install pkg-config
2,报错:
configure: error: Package requirements (libxml-2.0 >= 2.9.4) were not met:
No package 'libxml-2.0' found
解决:
# apt-get install libxml2-dev
3,报错:
configure: error: Package requirements (openssl >= 1.1.1) were not met:
No package 'openssl' found
解决:
# apt-get install libssl-dev
4,报错:
configure: error: Package requirements (sqlite3 >= 3.7.7) were not met:
No package 'sqlite3' found
解决:
# apt-get install libsqlite3-dev
5,报错:
checking for BZip2... bzlib.h not found
configure: error: Please reinstall the BZip2 library package
解决:
# apt-get install libbz2-dev
6,报错:
configure: error: Package requirements (libcurl >= 7.61.0) were not met:
No package 'libcurl' found
解决:
# apt-get install libcurl4-openssl-dev
7,报错:
configure: error: Package requirements (libpng) were not met:
No package 'libpng' found
解决:
# apt-get install libpng-dev
8,报错:
configure: error: Package requirements (libjpeg) were not met:
No package 'libjpeg' found
解决:
# apt-get install libjpeg-dev
9,报错:
configure: error: Package requirements (xpm) were not met:
No package 'xpm' found
解决:
# apt-get install libxpm-dev
10,报错:
configure: error: Package requirements (freetype2) were not met:
No package 'freetype2' found
解决:
# apt-get install libfreetype-dev
11,报错:
configure: error: Package requirements (oniguruma) were not met:
No package 'oniguruma' found
解决:
# apt install libonig-dev
12,报错:
configure: error: Package requirements (libxslt >= 1.1.0) were not met:
No package 'libxslt' found
解决:
# apt install libxslt-dev
13,报错:
configure: error: Package requirements (libzip >= 0.11 libzip != 1.3.1 libzip != 1.7.0) were not met:
No package 'libzip' found
No package 'libzip' found
No package 'libzip' found
解决:
apt install libzip-dev
五,生成配置文件
1,php.ini
/usr/local/source/php/php-8.4.1$ cp php.ini-production /usr/local/soft/php8.4.1/etc/php.ini
2,www.conf
/usr/local/soft/php8.4.1/etc/php-fpm.d$ cp -axv www.conf.default www.conf
'www.conf.default' -> 'www.conf'
3,php-fpm.conf
/usr/local/soft/php8.4.1/etc$ cp -axv php-fpm.conf.default php-fpm.conf
'php-fpm.conf.default' -> 'php-fpm.conf'
六,测试效果
$ /usr/local/soft/php8.4.1/bin/php --version
PHP 8.4.1 (cli) (built: Dec 17 2024 11:04:21) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.4.1, Copyright (c) Zend Technologies
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 25岁的心里话
· 闲置电脑爆改个人服务器(超详细) #公网映射 #Vmware虚拟网络编辑器
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· 零经验选手,Compose 一天开发一款小游戏!
· 通过 API 将Deepseek响应流式内容输出到前端
2021-12-21 linux(kubuntu 21.10): 配置五笔输入法
2021-12-21 linux(ubuntu 21.10):安装chrome
2021-12-21 linux(ubuntu 21.10): 安装phpmyadmin5.1.1 (php8.1.1)
2021-12-21 linux(ubuntu 21.10): apt-get安装mysql8.0.27
2021-12-21 ubuntu21.10:编译安装php8.1.1
2020-12-21 macos(big sur/11.1):安装python3(python 3.9.1)