首页 > 系统相关 >Linux整合LNMP(Centos7.4+Nginx+PHP+MariaDB)

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

时间:2022-11-01 12:34:12浏览次数:75  
标签:enable 5.5 -- LNMP Nginx 12 MariaDB root php


分享知识 传递快乐

 

由于之前写过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*

 

 

 

 

 

 

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

标签:enable,5.5,--,LNMP,Nginx,12,MariaDB,root,php
From: https://blog.51cto.com/u_15856116/5813284

相关文章

  • nginx的upstream配置backup和check方法
    server{  listen         80;  server_name      ocean.xxxx;  access_log       /app/tengine_log/logs/oce......
  • nginx高并发优化之系统内核参数优化
    一、内核参数优化设置vi/etc/sysctl.conffs.file-max=655360net.ipv4.ip_forward=0net.ipv4.conf.default.rp_filter=1net.ipv4.conf.default.accept_source_route=......
  • 使用Docker一键搭建FastDFS+Nginx分布式文件服务器
    做过很多项目在图片上传上一直使用的是FastDFS,刚开始得知搭建一个这样的系统非常复杂,所以直接使用了淘淘商城的虚拟机。在后面的项目中,最终选择在在阿里云上自己搭建一个Fas......
  • nginx中的proxy_pass配置
    Nginx是最常用的反向代理工具之一,一个指令proxy_pass搞定反向代理,对于接口代理、负载均衡很是实用,但proxy_pass指令后面的参数很有讲究,通常一个/都可能引发一个血案。......
  • Linxu下如何查看一个服务/应用的所在位置和配置位置(以nginx为例)
    有时候我们需要查看某个程序的配置和运行目录以nginx为例1、看出进程ID -PID [root@www~]#ps-CnginxPIDTTYTIMECMD1113?00:00:00n......
  • Mariadb数据库备份与恢复
    Mariadb数据库备份的方式有两种:一是冷备,二是热备。一、数据库冷备:关闭状态下直接复制数据目录1、使用mysqladmin停止mysql   mysqladmin是一个执行管理操作的客户......
  • 关于nginx 一个服务器,多个站点的困惑?
    比如在nginx的html文件夹中,存在两个目录web1和web2http://xxxxx/web1http://xxxxx/web2如果使用localStorage来存储token,就会出现两个网站共享localStorage的情......
  • 配置Nginx遇到Active:inactive (dead)解决方法
    问题:●nginx.service-nginx-highperformancewebserverLoaded:loaded(/lib/systemd/system/nginx.service;enabled;vendorpreset:enabled)Acti......
  • SWPU2019 Web1(无列名注入、MariaDB)
    看到登录框,admin登录试试,无弱口令。注册新用户,发现admin无法注册,于是随便注册一个用户进入后,申请广告招商,发现有xss漏洞,但这题并不是考察xss。随便发布一个广告,看到url有i......
  • Nginx配置godaddy证书
    在阿里云上购买的证书下载直接上传服务器配置到Nginx就可以直接使用,但是godaddy的需要自己手动生成证书:1.在网站:https://www.myssl.cn/tools/create-csr.html上生成KEY及......