ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、视频、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
# Centos8(Liunx) 中安装PHP7.4 的三种方法和删除它的三种方法 <https://www.lagou.com/lgeduarticle/97902.html> ### 编译安装 ## Centos8下PHP源码编译和通过yum安装的区别和以后的选择 其实这两种方法各有千秋: **yum安装:** 从yum安装来说吧,yum相当于是自动化帮你安装,你不用管软件的依赖关系,在yum安装过程是帮你把软件的全部依赖关系帮你傻瓜式的解决了。而且现在Centos7的服务启动已经换成systemctl命令来控制了。通过yum安装会帮你自动注册服务,你可以通过systemctl start xxx.service启动服务,方便快捷。但是缺点是yum安装你没办法干预,安装的目录也是分散的。你可能要执行whereis或者find命令去找yum安装的路径。有时候yum安装的软件版本比较低,你不得不去找其他的yum源,或者rpm包。 **源码安装:** 源码编译在安装过程中可能要解决很多的依赖问题,才能装好一个软件。装好的软件你还不能通过systemctl来启动服务,因为在/usr/lib/systemd/system/路径下并没有你的服务的配置文件,你要自己手写一个。但是好处在于你能选择软件的版本,自定义安装目录,安装的模块。更加灵活方便。 **LNMP一键安装:** LNMP一键安装包是一个用Linux Shell编写的可以为CentOS/RHEL/Fedora/Aliyun/Amazon、Debian/Ubuntu/Raspbian/Deepin/Mint Linux VPS或独立主机安装LNMP(Nginx/MySQL/PHP)、LNMPA(Nginx/MySQL/PHP/Apache)、LAMP(Apache/MySQL/PHP)生产环境的Shell程序。无需一个一个的输入命令,无需值守,编译安装优化编译参数,提高性能,解决不必要的软件间依赖,特别针对配置自动优化。支持自定义Nginx、PHP编译参数及网站和数据库目录、支持生成LetseEcrypt证书、LNMP模式支持多PHP版本、支持单独安装Nginx/MySQL/MariaDB/Pureftpd服务器,同时提供一些实用的辅助工具如:虚拟主机管理、FTP用户管理、Nginx、MySQL/MariaDB、PHP的升级、常用缓存组件Redis/Xcache等的安装、重置MySQL root密码、502自动重启、日志切割、SSH防护DenyHosts/Fail2Ban、备份等许多实用脚本。 以上三种都是有各自的优点,建议是初学者一定要掌握源码编译的过程,手动解决安装过成中遇到的问题,熟悉如何编译一个软件,对于以后的发展是很有利的,而且有些软件没办法通过yum安装,这时候源码编译就显得很重要了。而像PHP这类软件来说,如果是编译安装的,如果缺少一个扩展,你就得做phpize, ./configure, make && make install等方式编译PHP扩展,这是很繁琐的。通过yum安装的话,当你要增加一个扩展,例如pdo,你就能够yum search php | grep pdo来寻找合适的pdo包,然后下载安装,系统会自动帮你添加到PHP扩展列表。省去我们很多工作。LNMP一键安装是为开发者快速搭建开发环境时使用,可以让开发者有更多时间在开发的业务逻辑上。 **1.使用yum命令([学习yum的基本知识](https://www.cnblogs.com/alliancehacker/p/12255450.html))** **参考网站:** ``` <pre class="calibre10">``` # https<span class="token3">:</span><span class="token1">/</span><span class="token1">/</span>www<span class="token3">.</span>jb51<span class="token3">.</span>net<span class="token1">/</span>article<span class="token1">/</span><span class="token6">175918.</span>htm # https<span class="token3">:</span><span class="token1">/</span><span class="token1">/</span>www<span class="token3">.</span>itgeeker<span class="token3">.</span>net<span class="token1">/</span>php7<span class="token1">-</span><span class="token6">3</span><span class="token1">-</span>yum<span class="token1">-</span>install<span class="token1">-</span>on<span class="token1">-</span>centos<span class="token1">-</span><span class="token6">7</span><span class="token1">/</span> ``` ``` 这个方法是比较简单的方法,可以很简单快速地安装php。([**rpm命令的基本用法和实例**](https://www.cnblogs.com/alliancehacker/p/12285348.html)) ``` <pre class="calibre10">``` #添加几个源,不然会报错 #php高版本的yum源地址,有两部分,其中一部分是epel<span class="token1">-</span>release,另外一部分来自webtatic。如果跳过epel<span class="token1">-</span>release的话,安装webtatic的时候 rpm <span class="token1">-</span>Uvh https<span class="token3">:</span><span class="token1">/</span><span class="token1">/</span>dl<span class="token3">.</span>fedoraproject<span class="token3">.</span>org<span class="token1">/</span>pub<span class="token1">/</span>epel<span class="token1">/</span>epel<span class="token1">-</span>release<span class="token1">-</span>latest<span class="token1">-</span><span class="token6">8.</span>noarch<span class="token3">.</span>rpm rpm <span class="token1">-</span>Uvh http<span class="token3">:</span><span class="token1">/</span><span class="token1">/</span>rpms<span class="token3">.</span>remirepo<span class="token3">.</span>net<span class="token1">/</span>enterprise<span class="token1">/</span>remi<span class="token1">-</span>release<span class="token1">-</span><span class="token6">8.</span>rpm ``` ``` ![](https://img.kancloud.cn/c5/7a/c57a155928a33ad0d06e7c636c0afdce_712x527.png) **添加相关的库后,启用 PHP 7.4 的 Remi 模块并进行安装。** ``` <pre class="calibre10">``` dnf <span class="token1">-</span>y install dnf<span class="token1">-</span>utils ``` ``` ``` <pre class="calibre10">``` #使用这个命令查看php7<span class="token3">.</span><span class="token6">4</span> yum search php74<span class="token1">*</span> ``` ``` ![](https://img.kancloud.cn/11/5c/115cdc5281beda7f8ca9d7004a4d2b3d_872x355.png) **然后安装你想要的模块:** ``` <pre class="calibre10">``` php74:安装PHP <span class="token6">7.4</span>的包 php74<span class="token1">-</span>php:用于创建动态web的PHP脚本语言网站 php74<span class="token1">-</span>build:基本的构建配置 php74<span class="token1">-</span>php<span class="token1">-</span>gd:用于PHP应用程序使用gd的模块图形库 php74<span class="token1">-</span>xhprof:一个用于PHP <span class="token1">-</span> Web接口的层次分析器 php74<span class="token1">-</span>zephir:用于创建扩展的Zephir语言PHP: php74<span class="token1">-</span>php<span class="token1">-</span>ast:抽象语法树 php74<span class="token1">-</span>php<span class="token1">-</span>cli:用于PHP的命令行接口 php74<span class="token1">-</span>php<span class="token1">-</span>dba:一个用于PHP的数据库抽象层模块应用程序 php74<span class="token1">-</span>php<span class="token1">-</span>dbg:交互式PHP调试器 php74<span class="token1">-</span>php<span class="token1">-</span>ffi:外部函数接口 php74<span class="token1">-</span>php<span class="token1">-</span>fpm:PHP FastCGI进程管理器 php74<span class="token1">-</span>php<span class="token1">-</span>gmp:一个用于使用GNU的PHP应用程序模块议员库 php74<span class="token1">-</span>php<span class="token1">-</span>lz4:x86_64<span class="token3">:</span> PHP的LZ4扩展 php74<span class="token1">-</span>php<span class="token1">-</span>pdo:一个用于PHP的数据库访问抽象模块应用程序 php74<span class="token1">-</span>php<span class="token1">-</span>xml:x86_64<span class="token3">:</span>用于使用XML的PHP应用程序的模块 php74<span class="token1">-</span>runtime:处理php74软件集合的包: php74<span class="token1">-</span>php<span class="token1">-</span>imap:x86_64<span class="token3">:</span>用于使用IMAP的PHP应用程序的模块 php74<span class="token1">-</span>php<span class="token1">-</span>intl:x86_64<span class="token3">:</span> PHP国际化扩展应用程序 php74<span class="token1">-</span>php<span class="token1">-</span>json:x86_64<span class="token3">:</span> PHP的JavaScript对象符号扩展 php74<span class="token1">-</span>php<span class="token1">-</span>ldap:x86_64<span class="token3">:</span>用于使用LDAP的PHP应用程序的模块 php74<span class="token1">-</span>php<span class="token1">-</span>oci8:x86_64<span class="token3">:</span>用于使用OCI8的PHP应用程序的模块数据库 php74<span class="token1">-</span>php<span class="token1">-</span>odbc:x86_64<span class="token3">:</span>用于使用ODBC的PHP应用程序的模块数据库 php74<span class="token1">-</span>php<span class="token1">-</span>pear:noarch<span class="token3">:</span> PHP扩展和应用程序库框架 php74<span class="token1">-</span>php<span class="token1">-</span>pggi:GTK绑定 php74<span class="token1">-</span>php<span class="token1">-</span>snmp:一个用于PHP应用程序查询的模块SNMP<span class="token1">-</span>managed设备 php74<span class="token1">-</span>php<span class="token1">-</span>soap:用于使用SOAP的PHP应用程序的模块协议 php74<span class="token1">-</span>php<span class="token1">-</span>tidy:标准PHP模块提供了tidy库支持 php74<span class="token1">-</span>php<span class="token1">-</span>zstd:x86_64<span class="token3">:</span> Zstandard扩展名 php74<span class="token1">-</span>scldevel:x86_64<span class="token3">:</span>打包php74的开发文件 php74<span class="token1">-</span>unit<span class="token1">-</span>php:用于NGINX单元的PHP模块 php74<span class="token1">-</span>php<span class="token1">-</span>devel:构建PHP扩展所需的文件 php74<span class="token1">-</span>php<span class="token1">-</span>pgsql:一个用于PHP的PostgreSQL数据库模块 php74<span class="token1">-</span>php<span class="token1">-</span>pinba:x86_64<span class="token3">:</span> Pinba统计服务器的客户端扩展 php74<span class="token1">-</span>php<span class="token1">-</span>bcmath:用于PHP应用程序的模块bcmath库 php74<span class="token1">-</span>php<span class="token1">-</span>brotli:用于PHP的Brotli扩展 php74<span class="token1">-</span>php<span class="token1">-</span>common:PHP的公共文件 php74<span class="token1">-</span>php<span class="token1">-</span>pspell:x86_64<span class="token3">:</span>用于PHP应用程序的模块中接口 php74<span class="token1">-</span>php<span class="token1">-</span>recode:用于PHP应用程序的模块重新编码库 php74<span class="token1">-</span>php<span class="token1">-</span>snappy:PHP的Snappy扩展 php74<span class="token1">-</span>php<span class="token1">-</span>sodium:x86_64<span class="token3">:</span>钠密码库的包装 php74<span class="token1">-</span>php<span class="token1">-</span>sqlsrv:x86_64<span class="token3">:</span>用于SQL Server的PHP Microsoft驱动程序 php74<span class="token1">-</span>php<span class="token1">-</span>xmlrpc:的PHP应用程序模块xml <span class="token1">-</span> rpc协议 php74<span class="token1">-</span>php<span class="token1">-</span>enchant:增强PHP的拼写扩展应用程序 php74<span class="token1">-</span>php<span class="token1">-</span>libvirt:用于Libvirt的PHP语言绑定 php74<span class="token1">-</span>php<span class="token1">-</span>mysqlnd:x86_64<span class="token3">:</span>用于使用MySQL的PHP应用程序的模块数据库 php74<span class="token1">-</span>php<span class="token1">-</span>opcache:x86_64<span class="token3">:</span> Zend OPcache php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>ds:x86_64<span class="token3">:</span> PHP的数据结构 php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>ev:提供libev库的接口 php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>pq:PostgreSQL客户端库<span class="token3">(</span>libpq<span class="token3">)</span>绑定 php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>uv:Libuv包装器 php74<span class="token1">-</span>php<span class="token1">-</span>process:用于PHP脚本的模块使用系统进程接口 php74<span class="token1">-</span>php<span class="token1">-</span>embedded:用于嵌入应用程序的PHP库 php74<span class="token1">-</span>php<span class="token1">-</span>mbstring:一个用于PHP应用程序的模块多字节字符串处理 php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>dio:直接I<span class="token1">/</span>O函数 php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>eio:提供libeio库的接口 php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>env:加载环境变量 php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>lua:嵌入式lua解释器 php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>lzf:x86_64<span class="token3">:</span>处理LZF de<span class="token1">/</span>压缩的扩展 php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>nsq:NSQ客户端的PHP扩展 php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>psr:PSR接口 php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>rar:用于读取RAR存档的PHP扩展 php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>rrd:x86_64<span class="token3">:</span> rrdtool的PHP绑定 php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>sdl:简单的PHP DirectMedia层 php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>svn:x86_64<span class="token3">:</span> Subversion版本的PHP绑定控制系统 php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>vld:x86_64<span class="token3">:</span>转储PHP的内部表示脚本 php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>yac:无锁用户数据缓存 php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>yaf:x86_64<span class="token3">:</span>又一个框架 php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>yar:轻量级并发RPC框架 php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>yaz:x86_64<span class="token3">:</span> Z39<span class="token3">.</span><span class="token6">50</span><span class="token1">/</span>SRU客户端 php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>zip:一个ZIP文件的扩展名 php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>zmq:ZeroMQ消息传递 php74<span class="token1">-</span>php<span class="token1">-</span>phalcon4:Phalcon框架 php74<span class="token1">-</span>php<span class="token1">-</span>componere:在运行时编写PHP类 php74<span class="token1">-</span>php<span class="token1">-</span>litespeed:LiteSpeed Web服务器PHP支持 php74<span class="token1">-</span>php<span class="token1">-</span>maxminddb:MaxMind DB Reader扩展 php74<span class="token1">-</span>php<span class="token1">-</span>pdo<span class="token1">-</span>dblib:x86_64<span class="token3">:</span> PDO驱动程序,用于Microsoft SQL Server和Sybase数据库 php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>amqp:与任何AMQP兼容的服务器通信 php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>apcu:APC用户缓存 php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>apfd:总是填充表单数据 php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>fann:用于FANN库的包装器 php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>grpc:x86_64<span class="token3">:</span>通用RPC框架 php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>http:扩展的HTTP支持 php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>krb5:Kerberos验证扩展 php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>pcov:x86_64<span class="token3">:</span>代码覆盖驱动程序 php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>ssh2:x86_64<span class="token3">:</span> libssh2库的绑定 php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>sync:已命名和未命名同步对象 php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>uopz:x86_64<span class="token3">:</span> Zend的用户操作 php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>uuid:通用唯一标识符扩展对于PHP php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>vips:x86_64<span class="token3">:</span>与libvip接口的PHP扩展 php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>wddx:Web分布式数据交换 php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>yaml:x86_64<span class="token3">:</span> yaml的PHP绑定 php74<span class="token1">-</span>php<span class="token1">-</span>phpiredis:x86_64<span class="token3">:</span> Redis的客户端扩展名 php74<span class="token1">-</span>php<span class="token1">-</span>smbclient:libsmbclient的PHP包装 php74<span class="token1">-</span>php<span class="token1">-</span>wkhtmltox:HTML转换器 php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>cmark:CommonMark扩展名 php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>dbase:dBase数据库文件访问函数 php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>druid:一个PHP的德鲁伊驱动 php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>event:提供libevent库的接口 php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>geoip:将IP地址映射到的扩展名地理位置 php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>gnupg:x86_64<span class="token3">:</span> gpgme库的包装 php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>mysql:MySQL数据库访问函数 php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>oauth:PHP OAuth消费者扩展 php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>parle:x86_64<span class="token3">:</span>解析和词法分析 php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>raphf:资源和持久句柄工厂 php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>solr2:Apache Solr的API定向对象 php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>stats:用于统计计算的例程 php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>stomp:Stomp客户端扩展 php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>taint:x86_64<span class="token3">:</span> XSS代码嗅探器 php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>xattr:扩展属性 php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>xdiff:文件差异<span class="token1">/</span>补丁 php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>xxtea:XXTEA加密算法扩展PHP php74<span class="token1">-</span>php<span class="token1">-</span>libvirt<span class="token1">-</span>doc:noarch<span class="token3">:</span> php<span class="token1">-</span>libvirt文件 php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>base58:用base58编码和解码数据 php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>bitset:位集库 php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>crypto:OpenSSL密码库的包装器 php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>gender:x86_64<span class="token3">:</span>性别扩展 php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>hprose:用于PHP的h散文 php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>hrtime:x86_64<span class="token3">:</span>高分辨率定时 php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>mcrypt:x86_64<span class="token3">:</span> libmcrypt库的绑定 php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>pdflib:生成PDF文件的包 php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>propro:属性代理 php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>radius:Radius客户端库 php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>redis4:的扩展名 Redis键值存储 php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>redis5:的扩展名 Redis键值存储 php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>scrypt:Scrypt散列函数 php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>sphinx:Sphinx SQL全文的PECL扩展搜索引擎 php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>ssdeep:libfuzzy库的包装器 php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>trader:为贸易商提供技术分析 php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>xdebug:用于调试PHP脚本的PECL包 php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>xhprof:x86_64<span class="token3">:</span> XHProf的PHP扩展,层次结构分析器 php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>yaconf:x86_64<span class="token3">:</span>另一个配置容器 php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>apcu<span class="token1">-</span>bc:APCu向后兼容模块 php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>decimal:任意精度浮点小数 php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>gearman:PHP包装器到libgearman php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>gmagick:的包装器GraphicsMagick库 php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>imagick:x86_64<span class="token3">:</span>用于创建和修改映像的扩展使用ImageMagick php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>inotify:x86_64<span class="token3">:</span> Inotify php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>leveldb:LevelDB PHP绑定 php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>memprof:x86_64<span class="token3">:</span>内存使用分析器 php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>mongodb:x86_64<span class="token3">:</span>用于PHP的MongoDB驱动程序 php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>msgpack:用于与MessagePack通信的API序列化 php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>rdkafka:基于librdkafka的Kafka客户端 php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>rpminfo:x86_64<span class="token3">:</span> RPM信息 php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>runkit7:为了这些你…不应该…无论如何我一直在做……但是肯定做的<span class="token1">!</span> php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>seaslog:一个有效、快速、稳定的日志 PHP扩展 php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>selinux:用于PHP脚本的SELinux绑定语言 php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>swoole4:PHP的异步并发分布式网络框架 php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>timecop:x86_64<span class="token3">:</span>时间旅行和冻结扩展 php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>varnish:Varnish缓存绑定 php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>xmldiff:x86_64<span class="token3">:</span> XML差异和合并 php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>igbinary:x86_64<span class="token3">:</span>替代标准PHP序列化器 php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>memcache:x86_64<span class="token3">:</span>使用Memcached的扩展缓存守护进程 php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>mogilefs:要与之通信的PHP客户端库 MogileFS存储 php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>mustache:Mustache模板语言 php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>protobuf:序列化结构化的机制数据 php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>rdkafka4:基于librdkafka的Kafka客户端 php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>scoutapm:本地扩展组件 ScoutAPM的PHP代理 php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>translit:将非拉丁字符音译设置为拉丁文 php74<span class="token1">-</span>php<span class="token1">-</span>snuffleupagus:x86_64<span class="token3">:</span> PHP的安全模块 php74<span class="token1">-</span>php<span class="token1">-</span>zephir<span class="token1">-</span>parser:x86_64<span class="token3">:</span> Zephir解析器扩展 php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>cassandra:用于Apache的DataStax PHP驱动程序卡桑德拉 php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>json<span class="token1">-</span>post:JSON POST处理程序 php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>mailparse:用于解析和的PHP PECL包处理电子邮件消息 php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>memcached:x86_64<span class="token3">:</span>使用Memcached的扩展缓存守护进程 php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>mosquitto:libmosquito <span class="token1">-</span> to的扩展 php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>seasclick:一个Yandex ClickHouse客户端驱动 PHP扩展 php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>xlswriter:一个高效、快速的xlsx文件出口扩展 php74<span class="token1">-</span>php<span class="token1">-</span>horde<span class="token1">-</span>horde<span class="token1">-</span>lz4:Horde LZ4压缩扩展 php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>apcu<span class="token1">-</span>devel:APCu开发人员文件<span class="token3">(</span>头文件<span class="token3">)</span> php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>couchbase2:Couchbase服务器PHP扩展 php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>geospatial:PHP扩展来处理公共地理空间功能 php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>handlebars:Handlebars模板语言 php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>http<span class="token1">-</span>devel:x86_64<span class="token3">:</span>扩展HTTP支持开发人员文件<span class="token3">(</span>头<span class="token3">)</span> php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>krb5<span class="token1">-</span>devel:Kerberos扩展开发人员文件<span class="token3">(</span>头<span class="token3">)</span> php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>luasandbox:带有限制和安全的Lua解释器环境 php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>opencensus:一个stats集合和分布式跟踪框架 php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>skywalking:x86_64<span class="token3">:</span> Apache的PHP工具代理人行天桥 php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>ahocorasick:有效的Aho<span class="token1">-</span>Corasick字符串模式匹配算法 php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>ip2location:获取an的地理位置信息IP地址 php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>http<span class="token1">-</span>message:x86_64<span class="token3">:</span> PSR<span class="token1">-</span><span class="token6">7</span> HTTP消息实现 php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>datadog<span class="token1">-</span>trace:APM和分布式跟踪PHP php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>hdr<span class="token1">-</span>histogram:x86_64<span class="token3">:</span> C语言的PHP扩展包装hdrhistogram API php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>imagick<span class="token1">-</span>devel:imagick扩展开发人员文件<span class="token3">(</span>头<span class="token3">)</span> php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>msgpack<span class="token1">-</span>devel:MessagePack开发人员文件<span class="token3">(</span>头<span class="token3">)</span> php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>mysql<span class="token1">-</span>xdevapi:MySQL数据库访问函数 php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>mysqlnd<span class="token1">-</span>azure:x86_64<span class="token3">:</span> mysqlnd的重定向插件 php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>igbinary<span class="token1">-</span>devel:Igbinary开发人员文件<span class="token3">(</span>头<span class="token3">)</span> php74<span class="token1">-</span>php<span class="token1">-</span>pecl<span class="token1">-</span>uploadprogress:x86_64<span class="token3">:</span>跟踪进度的扩展文件上传 ``` ``` ``` <pre class="calibre10">``` # 运行一下 yum install php74<span class="token1">-</span>php ``` ``` ![](https://img.kancloud.cn/d3/c4/d3c49deddcc0842b73e4c43d1265a143_1289x941.png) \*\* 使用如下命令安装额外的包\*\* ``` <pre class="calibre10">``` yum search php74<span class="token1">*</span> yum install php74<span class="token1">-</span>xxx ``` ``` **运行并查看版本, 重启命令, 添加自动启动,链接php文件** ``` <pre class="calibre10">``` #运行并查看版本 php74 <span class="token1">-</span>v #重启命令php<span class="token1">-</span>fpm systemctl restart php74<span class="token1">-</span>php<span class="token1">-</span>fpm #添加自动启动 systemctl enable php74<span class="token1">-</span>php<span class="token1">-</span>fpm #查看php7<span class="token3">.</span><span class="token6">4</span>的安装路径 whereis php #链接php文件 ln <span class="token1">-</span>s <span class="token1">/</span>opt<span class="token1">/</span>remi<span class="token1">/</span>php74<span class="token1">/</span>root<span class="token1">/</span>usr<span class="token1">/</span>bin<span class="token1">/</span>php <span class="token1">/</span>usr<span class="token1">/</span>bin<span class="token1">/</span>php ``` ``` ![](https://img.kancloud.cn/ed/c3/edc32e7910ea5f9daa8da96dbc284879_731x104.png) ![](https://img.kancloud.cn/f5/5a/f55a92e5f29c579a739bc386658b3918_335x167.png) ![](https://img.kancloud.cn/a3/9d/a39dec79b311f12de41afe3bc747a83f_441x48.png) **一些配置文件的路径** ``` <pre class="calibre10">``` # The current PHP memory limit is below the recommended value of <span class="token6">512</span>MB<span class="token3">.</span> vi <span class="token1">/</span>etc<span class="token1">/</span>opt<span class="token1">/</span>remi<span class="token1">/</span>php74<span class="token1">/</span>php<span class="token3">.</span>ini memory_limit <span class="token1">=</span> <span class="token6">512</span>M #如果你运行的是nginx而不是apache,修改 vi <span class="token1">/</span>etc<span class="token1">/</span>opt<span class="token1">/</span>remi<span class="token1">/</span>php74<span class="token1">/</span>php<span class="token1">-</span>fpm<span class="token3">.</span>d<span class="token1">/</span>www<span class="token3">.</span>conf user <span class="token1">=</span> apache group <span class="token1">=</span> apache # Replace the values with user <span class="token1">=</span> nginx group <span class="token1">=</span> nginx ``` ``` **卸载所有php7.4** ``` <pre class="calibre10">``` yum remove php74<span class="token1">-</span>php<span class="token1">*</span> ``` ``` ![](https://img.kancloud.cn/1c/47/1c475a60b800b2647d8c8fa79560ffe1_1247x965.png) ## 2.编译安装PHP以及需要的基本扩展库(php7.4) **参考网站:** <https://www.php.net/manual/zh/install.php> <https://www.cnblogs.com/werben/p/11833903.html> <https://www.cnblogs.com/ckh2014/p/10909672.html> <https://www.24kplus.com/linux/1614.html> ### 下载php源码 用php的官网,有很多源的,想要什么版本可以自己选一下 <https://www.php.net/distributions/php-7.4.2.tar.bz2> ``` <pre class="calibre10">``` #回到用户目录 cd <span class="token1">~</span> #下载php7<span class="token3">.</span><span class="token6">4</span>源码 wget https<span class="token3">:</span><span class="token1">/</span><span class="token1">/</span>www<span class="token3">.</span>php<span class="token3">.</span>net<span class="token1">/</span>distributions<span class="token1">/</span>php<span class="token1">-</span><span class="token6">7.4</span><span class="token6">.2</span><span class="token3">.</span>tar<span class="token3">.</span>bz2 ``` ``` ![](https://img.kancloud.cn/ad/be/adbee2c3765a0ab51cdc1fee746f10b2_834x142.png) 下载完成 ![](https://img.kancloud.cn/e0/4f/e04fcdff49c9fc2d4cc78af5df8c7603_833x28.png) [\*\* 解压文的基本命令和实例\*\*](https://www.cnblogs.com/alliancehacker/p/12284186.html) ``` <pre class="calibre10">``` # 把它移动到usr<span class="token1">/</span>local文件下操作,我个人习惯 mv php<span class="token1">-</span><span class="token6">7.4</span><span class="token6">.2</span><span class="token3">.</span>tar<span class="token3">.</span>bz2 <span class="token1">/</span>usr<span class="token1">/</span>local<span class="token1">/</span>php<span class="token1">-</span><span class="token6">7.4</span><span class="token6">.2</span><span class="token3">.</span>tar<span class="token3">.</span>bz2 # 切换文件目录 cd <span class="token1">/</span>usr<span class="token1">/</span>local<span class="token1">/</span> # 解压文件 tar <span class="token1">--</span>bzip <span class="token1">-</span>xvf <span class="token1">/</span>usr<span class="token1">/</span>local<span class="token1">/</span>php<span class="token1">-</span><span class="token6">7.4</span><span class="token6">.2</span><span class="token3">.</span>tar<span class="token3">.</span>bz2 # 切换文件目录 cd php<span class="token1">-</span><span class="token6">7.4</span><span class="token6">.2</span> ``` ``` ![](https://img.kancloud.cn/df/f9/dff9f70e565c0c700f0cf1f98eec722e_676x45.png) ![](https://img.kancloud.cn/e4/7d/e47df0cb3db002bf7a56c9782f65467d_1102x165.png) ### 安装编译工具和库 安装php的依赖库和安装编译的工具,无论有没有装都可以执行一下 ``` <pre class="calibre10">``` yum <span class="token1">-</span>y install gcc gcc<span class="token1">-</span>c<span class="token1">++</span> yum <span class="token1">-</span>y install libxml2<span class="token1">-</span>devel openssl<span class="token1">-</span>devel curl<span class="token1">-</span>devel libjpeg<span class="token1">-</span>devel libpng<span class="token1">-</span>devel libicu<span class="token1">-</span>devel freetype<span class="token1">-</span>devel openldap<span class="token1">-</span>de ``` ``` ![](https://img.kancloud.cn/b6/1b/b61bb1c61da281674471e19d05d11d08_747x222.png) \*\* 创建用户组和用户\*\* ``` <pre class="calibre10">``` groupadd www useradd <span class="token1">-</span>g www www ``` ``` ## **php ./configure的一些参数及意义** ``` <pre class="calibre10">``` PHP编译参数的含义 <span class="token3">.</span><span class="token1">/</span>configure –prefix<span class="token1">=</span><span class="token1">/</span>usr<span class="token1">/</span>local<span class="token1">/</span>php php安装目录 –with<span class="token1">-</span>apxs2<span class="token1">=</span><span class="token1">/</span>usr<span class="token1">/</span>local<span class="token1">/</span>apache<span class="token1">/</span>bin<span class="token1">/</span>apxs –with<span class="token1">-</span>config<span class="token1">-</span>file<span class="token1">-</span>path<span class="token1">=</span><span class="token1">/</span>usr<span class="token1">/</span>local<span class="token1">/</span>php<span class="token1">/</span>etc 指定php<span class="token3">.</span>ini位置 –with<span class="token1">-</span>MySQL<span class="token1">=</span><span class="token1">/</span>usr<span class="token1">/</span>local<span class="token1">/</span>mysql mysql安装目录,对mysql的支持 –with<span class="token1">-</span>mysqli<span class="token1">=</span><span class="token1">/</span>usr<span class="token1">/</span>local<span class="token1">/</span>mysql<span class="token1">/</span>bin<span class="token1">/</span>mysql_config mysqli文件目录<span class="token3">,</span>优化支持 –enable<span class="token1">-</span>safe<span class="token1">-</span>mode 打开安全模式 –enable<span class="token1">-</span>ftp 打开ftp的支持 –enable<span class="token1">-</span>zip 打开对zip的支持 –with<span class="token1">-</span>bz2 打开对bz2文件的支持 –with<span class="token1">-</span>jpeg<span class="token1">-</span>dir 打开对jpeg图片的支持 –with<span class="token1">-</span>png<span class="token1">-</span>dir 打开对png图片的支持 –with<span class="token1">-</span>freetype<span class="token1">-</span>dir 打开对freetype字体库的支持 –without<span class="token1">-</span>iconv 关闭iconv函数,种字符集间的转换 –with<span class="token1">-</span>libxml<span class="token1">-</span>dir 打开libxml2库的支持 –with<span class="token1">-</span>xmlrpc 打开xml<span class="token1">-</span>rpc的C语言 –with<span class="token1">-</span>zlib<span class="token1">-</span>dir 打开zlib库的支持 –with<span class="token1">-</span>gd 打开gd库的支持 –enable<span class="token1">-</span>gd<span class="token1">-</span>native<span class="token1">-</span>ttf 支持TrueType字符串函数库 –with<span class="token1">-</span>curl 打开curl浏览工具的支持 –with<span class="token1">-</span>curlwrappers 运用curl工具打开url流 –with<span class="token1">-</span>ttf 打开freetype1<span class="token3">.</span><span class="token1">*</span>的支持,可以不加了 –with<span class="token1">-</span>xsl 打开XSLT文件支持,扩展了libxml2库 ,需要libxslt软件 –with<span class="token1">-</span>gettext 打开gnu的gettext 支持,编码库用到 –with<span class="token1">-</span>pear 打开pear命令的支持,php扩展用的 –enable<span class="token1">-</span>calendar 打开日历扩展功能 –enable<span class="token1">-</span>mbstring 多字节,字符串的支持 –enable<span class="token1">-</span>bcmath 打开图片大小调整<span class="token3">,</span>用到zabbix监控的时候用到了这个模块 –enable<span class="token1">-</span>sockets 打开sockets 支持 –enable<span class="token1">-</span>exif 图片的元数据支持 –enable<span class="token1">-</span>magic<span class="token1">-</span>quotes 魔术引用的支持 –disable<span class="token1">-</span>rpath 关闭额外的运行库文件 –disable<span class="token1">-</span>debug 关闭调试模式 –with<span class="token1">-</span>mime<span class="token1">-</span>magic<span class="token1">=</span><span class="token1">/</span>usr<span class="token1">/</span>share<span class="token1">/</span>file<span class="token1">/</span>magic<span class="token3">.</span>mime 魔术头文件位置 cgi方式安装才用的参数 –enable<span class="token1">-</span>fpm 打上php<span class="token1">-</span>fpm补丁后才有这个参数,cgi方式安装的启动程序 –enable<span class="token1">-</span>fastcgi 支持fastcgi方式启动php –enable<span class="token1">-</span>force<span class="token1">-</span>cgi<span class="token1">-</span>redirect 同上<span class="token3">,</span>帮助里没有解释 –with<span class="token1">-</span>ncurses 支持ncurses屏幕绘制以及基于文本终端的图形互动功能的动态库 –enable<span class="token1">-</span>pcntl freeTDS需要用到的,可能是链接mssql才用到 mhash和mcrypt算法的扩展 –with<span class="token1">-</span>mcrypt 算法 –with<span class="token1">-</span>mhash 算法 –with<span class="token1">-</span>gmp –enable<span class="token1">-</span>inline<span class="token1">-</span>optimization –with<span class="token1">-</span>openssl openssl的支持,加密传输时用到的 –enable<span class="token1">-</span>dbase –with<span class="token1">-</span>pcre<span class="token1">-</span>dir<span class="token1">=</span><span class="token1">/</span>usr<span class="token1">/</span>local<span class="token1">/</span>bin<span class="token1">/</span>pcre<span class="token1">-</span>config perl的正则库案安装位置 –disable<span class="token1">-</span>dmalloc –with<span class="token1">-</span>gdbm dba的gdbm支持 –enable<span class="token1">-</span>sigchild –enable<span class="token1">-</span>sysvsem –enable<span class="token1">-</span>sysvshm –enable<span class="token1">-</span>zend<span class="token1">-</span>multibyte 支持zend的多字节 –enable<span class="token1">-</span>mbregex –enable<span class="token1">-</span>wddx –enable<span class="token1">-</span>shmop –enable<span class="token1">-</span>soap PHP配置选项完整列表 数据库选项 <span class="token1">--</span>with<span class="token1">-</span>dbplus  包括 dbplus 的支持。 <span class="token1">--</span>with<span class="token1">-</span>adabas<span class="token3">[</span><span class="token1">=</span>DIR<span class="token3">]</span>  包括 Adabas D 的支持。DIR 是 Adabas 的基本安装目录,默认为 <span class="token1">/</span>usr<span class="token1">/</span>local。 <span class="token1">--</span>with<span class="token1">-</span>sapdb<span class="token3">[</span><span class="token1">=</span>DIR<span class="token3">]</span>  包括 SAP DB 的支持。DIR 是 SAP DB 的基本安装目录,默认为 <span class="token1">/</span>usr<span class="token1">/</span>local。 <span class="token1">--</span>with<span class="token1">-</span>solid<span class="token3">[</span><span class="token1">=</span>DIR<span class="token3">]</span>  包括 Solid 的支持。DIR 是 Solid 的基本安装目录,默认为 <span class="token1">/</span>usr<span class="token1">/</span>local<span class="token1">/</span>solid。 <span class="token1">--</span>with<span class="token1">-</span>ibm<span class="token1">-</span>db2<span class="token3">[</span><span class="token1">=</span>DIR<span class="token3">]</span>  包括 IBM DB2 的支持。DIR 是 DB2 的基本安装目录,默认为 <span class="token1">/</span>home<span class="token1">/</span>db2inst1<span class="token1">/</span>sqllib。 <span class="token1">--</span>with<span class="token1">-</span>empress<span class="token3">[</span><span class="token1">=</span>DIR<span class="token3">]</span>  包括 Empress 的支持。DIR 是 Empress 的基本安装目录,默认为 $EMPRESSPATH。自 PHP4起,本选项仅支持 Empress <span class="token6">8.60</span> 及以上版本。 <span class="token1">--</span>with<span class="token1">-</span>empress<span class="token1">-</span>bcs<span class="token3">[</span><span class="token1">=</span>DIR<span class="token3">]</span>  包括 Empress Local Access 的支持。DIR 是 Empress 的基本安装目录,默认为$EMPRESSPATH。自 PHP4 起,本选项仅支持 Empress <span class="token6">8.60</span> 及以上版本。 <span class="token1">--</span>with<span class="token1">-</span>birdstep<span class="token3">[</span><span class="token1">=</span>DIR<span class="token3">]</span>  包括 Birdstep 的支持。DIR 是 Birdstep 的基本安装目录,默认为<span class="token1">/</span>usr<span class="token1">/</span>local<span class="token1">/</span>birdstep。 <span class="token1">--</span>with<span class="token1">-</span>custom<span class="token1">-</span>odbc<span class="token3">[</span><span class="token1">=</span>DIR<span class="token3">]</span>  包括用户自定义 ODBC 的支持。DIR 是 ODBC 的基本安装目录,默认为 <span class="token1">/</span>usr<span class="token1">/</span>local。要确认定义了CUSTOM_ODBC_LIBS 并且在 include 目录中有某个 odbc<span class="token3">.</span>h。例如,对于 QNX 下的 Sybase SQLAnywhere <span class="token6">5.5</span><span class="token6">.00</span>,在运行 configure 脚本之前应该先定义以下环境变量: CPPFLAGS<span class="token1">=</span><span class="token2">"-DODBC_QNX-DSQLANY_BUG"</span> LDFLAGS<span class="token1">=</span><span class="token1">-</span>lunix CUSTOM_ODBC_LIBS<span class="token1">=</span><span class="token2">"-ldblib-lodbc"</span><span class="token3">.</span> <span class="token1">--</span>with<span class="token1">-</span>iodbc<span class="token3">[</span><span class="token1">=</span>DIR<span class="token3">]</span>  包括 iODBC 的支持。DIR 是 iODBC 的基本安装目录,默认为 <span class="token1">/</span>usr<span class="token1">/</span>local。 <span class="token1">--</span>with<span class="token1">-</span>esoob<span class="token3">[</span><span class="token1">=</span>DIR<span class="token3">]</span>  包括 Easysoft OOB 的支持。DIR 是 OOB 的基本安装目录,默认为<span class="token1">/</span>usr<span class="token1">/</span>local<span class="token1">/</span>easysoft<span class="token1">/</span>oob<span class="token1">/</span>client。 <span class="token1">--</span>with<span class="token1">-</span>unixODBC<span class="token3">[</span><span class="token1">=</span>DIR<span class="token3">]</span>  包括 unixODBC 的支持。DIR 是 unixODBC 的基本安装目录,默认为 <span class="token1">/</span>usr<span class="token1">/</span>local。 <span class="token1">--</span>with<span class="token1">-</span>openlink<span class="token3">[</span><span class="token1">=</span>DIR<span class="token3">]</span>  包括 OpenLink ODBC 的支持。DIR 是 OpenLink 的基本安装目录,默认为 <span class="token1">/</span>usr<span class="token1">/</span>local。这和 iODBC一样。 <span class="token1">--</span>with<span class="token1">-</span>dbmaker<span class="token3">[</span><span class="token1">=</span>DIR<span class="token3">]</span>  包括 DBMaker 的支持。DIR 是 DBMaker 的基本安装目录,默认为最新版 DBMaker 安装的目录(例如<span class="token1">/</span>home<span class="token1">/</span>dbmaker<span class="token1">/</span><span class="token6">3.6</span>)。 <span class="token1">--</span>disable<span class="token1">-</span>unified<span class="token1">-</span>odbc  取消对 unified ODBC 的支持。仅适用于激活了 iODBC,Adabas,Solid,Velocis 或用户自定义 ODBC界面。仅能用于 PHP <span class="token6">3</span>! 图像选项 <span class="token1">--</span>without<span class="token1">-</span>gd  禁用 GD 支持。仅用于 PHP <span class="token6">3</span>! <span class="token1">--</span>with<span class="token1">-</span>imagick  Imagick 扩展被移到 PEAR 中的 PECL 中去了,可以在这里找到。PHP <span class="token6">4</span> 中的安装指示可以在 PEAR站点中找到。只用 <span class="token1">--</span>with<span class="token1">-</span>imagick 仅在 PHP <span class="token6">3</span> 中支持,除非依照 PEAR 站点的指示去做。 <span class="token1">--</span>with<span class="token1">-</span>ming<span class="token3">[</span><span class="token1">=</span>DIR<span class="token3">]</span>  包括 ming 支持。 杂类选项 <span class="token1">--</span>enable<span class="token1">-</span>force<span class="token1">-</span>cgi<span class="token1">-</span>redirect  激活服务器内部重定向的安全检查。如果是在 Apache 中以 CGI 方式使用 PHP 则应该使用此选项。 <span class="token1">--</span>enable<span class="token1">-</span>discard<span class="token1">-</span>path  使用此选项可以使 PHP 的 CGI 可执行程序安全地放置在 web 目录树以外的地方,并且别人也不能绕过 <span class="token3">.</span>htaccess的安全设置。 <span class="token1">--</span>with<span class="token1">-</span>fastcgi  将 PHP 编译成 FastCGI 应用程序。 <span class="token1">--</span>enable<span class="token1">-</span>debug  编译时加入调试符号。 <span class="token1">--</span>with<span class="token1">-</span>layout<span class="token1">=</span>TYPE  设置安装后的文件布局。TYPE 可以是 PHP(默认值)或者 GNU。 <span class="token1">--</span>with<span class="token1">-</span>pear<span class="token1">=</span>DIR  将 PEAR 安装在 DIR 目录中(默认为 PREFIX<span class="token1">/</span>lib<span class="token1">/</span>php)。 <span class="token1">--</span>without<span class="token1">-</span>pear  不安装 PEAR。 <span class="token1">--</span>enable<span class="token1">-</span>sigchild  激活 PHP 自己的 SIGCHILD 句柄。 <span class="token1">--</span>disable<span class="token1">-</span>rpath  禁止传递附加的运行时库搜索路径。 <span class="token1">--</span>enable<span class="token1">-</span>libgcc  激活显式 libgcc 连接。 <span class="token1">--</span>enable<span class="token1">-</span>php<span class="token1">-</span>streams  包含试验的 PHP 流。除非是测试源代码,否则不要使用! <span class="token1">--</span>with<span class="token1">-</span>zlib<span class="token1">-</span>dir<span class="token1">=</span><span class="token1"><</span>DIR<span class="token1">></span>  定义zlib 的安装路径。 <span class="token1">--</span>with<span class="token1">-</span>aspell<span class="token3">[</span><span class="token1">=</span>DIR<span class="token3">]</span>  包含 ASPELL 支持。 <span class="token1">--</span>with<span class="token1">-</span>ccvs<span class="token3">[</span><span class="token1">=</span>DIR<span class="token3">]</span>  包含 CCVS 支持。 <span class="token1">--</span>with<span class="token1">-</span>cybercash<span class="token3">[</span><span class="token1">=</span>DIR<span class="token3">]</span>  包含 CyberCash 支持。DIR 是 CyberCash MCK 的安装目录。 <span class="token1">--</span>with<span class="token1">-</span>icap<span class="token3">[</span><span class="token1">=</span>DIR<span class="token3">]</span>  包含 ICAP 支持。 <span class="token1">--</span>with<span class="token1">-</span>ircg<span class="token1">-</span>config  ircg<span class="token1">-</span>config 脚本的路径。 <span class="token1">--</span>with<span class="token1">-</span>ircg  包含 ircg 支持。 <span class="token1">--</span>enable<span class="token1">-</span>mailparse  包含 mailparse 支持。 <span class="token1">--</span>with<span class="token1">-</span>muscat<span class="token3">[</span><span class="token1">=</span>DIR<span class="token3">]</span>  包含 muscat 支持。 <span class="token1">--</span>with<span class="token1">-</span>satellite<span class="token3">[</span><span class="token1">=</span>DIR<span class="token3">]</span>  激活通过 Satellite(试验性质)的 CORBA 支持。DIR 是 ORBit 的主目录。 <span class="token1">--</span>enable<span class="token1">-</span>trans<span class="token1">-</span>sid  激活透明的 session id 传播。 <span class="token1">--</span>with<span class="token1">-</span>regex<span class="token3">[</span><span class="token1">=</span>TYPE<span class="token3">]</span>  使用系统 regex 库(不赞成)。 <span class="token1">--</span>with<span class="token1">-</span>vpopmail<span class="token3">[</span><span class="token1">=</span>DIR<span class="token3">]</span>  包含 vpopmail 支持。 <span class="token1">--</span>with<span class="token1">-</span>tsrm<span class="token1">-</span>pthreads  使用 POSIX 线程(默认值)。 <span class="token1">--</span>enable<span class="token1">-</span>shared<span class="token3">[</span><span class="token1">=</span>PKGS<span class="token3">]</span>  编译共享库 <span class="token3">[</span>default<span class="token1">=</span>yes<span class="token3">]</span>。 <span class="token1">--</span>enable<span class="token1">-</span>static<span class="token3">[</span><span class="token1">=</span>PKGS<span class="token3">]</span>  编译静态库 <span class="token3">[</span>default<span class="token1">=</span>yes<span class="token3">]</span>。 <span class="token1">--</span>enable<span class="token1">-</span>fast<span class="token1">-</span>install<span class="token3">[</span><span class="token1">=</span>PKGS<span class="token3">]</span>  为快速安装而优化 <span class="token3">[</span>default<span class="token1">=</span>yes<span class="token3">]</span>。 <span class="token1">--</span>with<span class="token1">-</span>gnu<span class="token1">-</span>ld  假定 C 编译器使用 GNU ld <span class="token3">[</span>default<span class="token1">=</span>no<span class="token3">]</span>。 <span class="token1">--</span>disable<span class="token1">-</span>libtool<span class="token1">-</span>lock  避免锁死(可能会破坏并行编译)。 <span class="token1">--</span>with<span class="token1">-</span>pic  尝试只使用 PIC<span class="token1">/</span>non<span class="token1">-</span>PIC 对象 <span class="token3">[</span>default<span class="token1">=</span>use both<span class="token3">]</span>。 <span class="token1">--</span>enable<span class="token1">-</span>memory<span class="token1">-</span>limit  编译时加入内存限制支持。 <span class="token1">--</span>disable<span class="token1">-</span>url<span class="token1">-</span>fopen<span class="token1">-</span>wrapper  禁止通过 URL 的 fopen wrapper,不能通过 HTTP 或 FTP 访问文件。 <span class="token1">--</span>enable<span class="token1">-</span>versioning  仅输出所需要的符号。更多信息见 INSTALL 文件。 <span class="token1">--</span>with<span class="token1">-</span>imsp<span class="token3">[</span><span class="token1">=</span>DIR<span class="token3">]</span>  包含 IMSp 支持(DIR 是 IMSP 的 include 目录和 libimsp<span class="token3">.</span>a 目录)。仅用于 PHP <span class="token6">3</span>! <span class="token1">--</span>with<span class="token1">-</span>mck<span class="token3">[</span><span class="token1">=</span>DIR<span class="token3">]</span>  包含 Cybercash MCK 支持。DIR 是 cybercash mck 编译目录,默认为<span class="token1">/</span>usr<span class="token1">/</span>src<span class="token1">/</span>mck<span class="token1">-</span><span class="token6">3.2</span><span class="token6">.0</span><span class="token6">.3</span><span class="token1">-</span>Linux。帮助见 extra<span class="token1">/</span>cyberlib。仅用于 PHP <span class="token6">3</span>! <span class="token1">--</span>with<span class="token1">-</span>mod<span class="token1">-</span>dav<span class="token1">=</span>DIR  包含通过 Apache 的 mod_dav 的 DAV 支持。DIR 是 mod_dav 的安装目录(仅用于 Apache模块版本!)仅用于 PHP <span class="token6">3</span>! <span class="token1">--</span>enable<span class="token1">-</span>debugger  编译入远程调试函数。仅用于 PHP <span class="token6">3</span>! <span class="token1">--</span>enable<span class="token1">-</span>versioning  利用 Solaris <span class="token6">2.</span>x 和 Linux 提供的版本控制与作用范围的优势。仅用于 PHP <span class="token6">3</span>! PHP 选项 <span class="token1">--</span>enable<span class="token1">-</span>maintainer<span class="token1">-</span>mode  激活将编译规则和未使用的(以及一些混淆的)依赖文件放入临时安装中。 <span class="token1">--</span>with<span class="token1">-</span>config<span class="token1">-</span>file<span class="token1">-</span>path<span class="token1">=</span>PATH  设定php<span class="token3">.</span>ini 所在的路径,默认为PREFIX<span class="token1">/</span>lib。 <span class="token1">--</span>enable<span class="token1">-</span>safe<span class="token1">-</span>mode  默认激活安全模式。 <span class="token1">--</span>with<span class="token1">-</span>exec<span class="token1">-</span>dir<span class="token3">[</span><span class="token1">=</span>DIR<span class="token3">]</span>  安全模式下只允许此目录下执行程序。默认为<span class="token1">/</span>usr<span class="token1">/</span>local<span class="token1">/</span>php<span class="token1">/</span>bin。 <span class="token1">--</span>enable<span class="token1">-</span>magic<span class="token1">-</span>quotes  默认激活 magic quotes。 <span class="token1">--</span>disable<span class="token1">-</span>short<span class="token1">-</span>tags  默认禁止简写的 PHP 开始标记 <span class="token1"><</span><span class="token1">?</span>。 服务器选项 <span class="token1">--</span>with<span class="token1">-</span>aolserver<span class="token1">=</span>DIR  指定已安装的 AOLserver 的路径。 <span class="token1">--</span>with<span class="token1">-</span>apxs<span class="token3">[</span><span class="token1">=</span>FILE<span class="token3">]</span>  编译共享 Apache 模块。FILE 是可选的 Apache 的 apxs 工具的路径,默认为 apxs。确保指定的 apxs版本是安装后的文件而不是 Apache 源程序中包中的。 <span class="token1">--</span>with<span class="token1">-</span>apache<span class="token3">[</span><span class="token1">=</span>DIR<span class="token3">]</span>  编译Apache 模块。DIR是 Apache 源程序的最高一级目录。默认为<span class="token1">/</span>usr<span class="token1">/</span>local<span class="token1">/</span>apache。 <span class="token1">--</span>with<span class="token1">-</span>mod_charset  激活 mod_charset 中的传递表(Apache 中)。 <span class="token1">--</span>with<span class="token1">-</span>apxs2<span class="token3">[</span><span class="token1">=</span>FILE<span class="token3">]</span>  编译共享的Apache <span class="token6">2.0</span> 模块。FILE是可选的 Apache 的apxs 工具的路径,默认为apxs。 <span class="token1">--</span>with<span class="token1">-</span>fhttpd<span class="token3">[</span><span class="token1">=</span>DIR<span class="token3">]</span>  编译 fhttpd 模块。DIR 是 fhttpd 的源代码路径,默认为 <span class="token1">/</span>usr<span class="token1">/</span>local<span class="token1">/</span>src<span class="token1">/</span>fhttpd。 <span class="token1">--</span>with<span class="token1">-</span>isapi<span class="token1">=</span>DIR  将 PHP 编译为 ISAPI 模块用于 Zeus。 <span class="token1">--</span>with<span class="token1">-</span>nsapi<span class="token1">=</span>DIR  指定已安装的 Netscape 服务器路径。 <span class="token1">--</span>with<span class="token1">-</span>phttpd<span class="token1">=</span>DIR <span class="token1">--</span>with<span class="token1">-</span>pi3web<span class="token1">=</span>DIR  将 PHP 编译为用于 Pi3Web 的模块。 <span class="token1">--</span>with<span class="token1">-</span>roxen<span class="token1">=</span>DIR  将 PHP 编译为一个 Pike 模块。DIR 是 Roxen 的根目录,通常为<span class="token1">/</span>usr<span class="token1">/</span>local<span class="token1">/</span>roxen<span class="token1">/</span>server。 <span class="token1">--</span>enable<span class="token1">-</span>roxen<span class="token1">-</span>zts  编译 Roxen 模块,使用 Zend Thread Safety。 <span class="token1">--</span>with<span class="token1">-</span>servlet<span class="token3">[</span><span class="token1">=</span>DIR<span class="token3">]</span>  包含 servlet 支持。DIR 是 JSDK 的基本安装目录。本 SAPI 需要 Java 扩展必须被编译为共享的dl。 <span class="token1">--</span>with<span class="token1">-</span>thttpd<span class="token1">=</span>SRCDIR  将 PHP 编译为 thttpd 模块。 <span class="token1">--</span>with<span class="token1">-</span>tux<span class="token1">=</span>MODULEDIR  将 PHP 编译为 TUX 模块(仅用于 Linux)。 ``` ``` \*\* 配置fpm的用户组和用户,以及安装其他扩展\*\* ``` <pre class="calibre10">``` <span class="token3">.</span><span class="token1">/</span>configure <span class="token1">--</span>prefix<span class="token1">=</span><span class="token1">/</span>usr<span class="token1">/</span>local<span class="token1">/</span>php <span class="token1">--</span>enable<span class="token1">-</span>fpm <span class="token1">--</span>with<span class="token1">-</span>fpm<span class="token1">-</span>user<span class="token1">=</span>www <span class="token1">--</span>with<span class="token1">-</span>fpm<span class="token1">-</span>group<span class="token1">=</span>www <span class="token1">--</span>enable<span class="token1">-</span>mysqlnd <span class="token1">--</span>with<span class="token1">-</span>mysqli<span class="token1">=</span>mysqlnd <span class="token1">--</span>with<span class="token1">-</span>pdo<span class="token1">-</span>mysql<span class="token1">=</span>mysqlnd <span class="token1">--</span>enable<span class="token1">-</span>mysqlnd<span class="token1">-</span>compression<span class="token1">-</span>support <span class="token1">--</span>with<span class="token1">-</span>iconv<span class="token1">-</span>dir <span class="token1">--</span>with<span class="token1">-</span>freetype<span class="token1">-</span>dir <span class="token1">--</span>with<span class="token1">-</span>jpeg<span class="token1">-</span>dir <span class="token1">--</span>with<span class="token1">-</span>png<span class="token1">-</span>dir <span class="token1">--</span>with<span class="token1">-</span>zlib <span class="token1">--</span>with<span class="token1">-</span>libxml<span class="token1">-</span>dir <span class="token1">--</span>enable<span class="token1">-</span>xml <span class="token1">--</span>disable<span class="token1">-</span>rpath <span class="token1">--</span>enable<span class="token1">-</span>bcmath <span class="token1">--</span>enable<span class="token1">-</span>shmop <span class="token1">--</span>enable<span class="token1">-</span>sysvsem <span class="token1">--</span>enable<span class="token1">-</span>inline<span class="token1">-</span>optimization <span class="token1">--</span>with<span class="token1">-</span>curl <span class="token1">--</span>enable<span class="token1">-</span>mbregex <span class="token1">--</span>enable<span class="token1">-</span>mbstring <span class="token1">--</span>enable<span class="token1">-</span>intl <span class="token1">--</span>with<span class="token1">-</span>mcrypt <span class="token1">--</span>with<span class="token1">-</span>libmbfl <span class="token1">--</span>enable<span class="token1">-</span>ftp <span class="token1">--</span>with<span class="token1">-</span>gd <span class="token1">--</span>enable<span class="token1">-</span>gd<span class="token1">-</span>jis<span class="token1">-</span>conv <span class="token1">--</span>enable<span class="token1">-</span>gd<span class="token1">-</span>native<span class="token1">-</span>ttf <span class="token1">--</span>with<span class="token1">-</span>openssl <span class="token1">--</span>with<span class="token1">-</span>mhash <span class="token1">--</span>enable<span class="token1">-</span>pcntl <span class="token1">--</span>enable<span class="token1">-</span>sockets <span class="token1">--</span>with<span class="token1">-</span>xmlrpc <span class="token1">--</span>enable<span class="token1">-</span>zip <span class="token1">--</span>enable<span class="token1">-</span>soap <span class="token1">--</span>with<span class="token1">-</span>gettext <span class="token1">--</span>disable<span class="token1">-</span>fileinfo <span class="token1">--</span>enable<span class="token1">-</span>opcache <span class="token1">--</span>with<span class="token1">-</span>pear <span class="token1">--</span>enable<span class="token1">-</span>maintainer<span class="token1">-</span>zts <span class="token1">--</span>with<span class="token1">-</span>ldap<span class="token1">=</span>shared <span class="token1">--</span>without<span class="token1">-</span>gdbm ``` ``` 开始检查依赖,做编译安前的准备 ![](https://img.kancloud.cn/e4/2b/e42b8c988a1f175ecce8b844d806f4b3_752x398.png) **一般都会有错误:** **错误一:** ![](https://img.kancloud.cn/64/29/642914b5bcedf14a1a42c70bad8040af_733x90.png) \*\* 解决方法:缺了这个sqlite3这个包,我们就安装它\*\* ``` <pre class="calibre10">``` yum install sqlite<span class="token1">-</span>devel ``` ``` ![](https://img.kancloud.cn/57/18/571885a2a9e08fe9c45fed884cbdd362_974x304.png) **错误二:** ![](https://img.kancloud.cn/5e/01/5e013e8c1cc88b39d3f16aa9b3251bbc_645x115.png) \*\* 解决方法:它说没有找到这个文件夹,我们就给它一个\*\* ``` <pre class="calibre10">``` cp <span class="token1">-</span>frp <span class="token1">/</span>usr<span class="token1">/</span>lib64<span class="token1">/</span>libldap<span class="token1">*</span> <span class="token1">/</span>usr<span class="token1">/</span>lib<span class="token1">/</span> ``` ``` **错误三:** ![](https://img.kancloud.cn/39/95/39954211ef347d7c1d545b6523c3edd4_767x139.png) **解决方法:缺了这个oniguruma这个包,我们就安装它** ``` <pre class="calibre10">``` yum install oniguruma ``` ``` ![](https://img.kancloud.cn/2a/7c/2a7c7c52ed0b77995353ea8fd67f00a8_789x403.png) 结果不行,去查看了官方更新日志 发现mbsting 需要oniguruma6.9.4 [git的基本用户和实例,git与github的区别](https://www.cnblogs.com/alliancehacker/p/12285486.html) ``` <pre class="calibre10">``` #从github中下载源码 git clone https<span class="token3">:</span><span class="token1">/</span><span class="token1">/</span>github<span class="token3">.</span>com<span class="token1">/</span>kkos<span class="token1">/</span>oniguruma ``` ``` ![](https://img.kancloud.cn/e8/20/e820f9593e1fd0c3c497d96dd9cb37d7_733x145.png) ``` <pre class="calibre10">``` 官方安装步骤 possibly undefined macro<span class="token3">:</span> AM_INIT_AUTOMAKE 需要先 #autoreconf install #要删除之前安的 yum remove onigurma<span class="token1">*</span> cd oniguruma<span class="token1">/</span> autoreconf <span class="token1">-</span>vfi <span class="token3">.</span><span class="token1">/</span>configure make make install ``` ``` ![](https://img.kancloud.cn/2b/70/2b70f376450d3c9c94169f803c2b4040_679x307.png) **运行./configure,直接出现下图** ![](https://img.kancloud.cn/b5/e5/b5e58465a679246cf054cabbaec9c4ab_539x531.png) ### 编译安装(安装要花一点时间) ``` <pre class="calibre10">``` make <span class="token1">&&</span> make install ``` ``` ![](https://img.kancloud.cn/65/66/65660bb3932778a01ea378df53898984_915x678.png) **映射全局命令** ``` <pre class="calibre10">``` ln <span class="token1">-</span>s <span class="token1">/</span>usr<span class="token1">/</span>local<span class="token1">/</span>php<span class="token1">/</span>sbin<span class="token">/* /usr/local/sbin/ ln -s /usr/local/php/bin/* /usr/local/bin/ </span> ``` ``` **输入 php -v ,出现下图,这就安装成功了** ![](https://img.kancloud.cn/86/1e/861ebbb63e6a9ef69ede28a9058fb39e_599x91.png) **删除php7.4** ``` <pre class="calibre10">``` rm <span class="token1">-</span>rf <span class="token1">/</span>usr<span class="token1">/</span>local<span class="token1">/</span>php <span class="token1">/</span>bin<span class="token1">/</span>php <span class="token1">/</span>usr<span class="token1">/</span>local<span class="token1">/</span>sbin<span class="token1">/</span>php<span class="token1">-</span>fpm <span class="token1">/</span>usr<span class="token1">/</span>local<span class="token1">/</span>bin<span class="token1">/</span>php <span class="token1">/</span>usr<span class="token1">/</span>local<span class="token1">/</span>bin<span class="token1">/</span>pear <span class="token1">/</span>usr<span class="token1">/</span>local<span class="token1">/</span>bin<span class="token1">/</span>peardev <span class="token1">/</span>usr<span class="token1">/</span>local<span class="token1">/</span>bin<span class="token1">/</span>pecl <span class="token1">/</span>usr<span class="token1">/</span>local<span class="token1">/</span>bin<span class="token1">/</span>phar <span class="token1">/</span>usr<span class="token1">/</span>local<span class="token1">/</span>bin<span class="token1">/</span>phar<span class="token3">.</span>phar <span class="token1">/</span>usr<span class="token1">/</span>local<span class="token1">/</span>bin<span class="token1">/</span>php<span class="token1">-</span>cgi <span class="token1">/</span>usr<span class="token1">/</span>local<span class="token1">/</span>bin<span class="token1">/</span>php<span class="token1">-</span>config <span class="token1">/</span>usr<span class="token1">/</span>local<span class="token1">/</span>bin<span class="token1">/</span>phpdbg <span class="token1">/</span>usr<span class="token1">/</span>local<span class="token1">/</span>bin<span class="token1">/</span>phpize ``` ``` ## 3.LNMP(一键安装包)仅安装(php7.4) **参考网站** <https://lnmp.org/> 出官网找到有php7.4的版本,是lnmp1.7才开始支持php7.4,但不是稳定版,如果是用于生产环境还是建议用稳的版本 ``` <pre class="calibre10">``` wget http<span class="token3">:</span><span class="token1">/</span><span class="token1">/</span>soft<span class="token3">.</span>vpser<span class="token3">.</span>net<span class="token1">/</span>lnmp<span class="token1">/</span>lnmp1<span class="token3">.</span><span class="token6">7</span>beta<span class="token3">.</span>tar<span class="token3">.</span>gz # 解压 tar <span class="token1">-</span>zxvf lnmp1<span class="token3">.</span><span class="token6">7</span>beta<span class="token3">.</span>tar<span class="token3">.</span>gz cd lnmp1<span class="token3">.</span><span class="token6">7</span> <span class="token3">.</span><span class="token1">/</span>install<span class="token3">.</span>sh ``` ``` ![](https://img.kancloud.cn/30/0d/300db3573a8e7d59ea46c8bc559f5abe_778x459.png) **输入0,不安装DataBase(数据库)** ![](https://img.kancloud.cn/91/a0/91a0d0a99cd88cba6feb7d17826376d9_566x288.png) 输入10,安装php7.4这个版本 ![](https://img.kancloud.cn/45/1c/451cc862645b32c9e21aa3e15ecddb30_549x114.png) \*\* 可以选择不安装、Jemalloc或TCmalloc,输入对应序号回车,直接回车为默认为不安装\*\* ![](https://img.kancloud.cn/9a/a7/9aa71a8cfcd81777018ced6340d5a432_544x44.png) 脚本会自动下载安装php7.4 ![](https://img.kancloud.cn/88/ac/88aca372b9b8e83950ec65c20ec7192a_621x604.png) **LNMP相关软件安装目录** ``` <pre class="calibre10">``` Nginx 目录<span class="token3">:</span> <span class="token1">/</span>usr<span class="token1">/</span>local<span class="token1">/</span>nginx<span class="token1">/</span> MySQL 目录 <span class="token3">:</span> <span class="token1">/</span>usr<span class="token1">/</span>local<span class="token1">/</span>mysql<span class="token1">/</span> MySQL数据库所在目录:<span class="token1">/</span>usr<span class="token1">/</span>local<span class="token1">/</span>mysql<span class="token1">/</span>var<span class="token1">/</span> MariaDB 目录 <span class="token3">:</span> <span class="token1">/</span>usr<span class="token1">/</span>local<span class="token1">/</span>mariadb<span class="token1">/</span> MariaDB数据库所在目录:<span class="token1">/</span>usr<span class="token1">/</span>local<span class="token1">/</span>mariadb<span class="token1">/</span>var<span class="token1">/</span> PHP目录 <span class="token3">:</span> <span class="token1">/</span>usr<span class="token1">/</span>local<span class="token1">/</span>php<span class="token1">/</span> 多PHP版本目录 <span class="token3">:</span> <span class="token1">/</span>usr<span class="token1">/</span>local<span class="token1">/</span>php5<span class="token3">.</span><span class="token6">5</span><span class="token1">/</span> 其他版本前面<span class="token6">5.5</span>的版本号换成其他即可 PHPMyAdmin目录 <span class="token3">:</span> <span class="token6">0.9</span>版本为<span class="token1">/</span>home<span class="token1">/</span>wwwroot<span class="token1">/</span>phpmyadmin<span class="token1">/</span> <span class="token6">1.0</span>及以后版本为 <span class="token1">/</span>home<span class="token1">/</span>wwwroot<span class="token1">/</span>default<span class="token1">/</span>phpmyadmin<span class="token1">/</span> 强烈建议将此目录重命名为其不容易猜到的名字。phpmyadmin可自己从官网下载新版替换。 默认网站目录 <span class="token3">:</span> <span class="token6">0.9</span>版本为 <span class="token1">/</span>home<span class="token1">/</span>wwwroot<span class="token1">/</span> <span class="token6">1.0</span>及以后版本为 <span class="token1">/</span>home<span class="token1">/</span>wwwroot<span class="token1">/</span>default<span class="token1">/</span> Nginx日志目录:<span class="token1">/</span>home<span class="token1">/</span>wwwlogs<span class="token1">/</span> <span class="token1">/</span>root<span class="token1">/</span>vhost<span class="token3">.</span>sh添加的虚拟主机配置文件所在目录:<span class="token1">/</span>usr<span class="token1">/</span>local<span class="token1">/</span>nginx<span class="token1">/</span>conf<span class="token1">/</span>vhost<span class="token1">/</span> PureFtpd 目录:<span class="token1">/</span>usr<span class="token1">/</span>local<span class="token1">/</span>pureftpd<span class="token1">/</span> PureFtpd web管理目录: <span class="token6">0.9</span>版为<span class="token1">/</span>home<span class="token1">/</span>wwwroot<span class="token1">/</span>default<span class="token1">/</span>ftp<span class="token1">/</span> <span class="token6">1.0</span>版为 <span class="token1">/</span>home<span class="token1">/</span>wwwroot<span class="token1">/</span>default<span class="token1">/</span>ftp<span class="token1">/</span> Proftpd 目录:<span class="token1">/</span>usr<span class="token1">/</span>local<span class="token1">/</span>proftpd<span class="token1">/</span> Redis 目录:<span class="token1">/</span>usr<span class="token1">/</span>local<span class="token1">/</span>redis<span class="token1">/</span> ``` ``` **LNMP相关配置文件位置** ``` <pre class="calibre10">``` Nginx主配置<span class="token3">(</span>默认虚拟主机<span class="token3">)</span>文件:<span class="token1">/</span>usr<span class="token1">/</span>local<span class="token1">/</span>nginx<span class="token1">/</span>conf<span class="token1">/</span>nginx<span class="token3">.</span>conf 添加的虚拟主机配置文件:<span class="token1">/</span>usr<span class="token1">/</span>local<span class="token1">/</span>nginx<span class="token1">/</span>conf<span class="token1">/</span>vhost<span class="token1">/</span>域名<span class="token3">.</span>conf MySQL配置文件:<span class="token1">/</span>etc<span class="token1">/</span>my<span class="token3">.</span>cnf PHP配置文件:<span class="token1">/</span>usr<span class="token1">/</span>local<span class="token1">/</span>php<span class="token1">/</span>etc<span class="token1">/</span>php<span class="token3">.</span>ini php<span class="token1">-</span>fpm配置文件:<span class="token1">/</span>usr<span class="token1">/</span>local<span class="token1">/</span>php<span class="token1">/</span>etc<span class="token1">/</span>php<span class="token1">-</span>fpm<span class="token3">.</span>conf PureFtpd配置文件:<span class="token1">/</span>usr<span class="token1">/</span>local<span class="token1">/</span>pureftpd<span class="token1">/</span>pure<span class="token1">-</span>ftpd<span class="token3">.</span>conf <span class="token6">1.3</span>及更高版本:<span class="token1">/</span>usr<span class="token1">/</span>local<span class="token1">/</span>pureftpd<span class="token1">/</span>etc<span class="token1">/</span>pure<span class="token1">-</span>ftpd<span class="token3">.</span>conf PureFtpd MySQL配置文件:<span class="token1">/</span>usr<span class="token1">/</span>local<span class="token1">/</span>pureftpd<span class="token1">/</span>pureftpd<span class="token1">-</span>mysql<span class="token3">.</span>conf Proftpd配置文件:<span class="token1">/</span>usr<span class="token1">/</span>local<span class="token1">/</span>proftpd<span class="token1">/</span>etc<span class="token1">/</span>proftpd<span class="token3">.</span>conf <span class="token6">1.2</span>及之前版本为<span class="token1">/</span>usr<span class="token1">/</span>local<span class="token1">/</span>proftpd<span class="token1">/</span>proftpd<span class="token3">.</span>conf Proftpd 用户配置文件:<span class="token1">/</span>usr<span class="token1">/</span>local<span class="token1">/</span>proftpd<span class="token1">/</span>etc<span class="token1">/</span>vhost<span class="token1">/</span>用户名<span class="token3">.</span>conf Redis 配置文件:<span class="token1">/</span>usr<span class="token1">/</span>local<span class="token1">/</span>redis<span class="token1">/</span>etc<span class="token1">/</span>redis<span class="token3">.</span>conf ``` ``` **LNMPA相关目录文件位置** ``` <pre class="calibre10">``` Apache目录:<span class="token1">/</span>usr<span class="token1">/</span>local<span class="token1">/</span>apache<span class="token1">/</span> Apache配置文件:<span class="token1">/</span>usr<span class="token1">/</span>local<span class="token1">/</span>apache<span class="token1">/</span>conf<span class="token1">/</span>httpd<span class="token3">.</span>conf Apache虚拟主机配置文件目录:<span class="token1">/</span>usr<span class="token1">/</span>local<span class="token1">/</span>apache<span class="token1">/</span>conf<span class="token1">/</span>vhost<span class="token1">/</span> Apache默认虚拟主机配置文件:<span class="token1">/</span>usr<span class="token1">/</span>local<span class="token1">/</span>apache<span class="token1">/</span>conf<span class="token1">/</span>extra<span class="token1">/</span>httpd<span class="token1">-</span>vhosts<span class="token3">.</span>conf 虚拟主机配置文件名称:<span class="token1">/</span>usr<span class="token1">/</span>local<span class="token1">/</span>apache<span class="token1">/</span>conf<span class="token1">/</span>vhost<span class="token1">/</span>域名<span class="token3">.</span>conf ``` ``` **LNMP状态管理命令:** LNMP 1.2+状态管理: lnmp {start|stop|reload|restart|kill|status} LNMP 1.2+各个程序状态管理: lnmp {nginx|mysql|mariadb|php-fpm|pureftpd} {start|stop|reload|restart|kill|status} LNMP 1.1状态管理: /root/lnmp {start|stop|reload|restart|kill|status} Nginx状态管理:/etc/init.d/nginx {start|stop|reload|restart} MySQL状态管理:/etc/init.d/mysql {start|stop|restart|reload|force-reload|status} Memcached状态管理:/etc/init.d/memcached {start|stop|restart} PHP-FPM状态管理:/etc/init.d/php-fpm {start|stop|quit|restart|reload|logrotate} PureFTPd状态管理: /etc/init.d/pureftpd {start|stop|restart|kill|status} ProFTPd状态管理: /etc/init.d/proftpd {start|stop|restart|reload} Redis状态管理: /etc/init.d/redis {start|stop|restart|kill} 多PHP版本状态管理:/etc/init.d/php-fpm5.5 {start|stop|quit|restart|reload|logrotate} 前面5.5为对应的PHP版本,其他版本自行替换。 如重启LNMP,1.2+输入命令:lnmp restart 即可;单独重启mysql:/etc/init.d/mysql restart 也可以 lnmp mysql restart ,两个是一样的。 **LNMPA状态管理命令:** LNMPA 1.2+状态管理: lnmp {start|stop|reload|restart|kill|status} LNMPA 1.2+各个程序状态管理: lnmp {httpd|mysql|mariadb|pureftpd} {start|stop|reload|restart|kill|status} LNMPA1.1状态管理: /root/lnmpa {start|stop|reload|restart|kill|status} Nginx状态管理:/etc/init.d/nginx {start|stop|reload|restart} MySQL状态管理:/etc/init.d/mysql {start|stop|restart|reload|force-reload|status} Memcached状态管理:/etc/init.d/memcached {start|stop|restart} PureFTPd状态管理: /etc/init.d/pureftpd {start|stop|restart|kill|status} ProFTPd状态管理: /etc/init.d/proftpd {start|stop|restart|reload} Apache状态管理:/etc/init.d/httpd {start|stop|restart|graceful|graceful-stop|configtest|status} **LAMP状态管理命令:** LAMP 1.2+状态管理: lnmp {start|stop|reload|restart|kill|status} LAMP 1.2+各个程序状态管理: lnmp {httpd|mysql|mariadb|pureftpd} {start|stop|reload|restart|kill|status}