1fy07h 发表于 2024-10-4 13:24:59

PHP8.0环境仔细安装教程


    <h1 style="color: black; text-align: left; margin-bottom: 10px;"><span style="color: black;">1、</span>PHP环境安装流程</h1>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">  说明:<span style="color: black;">近期</span>在搭建个人网站,环境有用到PHP,特此记录。本文安装案例是以PHP8.0.0版本为示例,</span><strong style="color: blue;"><span style="color: black;">「<span style="color: black;">起始</span>安装前<span style="color: black;">意见</span>先将第三<span style="color: black;">过程</span>抛出<span style="color: black;">反常</span>的依赖安装,<span style="color: black;">这般</span>安装的时候就无需逐个<span style="color: black;">处理</span>问题。」</span></strong></span></p>
    <h1 style="color: black; text-align: left; margin-bottom: 10px;">1、下载PHP包(在线<span style="color: black;">或</span>压缩包方式都可)</h1>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;"><span style="color: black;">意见</span>:提前创建好压缩包<span style="color: black;">位置</span>,方便后续对文件管理,下载地址:https://www.php.net/downloads.php</span></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">  在线下载(<span style="color: black;">倘若</span>网速很慢,则离线下载上传到服务器):wget https://www.php.net/distributions/php-8.0.0.tar.gz</span></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">  离线下载后可<span style="color: black;">经过</span>rz命令上传到服务器:rz -be 文件名</span></span></p>
    <div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/tos-cn-i-axegupay5k/ad6698343aef4e868e5719841c721ffe~noop.image?_iz=58558&amp;from=article.pc_detail&amp;lk3s=953192f4&amp;x-expires=1728208645&amp;x-signature=2dwMCRpF1W0KtrdKP8Ez5d5LDCE%3D" style="width: 50%; margin-bottom: 20px;"></div>
    <h1 style="color: black; text-align: left; margin-bottom: 10px;">2、解压压缩包</h1>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">  执行代码:tar -xvf php-8.0.0.tar.gz</span></span></p>
    <div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/tos-cn-i-qvj2lq49k0/e8aa5001d7564d018ce18a3f727170cd~noop.image?_iz=58558&amp;from=article.pc_detail&amp;lk3s=953192f4&amp;x-expires=1728208645&amp;x-signature=k%2BWHcbHNO4xPEbAqt%2BXFz4X9B5k%3D" style="width: 50%; margin-bottom: 20px;"></div>
    <h1 style="color: black; text-align: left; margin-bottom: 10px;">3、指定配置信息</h1>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">  说明:在执行编译之前,需要配置此次编译和安装后的文件的存放位置以及安装的<span style="color: black;">有些</span>组件,</span><strong style="color: blue;"><span style="color: black;">「在安装前务必要清楚,<span style="color: black;">倘若</span>不<span style="color: black;">认识</span>,<span style="color: black;">意见</span>直接<span style="color: black;">运用</span>本文的代码,防止<span style="color: black;">显现</span><span style="color: black;">反常</span>问题。」</span></strong></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">  <span style="color: black;">认识</span>概念:</span></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">1、源码安装需要经历<span style="color: black;">过程</span>:配置(configure)、编译(make)、安装( make install )。</span></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">  2、Configure则是一个可执行文件,<span style="color: black;">能够</span>配置<span style="color: black;">非常多</span>选项(<span style="color: black;">能够</span>理解为<span style="color: black;">咱们</span>在Windows安装时的图像化界面的功能),<span style="color: black;">能够</span><span style="color: black;">经过</span>./configure --help来查看选项<span style="color: black;">详细</span>含义。</span></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">其中--prefix选项<span style="color: black;">功效</span>是配置源码安装的路径,--with-config-file-path选项<span style="color: black;">功效</span>是设置php配置文件(php.ini)的存放位置,<span style="color: black;">通常</span><span style="color: black;">来讲</span>安装的时候只需要指定这两个路径<span style="color: black;">就可</span>,其他的则<span style="color: black;">指的是</span>定php支持哪<span style="color: black;">有些</span>组件了。</span></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">3、延伸说明下指定存放路径的好处,其实<span style="color: black;">能够</span>类比在Windows等图形化系统的安装软件<span style="color: black;">过程</span>,安装时指定软件的位置,方便后续对软件进行统一管理(删除,<span style="color: black;">查询</span>等)。</span></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">  4、<span style="color: black;">重视</span>:下面的代码必须<span style="color: black;">处在</span>同一行上,<span style="color: black;">意见</span>先复制到文本上查看<span style="color: black;">是不是</span>在同一行,<span style="color: black;">而后</span>再复制到服务器中执行(否则会<span style="color: black;">显现</span><span style="color: black;">非常多</span>莫名其妙的问题,相信你<span style="color: black;">亦</span>不想花上几天时间去处理)。</span></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">至于其他参数选项的含义,<span style="color: black;">能够</span>打官方<span style="color: black;">或</span><span style="color: black;">运用</span>./configure --help来查看选项<span style="color: black;">详细</span>含义,<span style="color: black;">意见</span>添加自己需要的组件<span style="color: black;">就可</span>,<span style="color: black;">倘若</span>不清楚,进入到解压的文件后直接执行下面的代码。</span></span></p>./configure --prefix=/usr/<span style="color: black;">local</span>/install/php8 --with-config-file-path=/usr/<span style="color: black;">local</span>/install/php8/etc --with-curl --with-freetype --<span style="color: black;">enable</span>-gd --with-jpeg --with-gettext --with-kerberos --with-libdir=lib64 --with-libxml --with-mysqli --with-openssl --with-pdo-mysql --with-pdo-sqlite --with-pear --<span style="color: black;">enable</span>-sockets --with-mhash --with-ldap-sasl --with-xsl --with-zlib --with-zip -with-bz2 --with-iconv --<span style="color: black;">enable</span>-fpm --<span style="color: black;">enable</span>-pdo --<span style="color: black;">enable</span>-bcmath --<span style="color: black;">enable</span>-mbregex --<span style="color: black;">enable</span>-mbstring --<span style="color: black;">enable</span>-opcache --<span style="color: black;">enable</span>-pcntl --<span style="color: black;">enable</span>-shmop --<span style="color: black;">enable</span>-soap --<span style="color: black;">enable</span>-sockets --<span style="color: black;">enable</span>-sysvsem --<span style="color: black;">enable</span>-xml --<span style="color: black;">enable</span>-sysvsem --<span style="color: black;">enable</span>-cli --<span style="color: black;">enable</span>-opcache --<span style="color: black;">enable</span>-intl --<span style="color: black;">enable</span>-calendar --<span style="color: black;">enable</span>-static --<span style="color: black;">enable</span>-mysqlnd
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">  5、配置成功后会<span style="color: black;">显现</span>下面提示:</span></span></p>
    <div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/tos-cn-i-qvj2lq49k0/50fe64678ee74868958630ab4be44bcf~noop.image?_iz=58558&amp;from=article.pc_detail&amp;lk3s=953192f4&amp;x-expires=1728208645&amp;x-signature=yXXNH9vm1R9iN28eP0%2FvRHCcUjk%3D" style="width: 50%; margin-bottom: 20px;"></div>
    <h1 style="color: black; text-align: left; margin-bottom: 10px;">4、编译中可能<span style="color: black;">显现</span>的<span style="color: black;">反常</span>和<span style="color: black;">处理</span><span style="color: black;">方法</span></h1>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">  说明,新服务器在执行configure脚本设置配置之前,需要存在的<span style="color: black;">关联</span>依赖脚本整合,下面会对每一个<span style="color: black;">反常</span>问题做<span style="color: black;">详细</span>说明:</span></span></p><span style="color: black;">yum</span> <span style="color: black;">install dnf</span>
    <span style="color: black;">dnf</span> <span style="color: black;">install libxml2-devel</span>
    <span style="color: black;">dnf</span> <span style="color: black;">install sqlite-devel</span>
    <span style="color: black;">dnf</span> <span style="color: black;">-y install bzip2-devel</span>
    <span style="color: black;">dnf</span> <span style="color: black;">-y install libcurl-devel</span>
    <span style="color: black;">dnf</span> <span style="color: black;">-y install libpng-devel</span>
    <span style="color: black;">dnf</span> <span style="color: black;">-y install libjpeg-devel</span>
    <span style="color: black;">dnf</span> <span style="color: black;">-y install freetype-devel</span>
    <span style="color: black;">dnf</span> <span style="color: black;">-y install libicu-devel</span>
    <span style="color: black;">yum</span> <span style="color: black;">install oniguruma-devel -y</span>
    <span style="color: black;">dnf</span> <span style="color: black;">-y install libxslt-devel</span>
    <span style="color: black;">dnf</span> <span style="color: black;">-y install libzip-devel</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">  1、<span style="color: black;">反常</span>信息:</span></span></p>
    <div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/tos-cn-i-qvj2lq49k0/62b1040568624eebba24fa5d6dab3c13~noop.image?_iz=58558&amp;from=article.pc_detail&amp;lk3s=953192f4&amp;x-expires=1728208645&amp;x-signature=AJ2vdfA%2F6zZj2sV5sd91A3F9PVo%3D" style="width: 50%; margin-bottom: 20px;"></div><span style="color: black;">configure: error:</span> <span style="color: black;">Package</span> <span style="color: black;">requirements</span> <span style="color: black;">(libxml-2.0</span> <span style="color: black;">&gt;=</span> <span style="color: black;">2.9</span><span style="color: black;">.0</span><span style="color: black;">)</span> <span style="color: black;">were not met:</span>
    <span style="color: black;">No</span> <span style="color: black;">package</span> <span style="color: black;">libxml-2.0</span> <span style="color: black;">found</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">  <span style="color: black;">处理</span><span style="color: black;">方法</span>:dnf install libxml2-devel</span></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">  2、<span style="color: black;">反常</span>信息:</span></span></p>
    <div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/tos-cn-i-qvj2lq49k0/71b384924591460085910fea98ee59d3~noop.image?_iz=58558&amp;from=article.pc_detail&amp;lk3s=953192f4&amp;x-expires=1728208645&amp;x-signature=1wTH7xNRKMEgbMNyp56j9Te1LFM%3D" style="width: 50%; margin-bottom: 20px;"></div><span style="color: black;">-bash</span>: <span style="color: black;">dnf</span>: command not found
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">  <span style="color: black;">处理</span><span style="color: black;">方法</span>:yum install dnf</span></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">  3、<span style="color: black;">反常</span>信息:</span></span></p>
    <div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/tos-cn-i-qvj2lq49k0/a0914bca62874366ac6bbb1cb518a69d~noop.image?_iz=58558&amp;from=article.pc_detail&amp;lk3s=953192f4&amp;x-expires=1728208645&amp;x-signature=uJBhkjfnV%2FCB5CoBVzfauwdFBMk%3D" style="width: 50%; margin-bottom: 20px;"></div><span style="color: black;">configure: error:</span> <span style="color: black;">Package</span> <span style="color: black;">requirements</span> <span style="color: black;">(sqlite3</span> <span style="color: black;">&gt;</span> <span style="color: black;">3.7</span><span style="color: black;">.4</span><span style="color: black;">)</span> <span style="color: black;">were not met:</span>
    <span style="color: black;">No</span> <span style="color: black;">package</span> <span style="color: black;">sqlite3</span> <span style="color: black;">found</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">  <span style="color: black;">处理</span><span style="color: black;">方法</span>:dnf install sqlite-devel</span></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">  4、<span style="color: black;">反常</span>信息:</span></span></p>
    <div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/tos-cn-i-qvj2lq49k0/c9ce99a1fa494c8db3b46368f7d6a4e6~noop.image?_iz=58558&amp;from=article.pc_detail&amp;lk3s=953192f4&amp;x-expires=1728208645&amp;x-signature=eCXj8MBwguaW2aH5vBKGpENzNQc%3D" style="width: 50%; margin-bottom: 20px;"></div>checking <span style="color: black;">for</span> BZip2 <span style="color: black;">in</span> default <span style="color: black;">path</span>... <span style="color: black;">not</span> found
    configure: <span style="color: black;">error</span>: Please reinstall the BZip2 distribution<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">  <span style="color: black;">处理</span><span style="color: black;">方法</span>:dnf -y install bzip2-devel</span></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">  5、<span style="color: black;">反常</span>信息:</span></span></p>
    <div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/tos-cn-i-qvj2lq49k0/6c65c36429d04a5abca6749bb8b3253b~noop.image?_iz=58558&amp;from=article.pc_detail&amp;lk3s=953192f4&amp;x-expires=1728208645&amp;x-signature=IwTRvJpEKjrehoDSo5FGXh1sgEo%3D" style="width: 50%; margin-bottom: 20px;"></div><span style="color: black;">configure: error:</span> <span style="color: black;">Package</span> <span style="color: black;">requirements</span> <span style="color: black;">(libcurl</span> <span style="color: black;">&gt;=</span> <span style="color: black;">7.29</span><span style="color: black;">.0</span><span style="color: black;">)</span> <span style="color: black;">were not met:</span>
    <span style="color: black;">No</span> <span style="color: black;">package</span> <span style="color: black;">libcurl</span> <span style="color: black;">found</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">  <span style="color: black;">处理</span><span style="color: black;">方法</span>:dnf -y install libcurl-devel</span></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">  6、<span style="color: black;">反常</span>信息:</span></span></p>
    <div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/tos-cn-i-qvj2lq49k0/ab75b49f023143638a8af39742b561ab~noop.image?_iz=58558&amp;from=article.pc_detail&amp;lk3s=953192f4&amp;x-expires=1728208645&amp;x-signature=Z3jJD3Qt0m0%2BMiiWk6OzQoLPSzA%3D" style="width: 50%; margin-bottom: 20px;"></div><span style="color: black;">configure</span>: <span style="color: black;">error</span>: Package requirements (libpng) were not <span style="color: black;">met</span>:
    No package <span style="color: black;">libpng</span> found
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;"><span style="color: black;">处理</span><span style="color: black;">方法</span>:dnf -y install libpng-devel</span></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">  7、<span style="color: black;">反常</span>信息:</span></span></p><span style="color: black;">configure</span>: <span style="color: black;">error</span>: Package requirements (libjpeg) were not <span style="color: black;">met</span>:
    Package <span style="color: black;">libjpeg</span>, required by <span style="color: black;">virtual:world</span>, not found
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;"><span style="color: black;">处理</span><span style="color: black;">方法</span>:dnf -y install libjpeg-devel</span></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">  8、<span style="color: black;">反常</span>信息:</span></span></p><span style="color: black;">configure</span>: <span style="color: black;">error</span>: Package requirements (freetype2) were not <span style="color: black;">met</span>:
    Package <span style="color: black;">freetype2</span>, required by <span style="color: black;">virtual:world</span>, not found
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;"><span style="color: black;">处理</span>方案:dnf -y install freetype-devel</span></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">  9、<span style="color: black;">反常</span>信息:</span></span></p>
    <div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/tos-cn-i-qvj2lq49k0/e39de265b2524b6d900a2ac83d251a70~noop.image?_iz=58558&amp;from=article.pc_detail&amp;lk3s=953192f4&amp;x-expires=1728208645&amp;x-signature=0yFIbYpCvmavQBjYS9pTocrZ6Lo%3D" style="width: 50%; margin-bottom: 20px;"></div>configure: error: Package requirements (icu-uc &gt;= <span style="color: black;">50.1</span> icu-io icu-i18n) were <span style="color: black;">not</span> met:
    Package <span style="color: black;">icu-uc</span>, required <span style="color: black;">by</span> <span style="color: black;">virtual:world</span>, <span style="color: black;">not</span> found
    Package <span style="color: black;">icu-io</span>, required <span style="color: black;">by</span> <span style="color: black;">virtual:world</span>, <span style="color: black;">not</span> found
    Package <span style="color: black;">icu-i18n</span>, required <span style="color: black;">by</span> <span style="color: black;">virtual:world</span>, <span style="color: black;">not</span> found
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;"><span style="color: black;">处理</span><span style="color: black;">方法</span>:dnf -y install libicu-devel</span></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">  <span style="color: black;">十、</span><span style="color: black;">反常</span>信息:</span></span></p><span style="color: black;">configure</span>: <span style="color: black;">error</span>: Package requirements (oniguruma) were not <span style="color: black;">met</span>:
    No package <span style="color: black;">oniguruma</span> found
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">  <span style="color: black;">处理</span><span style="color: black;">方法</span>:yum install oniguruma-devel -y</span></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">11、<span style="color: black;">反常</span>信息:</span></span></p><span style="color: black;">configure: error:</span> <span style="color: black;">Package</span> <span style="color: black;">requirements</span> <span style="color: black;">(libxslt</span> <span style="color: black;">&gt;=</span> <span style="color: black;">1.1</span><span style="color: black;">.0</span><span style="color: black;">)</span> <span style="color: black;">were not met:</span>
    <span style="color: black;">No</span> <span style="color: black;">package</span> <span style="color: black;">libxslt</span> <span style="color: black;">found</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">  <span style="color: black;">处理</span><span style="color: black;">方法</span>:dnf -y install libxslt-devel</span></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">  12、<span style="color: black;">反常</span>信息:</span></span></p><span style="color: black;">configure: error:</span> <span style="color: black;">Package</span> <span style="color: black;">requirements</span> <span style="color: black;">(libzip</span> <span style="color: black;">&gt;=</span> <span style="color: black;">0.11</span> <span style="color: black;">libzip</span> <span style="color: black;">!=</span> <span style="color: black;">1.3</span><span style="color: black;">.1</span> <span style="color: black;">libzip</span> <span style="color: black;">!=</span> <span style="color: black;">1.7</span><span style="color: black;">.0</span><span style="color: black;">)</span> <span style="color: black;">were not met:</span>
    <span style="color: black;">Package</span> <span style="color: black;">libzip</span><span style="color: black;">,</span> <span style="color: black;">required</span> <span style="color: black;">by</span> <span style="color: black;">virtual:world</span><span style="color: black;">,</span> <span style="color: black;">not</span> <span style="color: black;">found</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">  <span style="color: black;">处理</span><span style="color: black;">方法</span>:dnf -y install libzip-devel</span></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">13、<span style="color: black;">反常</span>信息:</span></span></p><span style="color: black;">configure: error:</span> <span style="color: black;">Package</span> <span style="color: black;">requirements</span> <span style="color: black;">(libzip</span> <span style="color: black;">&gt;=</span> <span style="color: black;">0.11</span> <span style="color: black;">libzip</span> <span style="color: black;">!=</span> <span style="color: black;">1.3</span><span style="color: black;">.1</span> <span style="color: black;">libzip</span> <span style="color: black;">!=</span> <span style="color: black;">1.7</span><span style="color: black;">.0</span><span style="color: black;">)</span> <span style="color: black;">were not met:</span>
    <span style="color: black;">Requested</span> <span style="color: black;">libzip &gt;= 0.11</span> <span style="color: black;">but</span> <span style="color: black;">version</span> <span style="color: black;">of</span> <span style="color: black;">libzip</span> <span style="color: black;">is</span> <span style="color: black;">0.10</span><span style="color: black;">.1</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">  <span style="color: black;">处理</span><span style="color: black;">方法</span>:</span></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">1、先删除原来的安装:yum remove libzip-devel libzip</span></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">  2、在线下载对应的版本:wget https://libzip.org/download/libzip-1.3.2.tar.gz --no-check-certificate</span></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">4、进入解压后的文件夹,执行配置脚本:./confugure</span></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">  5、编译并安装:make &amp; make install</span></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">6、安装完成后,<span style="color: black;">查找</span>/usr/local/lib目录下<span style="color: black;">是不是</span>有p<span style="color: black;">公斤</span>config目录,有的话执行命令export PKG_CONFIG_PATH="/usr/local/lib/p<span style="color: black;">公斤</span>config/"指定PKG_CONFIG_PATH,<span style="color: black;">而后</span>重新执行切换php解压之后的文件夹,执行./configure脚本<span style="color: black;">就可</span></span></span></p>
    <h1 style="color: black; text-align: left; margin-bottom: 10px;">5、编译和安装</h1>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">配置完成后,执行make指令对源代码进行编译,执行make install指令对源代码进行安装,<span style="color: black;">亦</span><span style="color: black;">能够</span><span style="color: black;">同期</span>执行这两个指令,<span style="color: black;">详细</span>如下(<span style="color: black;">重视</span>:编译和安装都是在解压后的php文件夹下执行-即存在configure脚本的目录):</span></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;"> 1、编译:make</span></span></p>
    <div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p26-sign.toutiaoimg.com/tos-cn-i-qvj2lq49k0/34865578e091422b8eac56bdedaebdcb~noop.image?_iz=58558&amp;from=article.pc_detail&amp;lk3s=953192f4&amp;x-expires=1728208645&amp;x-signature=iDDeAh2YzBNSVygzEZLj4LTcRns%3D" style="width: 50%; margin-bottom: 20px;"></div>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">​ 2、安装:make install</span></span></p>
    <div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/tos-cn-i-qvj2lq49k0/33c08267d9b348e7a2feeb3d195059a1~noop.image?_iz=58558&amp;from=article.pc_detail&amp;lk3s=953192f4&amp;x-expires=1728208645&amp;x-signature=RBnDFXwc%2BtX9jANcrkjem3jVWlc%3D" style="width: 50%; margin-bottom: 20px;"></div>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">  3、<span style="color: black;">显现</span><span style="color: black;">反常</span>:cc: internal compiler error: Killed (program cc1)</span></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">  <span style="color: black;">原由</span>:大概率是<span style="color: black;">由于</span>内存<span style="color: black;">不足</span><span style="color: black;">运用</span>,<span style="color: black;">能够</span>先<span style="color: black;">运用</span>交换分区来<span style="color: black;">处理</span>,编译安装后再删除掉<span style="color: black;">就可</span>。</span></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">  <span style="color: black;">处理</span>:</span></span></p><span style="color: black;">sudo</span> <span style="color: black;">dd if=/dev/zero of=/swapfile bs=64M count=16</span>
    <span style="color: black;">sudo</span> <span style="color: black;">mkswap /swapfile</span>
    <span style="color: black;">sudo</span> <span style="color: black;">swapon /swapfile</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">  取消交换分区:</span></span></p><span style="color: black;">sudo</span> <span style="color: black;">swapoff /swapfile</span>
    <span style="color: black;">sudo</span> <span style="color: black;">rm /swapfile</span>
    <h1 style="color: black; text-align: left; margin-bottom: 10px;">6、查看php安装<span style="color: black;">状况</span></h1>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">切换到configure指定的安装路径的bin目录,执行版本查看:</span></span></p>/usr/local/<span style="color: black;">install</span>/php8/<span style="color: black;">bin</span>/php <span style="color: black;">--version</span>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">  执行结果:</span></span></p>
    <div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/tos-cn-i-qvj2lq49k0/7e4c787b74834e6d9284ed1cba2917ab~noop.image?_iz=58558&amp;from=article.pc_detail&amp;lk3s=953192f4&amp;x-expires=1728208645&amp;x-signature=T7EmjoLcQn4SYz0gWeKNxHveVkI%3D" style="width: 50%; margin-bottom: 20px;"></div>
    <h1 style="color: black; text-align: left; margin-bottom: 10px;"><span style="color: black;">2、</span>管理<span style="color: black;">各样</span>配置文件</h1>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">1、生成php.ini配置文件(在php源码压缩包目录下):</span></span></p>cp php.ini-production /usr/<span style="color: black;">local</span>/install/php8/etc/php.ini
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">2、生成www配置文件:</span></span></p><span style="color: black;">cd</span> /usr/<span style="color: black;">local</span>/install/php8/etc/php-fpm.d/
    cp www.conf.default www.conf
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">3、生成php-fpm配置文件:</span></span></p><span style="color: black;">cd</span> /usr/<span style="color: black;">local</span>/install/php8/etc/
    cp php-fpm.conf.default php-fpm.conf<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">4、生成php-fpm可执行文件:</span></span></p><span style="color: black;">-- 创建存放配置文件的目录</span>
    mkdir /usr/local/<span style="color: black;">install</span>/php8/fpm

    <span style="color: black;">-- 从源码中复制一份fpm可执行脚本</span>
    cp /usr/<span style="color: black;">local</span>/php/php<span style="color: black;">-8.0</span><span style="color: black;">.0</span>/sapi/fpm/init.d.php-fpm /usr/<span style="color: black;">local</span>/<span style="color: black;">install</span>/php8/fpm/php-fpm

    <span style="color: black;">-- 将php-fpm修改为可执行文件</span>
    chmod <span style="color: black;">740</span> /usr/<span style="color: black;">local</span>/<span style="color: black;">install</span>/php8/fpm/php-fpm
    <h1 style="color: black; text-align: left; margin-bottom: 10px;"><span style="color: black;">3、</span>管理php</h1>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">说明:本文<span style="color: black;">举荐</span><span style="color: black;">运用</span>php-fpm进行管理php程序,php-fpm(FastCGI Process Manager:FastCGI进程管理器)是一个PHPFastCGI管理器,旨在将FastCGI进程管理整合进PHP包中(<span style="color: black;">源自</span>:百度百科)。</span></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">优点:相对Spawn-FCGI,php-fpm在CPU和内存方面的<span style="color: black;">掌控</span>都更胜一筹,<span style="color: black;">况且</span>前者很容易崩溃,必须用crontab进行监控,而php-fpm则<span style="color: black;">无</span>这种<span style="color: black;">懊恼</span>。</span></span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">1、<span style="color: black;">起步</span>php-fpm:</span></span></p>/usr/local/<span style="color: black;">install</span>/php8/fpm/php-fpm <span style="color: black;">start</span>
    <div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/tos-cn-i-qvj2lq49k0/516021576730498c8239825e0effe45f~noop.image?_iz=58558&amp;from=article.pc_detail&amp;lk3s=953192f4&amp;x-expires=1728208645&amp;x-signature=mVglvCg8GZcaQlFFQgjvCCS8Dc0%3D" style="width: 50%; margin-bottom: 20px;"></div>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">2、查看php-fpm进程<span style="color: black;">是不是</span><span style="color: black;">起步</span>成功</span></span></p>ps aux | <span style="color: black;">grep</span> php | <span style="color: black;">grep</span> -v <span style="color: black;">grep</span>
    <div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/tos-cn-i-qvj2lq49k0/4b23f854511c4e9dbc46cbcde2e113d8~noop.image?_iz=58558&amp;from=article.pc_detail&amp;lk3s=953192f4&amp;x-expires=1728208645&amp;x-signature=JzN%2Fa8YYjh8ivVia5eyCJxPIpjA%3D" style="width: 50%; margin-bottom: 20px;"></div>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">3、查看pfp-fpm占用的端口</span></span></p><span style="color: black;">ss</span> -lntp | grep php
    <div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p26-sign.toutiaoimg.com/tos-cn-i-qvj2lq49k0/89c5306f33fe4916b21d18af8be36e6a~noop.image?_iz=58558&amp;from=article.pc_detail&amp;lk3s=953192f4&amp;x-expires=1728208645&amp;x-signature=bqYum2S0PgaqJs5zoWLyX4JXCC8%3D" style="width: 50%; margin-bottom: 20px;"></div>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">4、执行php --version<span style="color: black;">显现</span>php command not found<span style="color: black;">反常</span>,<span style="color: black;">处理</span><span style="color: black;">过程</span></span></span></p><span style="color: black;">// 1、修改配置文件</span>
    vim /etc/profile

    <span style="color: black;">//2、添加php环境变量(即configure脚本时指定的安装路径下的bin目录)</span>
    PATH=$PATH:<span style="color: black;">/usr/</span>local/install/php8/bin
    <span style="color: black;">export</span> PATH

    <span style="color: black;">// 刷新配置文件</span>
    source /etc/profile

    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">5、大功告成</span></span></p>
    <div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/tos-cn-i-qvj2lq49k0/1c54da273a764beea96791278108cca7~noop.image?_iz=58558&amp;from=article.pc_detail&amp;lk3s=953192f4&amp;x-expires=1728208645&amp;x-signature=vfNMGFDBC%2FJe0ImIj43xx8OydL4%3D" style="width: 50%; margin-bottom: 20px;"></div>
    <h1 style="color: black; text-align: left; margin-bottom: 10px;">写在最后</h1>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><strong style="color: blue;"><span style="color: black;">「<span style="color: black;">倘若</span>觉得<span style="color: black;">文案</span>有<span style="color: black;">帮忙</span>,请给博主点赞、<span style="color: black;">保藏</span>、关注。」</span></strong> 后续博主会带来<span style="color: black;">更加多</span><span style="color: black;">优秀</span>、有质量的<span style="color: black;">文案</span>。</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">  想要学习<span style="color: black;">更加多</span>知识,<span style="color: black;">认识</span><span style="color: black;">更加多</span>开源项目,请关注博主,进入技术圈子(</span><strong style="color: blue;"><span style="color: black;">「圈子所有资源全免费,但<span style="color: black;">需求</span>加入的小伙伴要有<span style="color: black;">很久</span>兴趣,<span style="color: black;">倘若</span>只是一时冲动就不<span style="color: black;">举荐</span>加入,毕竟名额有限」</span></strong>)。</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">  加入技术圈子,除了遇到搭建问题免费<span style="color: black;">指点</span>,还能<span style="color: black;">第1</span>时间收到行业最新咨询和认识各专业大佬!</span></span></p>




4zhvml8 发表于 2024-10-7 20:01:09

你的努力一定会被看见,相信自己,加油。

1fy07h 发表于 2024-10-8 20:38:39

顶楼主,说得太好了!
页: [1]
查看完整版本: PHP8.0环境仔细安装教程