雨田博客

2024
雨田博客
首页 » 技术文档 » CENTOS 7 编译LAMP 经常遇到的问题

CENTOS 7 编译LAMP 经常遇到的问题

CENTOS 7 编译LAMP,许久没用电脑了,有些搞不明白了,话不多说,直接记录。

禁止apache显示目录索引的常见方法

修改Apache配置文件[httpd.conf]

搜索“Options Indexes FollowSymLinks”,修改为“Options -Indexes FollowSymLinks”即可。 在Options Indexes FollowSymLinks在Indexes前面加上 – 符号。备注:在Indexes前,加 + 代表允许目录浏览;加 – 代表禁止目录浏览。


php配置默认页


一、php配置默认页,在apache 安装目录下的 conf/httpd.conf 

<IfModule dir_module>
    DirectoryIndex index.html index.php index.htm l.php
</IfModule>

apache配置多站点:[warn] _default_ VirtualHost overlap on port 80, the first has precedence


配置多站点

配置文件端口修改为不同,ip加端口能够访问对应项目,配的二级域名无法访问对应的项目

多个配置文件端口都为80,域名不同,然后会出现问题:

[warn] _default_ VirtualHost overlap on port 80, the first has precedence
解决:

找到apache安装路径,找到httpd.conf文件

把 #NameVirtualHost *:80前的注释去掉

安装 php时 出现 make: *** [ext/dom/node.lo] Error

inux安装PHP ,make 的时候报错:

make: *** [ext/dom/node.lo] Error 1

解决办法:

$ curl -o php-5.2.17.patch https://mail.gnome.org/archives/xml/2012-August/txtbgxGXAvz4N.txt 
$ tar  
jxf php-5.2.17.tar.bz2  
$ cd php-5.2.17 $ patch -p0 -b <../php-5.2.17.patch  
patching file ext/dom/node.c 
patching file  
ext/dom/documenttype.c 
patching file ext/simplexml/simplexml.c

configure:error:libjpeg.(a|so) not found解决

在执行安装php的时候报了configure:error:libjpeg.(a|so) not found

[root@localhost php-5.2.17]# rpm -qa|grep libjpeg
libjpeg-turbo-1.2.90-6.el7.x86_64
libjpeg-turbo-devel-1.2.90-6.el7.x86_64

我已经安装了libjpeg
解决方法:

[root@localhost php-5.2.17]# cp -frp /usr/lib64/libjpeg.* /usr/lib

若报configure: error: libpng.(a|so) not found,处理方法同上。

[root@localhost php-5.2.17]# cp -frp /usr/lib64/libpng* /usr/lib/

php出现——configure: error: Please reinstall the libcurl distribution - easy.h should be ……...

configure: error: Please reinstall the libcurl distribution -
    easy.h should be in?/include/curl/

其实就是curl的dev包没有安装, 解决方案:
# yum -y install curl-devel

再重新编译OK。

    安装libiconv错误如下
    In file included from progname.c:26:0:
    ./stdio.h:1010:1: error: ‘gets’ undeclared here (not in a function)
    _GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
    ^
    make[2]: *** [progname.o] Error 1
    make[2]: Leaving directory `/usr/local/src/zabbix-2.4.7/libiconv-1.14/srclib'
    make[1]: *** [all] Error 2
    make[1]: Leaving directory `/usr/local/src/zabbix-2.4.7/libiconv-1.14/srclib'
    make: *** [all] Error 2

解决办法:
vi libiconv-1.14/srclib/stdio.in.h

将698行的代码:_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");替换为:

#if defined(__GLIBC__) && !defined(__UCLIBC__) && !__GLIBC_PREREQ(2, 16)
 _GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");#endif

configure: error: *** libmcrypt was not found解决方案

其实已经安装过libmcrypt了。依然报错。

解决方法如下
安装到mcrypt的时候出现了问题
./configure
提示出错,首先提示
*** Could not run libmcrypt test program, checking why…
*** The test program failed to compile or link. See the file config.log for the
*** exact error that occured. This usually means LIBMCRYPT was incorrectly installed
*** or that you have moved LIBMCRYPT since it was installed. In the latter case, you
*** may want to edit the libmcrypt-config script: no
configure: error: *** libmcrypt was not found
找了相关资料,得出解决方法明明我安装了libmcrypt 2.5.8 ,可是竟然提示没有发现!然后在/usr/local/bin/找到了LIBMCRYPT_CONFIG ,这一步明确了是PATH变量的问题 !
方法是ln -s   /usr/local/bin/libmcrypt_config   /usr/bin/libmcrypt_config
之后继续进行./configure
仍然报错:
*** Could not run libmcrypt test program, checking why…
*** The test program compiled, but did not run. This usually means
*** that the run-time linker is not finding LIBMCRYPT or finding the wrong
*** version of LIBMCRYPT. If it is not finding LIBMCRYPT, you’ll need to set your
*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point
*** to the installed location   Also, make sure you have run ldconfig if that
*** is required on your system
***
*** If you have an old version installed, it is best to remove it, although
*** you may also be able to get things to work by modifying LD_LIBRARY_PATH
***
configure: error: *** libmcrypt was not found
 
继续查找,还是变量的问题
解决方法如下:运行 export LD_LIBRARY_PATH=/usr/local/lib: LD_LIBRARY_PATH
然后make ; make install
完成

文章如无特别注明均为原创! 作者: cache, 转载或复制请以 超链接形式 并注明出处 雨田博客
原文地址《 CENTOS 7 编译LAMP 经常遇到的问题》发布于2022年11月24日

分享到:
打赏

评论

游客

看不清楚?点图切换