分享知识 传递快乐

由于之前写过Windows整合方式,有很多相同的地方,在此就不过多重复写了,参考下面几篇文章就够用了。

Win7整合WNMP(Linux整合LNMP(Centos7.4+Nginx+PHP+MariaDB))

Nginx安装注意事项

Linux安装MariaDB(超详细的yum安装、二进制安装)

Nginx和MariaDB配置还是很顺利,但在配置PHP时出了不少幺蛾子;下面记录一下本人遇到的问题。

1、官网下载PHP二进制包

PHP 5.2.25:https://www.php.net/releases/

文件名:php-5.2.15.tar.gz

2、解压tar.gz文件到指定目录下

[root@localhost ~]# mkdir /opt/mariadb
[root@localhost ~]# tar -zxvf php-5.2.15.tar.gz -C /opt/lnmp/bin/php/5.5.12

3、配置

1)配置

[root@localhost 5.5.12]# ./configure --prefix=/opt/lnmp/bin/php/5.5.12 --with-config-file-path=/opt/lnmp/bin/php/5.5.12/etc --enable-inline-optimization --disable-debug --enable-fpm --with-fpm-user=www --with-fpm-group=www --disable-rpath --enable-soap --with-libxml-dir --with-xmlrpc --with-openssl  --with-mhash --with-pcre-regex --with-zlib --enable-bcmath --with-bz2 --enable-calendar --with-curl --enable-exif --with-pcre-dir --enable-ftp --with-gd --with-openssl-dir --with-jpeg-dir --with-png-dir --with-zlib-dir --with-freetype-dir --enable-gd-jis-conv --with-gettext --with-gmp --with-mhash --enable-mbstring --with-onig --enable-shared --enable-opcache --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-readline --with-iconv --enable-pcntl --enable-shmop --enable-sysvmsg --enable-sysvsem --enable-sysvshm --enable-sockets  --enable-zip --enable-wddx --with-pear 

2)编译安装

[root@localhost 5.5.12]# make
[root@localhost 5.5.12]# make install

或者

[root@localhost 5.5.12]# make && make install

附:

还可以使用一条命令操作全部:配置编译安装

[root@localhost 5.5.12]# ./configure --prefix=/opt/lnmp/bin/php/5.5.12 --with-config-file-path=/opt/lnmp/bin/php/5.5.12/etc --enable-inline-optimization --disable-debug --enable-fpm --with-fpm-user=www --with-fpm-group=www --disable-rpath --enable-soap --with-libxml-dir --with-xmlrpc --with-openssl  --with-mhash --with-pcre-regex --with-zlib --enable-bcmath --with-bz2 --enable-calendar --with-curl --enable-exif --with-pcre-dir --enable-ftp --with-gd --with-openssl-dir --with-jpeg-dir --with-png-dir --with-zlib-dir --with-freetype-dir --enable-gd-jis-conv --with-gettext --with-gmp --with-mhash --enable-mbstring --with-onig --enable-shared --enable-opcache --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-readline --with-iconv --enable-pcntl --enable-shmop --enable-sysvmsg --enable-sysvsem --enable-sysvshm --enable-sockets  --enable-zip --enable-wddx --with-pear && make && make install

如果在编译安装时出现异常请参考命令结束的最后一行,根据反馈的信息来判断系统缺少哪些依赖文件。在文章最下面提供一些常见的PHP编译时返回error解决方法。

4、启动

编译安装成功后会在php的安装目录下生成一个sbin的文件夹,通过php-fpm来启动PHP:

[root@localhost 5.5.12]# cd sbin/
[root@localhost sbin]# ./php-fpm
[06-Jan-2020 20:57:05] ERROR: failed to open configuration file '/opt/lnmp/bin/php/5.5.12/etc/php-fpm.conf': No such file or directory (2)
[06-Jan-2020 20:57:05] ERROR: failed to load configuration file '/opt/lnmp/bin/php/5.5.12/etc/php-fpm.conf'
[06-Jan-2020 20:57:05] ERROR: FPM initialization failed

在启动出现了异常,提示找不到php-fpm.conf文件。

解决方法:

进入php的配置目录

[root@localhost etc]# cd etc/
[root@localhost etc]# cp php-fpm.conf.default php-fpm.conf
[root@localhost etc]# vim php-fpm.conf

打开 php-fpm.conf 文件中以下配置:

pid = run/php-fpm.pid

打开后,保存即可。

5、查看状态

[root@localhost 5.5.12]# ps -ef | grep php-fpm

6、停止

[root@localhost 5.5.12]# killall -9 php-fpm

PHP编译时返回error解决方法:

1)Configure: error: xml2-config not found. Please check your libxml2 installation.

[root@localhost 5.5.12]# yum install libxml2 libxml2-devel

2)Configure: error: Please reinstall the BZip2 distribution

[root@localhost 5.5.12]# yum install bzip2 bzip2-devel

3)Configure: error: Please reinstall the libcurl distribution-easy.h should be in <curl-dir>/include/curl/.

[root@localhost 5.5.12]# yum install curl curl-devel

4)Configure: error: libjpeg.(also) not found.

[root@localhost 5.5.12]# yum install libjpeg libjpeg-devel

5)Configure: error: libpng.(also) not found.

[root@localhost 5.5.12]# yum install libpng libpng-devel

6)Configure: error: mcrypt.h not found. Please reinstall libmcrypt.

[root@localhost 5.5.12]# yum install libmcrypt libmcrypt-devel
[root@localhost 5.5.12]# yum install -y epel-release
[root@localhost 5.5.12]# yum install -y libmcrypt-devel

7)Configure: error: Please reinstall libmhash – I cannot find mhash.h.

[root@localhost 5.5.12]# yum install mhash-devel

8)Configure: error: jpeglib.h not found.

[root@localhost 5.5.12]# yum -y install libjpeg-devel

9)./sbin/php-fpm: error while loading shared libraries: libjpeg.so.62: cannot open shared object file: No such file or directory

[root@contos7 shell]# yum install libjpeg*

——————————
如有不足请留言指正
相互学习,共同进步

Linux整合LNMP(Centos7.4+Nginx+PHP+MariaDB)相关推荐

  1. Centos7 编译安装 Nginx、MariaDB、PHP

    前言 本文主要大致介绍CentOS 7下编译安装Nginx.MariaDB.PHP.面向有Linux基础且爱好钻研的朋友.技艺不精,疏漏再所难免,还望指正. 环境简介: 系统: CentOS 7,最小 ...

  2. CentOS7 下配置 Nginx + PHP7 + MariaDB + ThinkPHP5.1

    最近突然想学习一下使用一些比较成熟的后台框架,考虑到之前帮大佬打下手的时候用过 ThinkPHP 所以就暂定了以 ThinkPHP 为主要学习目标. 下面是我在服务器端配置 Thinkphp 所需环境 ...

  3. CentOS7.3 安装配置 Nginx、MariaDB、PHP

    CentOS7.3 安装配置 Nginx.MariaDB.PHP 配置 nginx 安装参数并安装 配置 以下参数也可以在后期通过配置 conf 文件进行配置 基本配置如下 ./configure - ...

  4. 新装linux系统(centOs7)使用nginx驱动vue项目

    新装linux系统(centOs7)使用nginx驱动vue项目 配置linux环境 centos安装nginx 安装nginx前首先要确认系统中安装了gcc.pcre-devel.zlib-deve ...

  5. Linux之LNMP离线安装

    一.需求说明   LNMP一键安装包对于小型系统部署来说真的是非常方便,日常工作中除了在线安装,也存在部分场景要求离线安装.比如内网专网.严格限制访问外网的网络等,有些院校的实验室就是这种情况,需要使 ...

  6. 亚马逊AWS EC2云实例AMI安装LNMP环境(1)——Nginx安装

    概括:这里选择亚马逊EC2的Linux AMI实例,该Linux服务器是亚马逊预配置的Linux环境,内置多个YUM源,属于亚马逊首推的稳定Linux服务器.默认登录用户名为ec2-user,执行ro ...

  7. Linux 环境安装 Node、nginx、docker、vsftpd、gitlab

    Linux 环境安装 centos7 # 更新yum yum update -y 0. 防火墙 firewalld 新入的JD云服务器,发现防火墙默认是关闭的. # 查看防火墙状态 systemctl ...

  8. centos7根据端口查进程_记录一次CentOs7下Nginx+WSGI部署Django项目(超详细)

    记录一次Django部署的文章,不是很熟悉Linux系统,踩了不少坑,本篇文章相当于是一个总结,我会在本文中详细介绍,部署单个Django项目和多个Django的方法,如读者有更好的方法,欢迎留言一起 ...

  9. Centos7.4 yum 安装MariaDB

    Centos7.4 yum 安装MariaDB #系统及版本选择:https://downloads.mariadb.org/mariadb/repositories/#mirror=tuna vim ...

最新文章

  1. 【物联网中间件平台-01】真正面向物联网的组态软件 YFIOs和YFHMI的前生今世
  2. numpy逻辑运算符
  3. 七、【SAP-PM模块】信息系统 报表分析
  4. 《php中文网教学管理系统》总结
  5. 1400协议是什么和28181区别_公安三所标准 跟GB28181标准 有什么 区别?
  6. Django contenttypes组件
  7. 如何监控impala的数据_impala数据库的函数
  8. 有哪些写给自己的句子?
  9. android删除未知字符,如何删除Android Studio中所有配置的未使用字符串资源?
  10. 用C#调用Matlab图像处理自制QQ游戏2D桌球瞄准器
  11. 开源备份工具duplicity支持阿里云OSS后端存储
  12. WITH AS 用法 (说实话,WITH AS还真是简单)
  13. 【论文阅读】Dense Passage Retrieval for Open-Domain Question Answering
  14. jQuery---动画
  15. 怎么样设置网站访问权限
  16. The Little Book of Semaphores 信号量小书 第六章 不那么经典的问题 6.3 狒狒穿越问题
  17. 君子之交+续篇+番外 txt全集
  18. 无头浏览器 html5定位,5.2 使用浏览器无头模式执行Selnium脚本
  19. 软件安全漏洞挖掘:Buffer_Overflow
  20. 爬虫08-验证码的处理

热门文章

  1. 全球测试服显示服务器维护,美服8小时维护,暴雪测试角色复制 ,怀旧服最新版本即将上线...
  2. PCA主成分分析原理与基础知识
  3. 三坐标测量仪测针选择和校准时,需注意的问题!!!
  4. Python3.6学习笔记总结4:错误处理、写文件、JSON、进程、线程
  5. 前车之鉴:我在数据科学职位面试中犯过的5个错误
  6. 宝塔(一):宝塔安装
  7. 腾讯云轻量应用服务器安装宝塔面板流程(图文教程)
  8. 内存的可靠性、可用性和诊断功能(内存RAS)
  9. VB Link 操作(DDE 会话)
  10. 无法安装或运行此应用程序。该应用程序要求首先在“全局程序集缓存(GAC)”中安装程序集stdole版本7.0.3300.0...