Ubuntu 22.04 编译安装 PHP 7.4.33 报错:make: *** [Makefile:749: ext/openssl/openssl.lo] Error 1
下载openssl1.1.1 https://openssl-library.org/source/old/1.1.1/index.html
安装低版本OpenSSL
wget https://github.com/openssl/openssl/releases/download/OpenSSL_1_1_1w/openssl-1.1.1w.tar.gz tar zxvf openssl-1.1.1w.tar.gz cd openssl-1.1.1w ./config --prefix=/usr/local/openssl --shared make && make install
编译php时指定openssl路径
--with-openssl=/opt/build
最终编译命令
./configure --prefix=/usr/local/php-7.4 --with-config-file-path=/usr/local/php-7.4/etc --with-openssl=/opt/build --with-zlib-dir --with-freetype --enable-mbstring --enable-soap --enable-calendar --with-curl --with-zlib --enable-gd --disable-rpath --enable-inline-optimization --with-bz2 --with-zlib --enable-sockets --enable-sysvsem --enable-sysvshm --enable-pcntl --enable-mbregex --enable-exif --enable-bcmath --with-mhash --with-zip --with-pdo-mysql --with-mysqli --with-mysql-sock=/var/run/mysqld/mysqld.sock --with-jpeg --with-openssl --with-fpm-user=www --with-fpm-group=www --with-libdir=/lib/x86_64-linux-gnu --enable-ftp --with-kerberos --with-gettext --with-xmlrpc --with-xsl --enable-opcache --enable-intl --with-pear --enable-fpm
编译安装
make install Installing shared extensions: /usr/local/php-7.4/lib/php/extensions/no-debug-non-zts-20190902/ Installing PHP CLI binary: /usr/local/php-7.4/bin/ Installing PHP CLI man page: /usr/local/php-7.4/php/man/man1/ Installing PHP FPM binary: /usr/local/php-7.4/sbin/ Installing PHP FPM defconfig: /usr/local/php-7.4/etc/ Installing PHP FPM man page: /usr/local/php-7.4/php/man/man8/ Installing PHP FPM status page: /usr/local/php-7.4/php/php/fpm/ Installing phpdbg binary: /usr/local/php-7.4/bin/ Installing phpdbg man page: /usr/local/php-7.4/php/man/man1/ Installing PHP CGI binary: /usr/local/php-7.4/bin/ Installing PHP CGI man page: /usr/local/php-7.4/php/man/man1/ Installing build environment: /usr/local/php-7.4/lib/php/build/ Installing header files: /usr/local/php-7.4/include/php/ Installing helper programs: /usr/local/php-7.4/bin/ program: phpize program: php-config Installing man pages: /usr/local/php-7.4/php/man/man1/ page: phpize.1 page: php-config.1 Installing PEAR environment: /usr/local/php-7.4/lib/php/ [PEAR] Archive_Tar - installed: 1.4.14 [PEAR] Console_Getopt - installed: 1.4.3 [PEAR] Structures_Graph- installed: 1.1.1 [PEAR] XML_Util - installed: 1.4.5 warning: pear/PEAR dependency package "pear/Archive_Tar" installed version 1.4.14 is not the recommended version 1.4.4 [PEAR] PEAR - installed: 1.10.13 Wrote PEAR system config file at: /usr/local/php-7.4/etc/pear.conf You may want to add: /usr/local/php-7.4/lib/php to your php.ini include_path /opt/php-7.4.32/build/shtool install -c ext/phar/phar.phar /usr/local/php-7.4/bin/phar.phar ln -s -f phar.phar /usr/local/php-7.4/bin/phar Installing PDO headers: /usr/local/php-7.4/include/php/ext/pdo/
systemctl status php-7.4-fpm.service 启动异常
Dec 30 21:27:57 iZbp167tleyjg1lr7zw9qvZ systemd[1]: Started The PHP 7.4 FastCGI Process Manager. Dec 30 21:27:57 iZbp167tleyjg1lr7zw9qvZ php-fpm[408017]: /usr/local/php-7.4/sbin/php-fpm: error while loading shared libraries: libssl.so.1.1: cannot open shar> Dec 30 21:27:57 iZbp167tleyjg1lr7zw9qvZ systemd[1]: php-7.4-fpm.service: Main process exited, code=exited, status=127/n/a Dec 30 21:27:57 iZbp167tleyjg1lr7zw9qvZ systemd[1]: php-7.4-fpm.service: Failed with result 'exit-code'.
用命令查询需要的链接库
sudo find / -name libssl.so.1.1 /snap/core20/2434/usr/lib/x86_64-linux-gnu/libssl.so.1.1 /snap/core20/1405/usr/lib/x86_64-linux-gnu/libssl.so.1.1 /usr/lib64/libssl.so.1.1 /usr/lib/x86_64-linux-gnu/libssl.so.1.1 /opt/build/lib/libssl.so.1.1 /opt/openssl-1.1.1w/libssl.so.1.1
创建软连接【ln -s 源文件 目标文件】
ln -s /opt/openssl-1.1.1w/libssl.so.1.1 /usr/lib/x86_64-linux-gnu/libssl.so.1.1 ln -s /opt/openssl-1.1.1w/libcrypto.so.1.1 /usr/lib/x86_64-linux-gnu/libcrypto.so.1.1
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 【译】Visual Studio 中新的强大生产力特性
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 【设计模式】告别冗长if-else语句:使用策略模式优化代码结构
2016-12-30 流媒体技术学习笔记之(五)码流、码率、采样率、比特率、帧速率、分辨率、高清视频的概念