apache和 php遇到的报错

回复 收藏
本帖最后由 xie525767270 于 2016-5-25 12:50 编辑

1.启动apache前检查配置文件报错AddType requires at least two arguments...

解决方法:

AddType application/x-httpd-php .php 在.hph前加一个空格即可


2.apache编译出错 error: mod_deflate has been requested
configure 错误提示:
  checking whether to enable mod_deflate... configure: error: mod_deflate has been requested but can not be built due to prerequisite failures
  解决方法:
  yum install -y gcc
  yum install -y zlib-devel
      yum install -y ​openssl-devel

3.Apache报错error while loading shared libraries: libexpat.so.0: can
解决方法:
1.在/etc/ld.so.conf中加入libexpat.so.0所在的目录。
​ (一般而言,很多so在/usr/local/lib,usr/lib,/lib这三个目录下)
2.将 /etc/ld.so.conf存档  :wq
3./sbin/ldconfig 更新文档。

1.PHP编译安装报错Sorry, I cannot run apxs.
解决方法:
根据英文提示我们可以看到如下几点:perl没有安装,指定正确的apxs路径
于是进行如下操作
​#yum install -y perl*
​#yum install -y httpd-devel
#find / -name apxs  得到的路径是:/usr/sbin/apxs
于是修改--with-apsx2=/usr/sbin/apxs指定到正确路径
最后正确执行

apxs在/usr/sbin/目录里面,修改正确路径就没有问题了
​ ./configure \
--prefix=/usr/local/php \
--with-apxs2=/usr/local/apache2/bin/apxs \   # 修改为“/usr/sbin/apxs"即可
--with-config-file-path=/usr/local/php/etc \
--with-mysql=/usr/local/mysql \
--with-libxml-dir \
--with-gd \
--with-jpeg-dir \
--with-png-dir \
--with-freetype-dir \
--with-iconv-dir \
--with-zlib-dir \
--with-bz2 \
--with-openssl \
--with-mcrypt \
--enable-soap \
--enable-gd-native-ttf \
--enable-mbstring \
--enable-sockets \
--enable-exif \
--disable-ipv6

2.PHP编译安装报错: mcrypt.h not found. Please reinstall libmcrypt
解决方法:
1.为系统安装perl-Geo-IP,默认yum源中没有这个包,特意安装epel第三方yum源[root@aminglinux ~] rpm -Uvh http://mirrors.sohu.com/fedora-epel/6/x86_64/epel-release-6-8.noarch.rpm
Retrieving http://mirrors.sohu.com/fedora-epel/6/x86_64/epel-release-6-8.noarch.rpm
warning: /var/tmp/rpm-tmp.BM4bHz: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
Preparing...                ########################################### [100%]   
1:epel-release           ########################################### [100%]
2.[root@aminglinux ~]#yum install -y libmcrypt-devel
[root@aminglinux ~]#Error: Cannot retrieve metalink for repository: epel. Please verify its path and try again​
这里我们又遇到一个错误,解决方法:
解决办法是编辑/etc/yum.repos.d/epel.repo,把基础的恢复,镜像的地址注释掉
#baseur
lmirrorlist
改成
baseurl
#mirrorlist
步骤如下:(蓝色为需修改的地方)
​ [root@aminglinux ~]# vi /etc/yum.repos.d/epel.repo
[epel]
name=Extra Packages for Enterprise Linux 6 - $basearch
baseurl=http://download.fedoraproject.org/pub/epel/6/$basearch
#mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=$basearch
failovermethod=priority
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
[epel-debuginfo]
name=Extra Packages for Enterprise Linux 6 - $basearch - Debug
baseurl=http://download.fedoraproject.org/pub/epel/6/$basearch/debug
#mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-debug-6&arch=$basearch
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
gpgcheck=1
​[epel-source]
name=Extra Packages for Enterprise Linux 6 - $basearch - Source
baseurl=http://download.fedoraproject.org/pub/epel/6/SRPMS
#mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-source-6&arch=$basearch
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
gpgcheck=1
修改完之后保存退出。​
3.再次运行​yum install -y libmcrypt-devel
Installed:libmcrypt-devel.i686 0:2.5.8-9.el6 #安装完成
4.​[root@aminglinux src]# cd php-5.3.27
    [root@localhost php-5.3.27]# ./configure \ --prefix=/usr/local/php \ --with-apxs2=/usr/sbin/apxs \ --with-config-file-path=/usr/local/php/etc \ --with-mysql=/usr/local/mysql \ --with-libxml-dir \ --with-gd \ --with-jpeg-dir \ --with-png-dir \ --with-freetype-dir \ --with-iconv-dir \ --with-zlib-dir \ --with-bz2 \ --with-openssl \ --with-mcrypt \ --enable-soap \ --enable-gd-native-ttf \ --enable-mbstring \ --enable-sockets \ --enable-exif \ --disable-ipv6
Thank you for using PHP.
[root@aminglinux php-5.3.27]# echo $?
0
!至此。问题解决。

3.PHP 报错 configure error xml2-config not found.
检查是否安装了libxm包
[root@superz php-5.3.27]# rpm -qa |grep  libxml2
libxml2-2.6.26-2.1.12
libxml2-python-2.6.26-2.1.12
重新安装libxml2和libxml2-devel包, yum安装的时候发现新版本会提示更新,需要更新的可以更新,不要跳过就行了。
[root@superz php-5.3.27]# yum install libxml2
[root@superz php-5.3.27]# yum install libxml2-devel -y

安装完之后查找xml2-config文件是否存在
[root@superz php-5.3.27] # find / -name "xml2-config"/usr/bin/xml2-config

如果存在的话重新安装php
[root@superz php-5.3.27]# ./configure
[root@superz php-5.3.27]# make
[root@superz php-5.3.27]# make install


4.PHP安装mcrypt.so报错 mcrypt.h not found
[url=]方法(关键点在用 2.5.7版本):#使用wget可以通过以下路径下[/url]方法(关键点在用 2.5.7版本)
wget ftp://mcrypt.hellug.gr/pub/crypto/mcrypt/attic/libmcrypt/libmcrypt-2.5.7.tar.gz #解压tar -zxvf libmcrypt-2.5.7.tar.gz  #进入目录cd libmcrypt-2.5.7 #编译(默认安装到/usr/local/lib/)./configure --prefix=/usr/local/libmcrypt #执行安装make && make install

5.PHP报错make[2]:  [install] 错误 1make[2]: Leaving directory&nb
错误提示如下:
​make[2]: *** [install] 错误 1
make[2]: Leaving directory `/usr/local/src/httpd-2.2.31/srclib/apr-util'
make[1]: *** [install-recursive] 错误 1
make[1]: Leaving directory `/usr/local/src/httpd-2.2.31/srclib'
make: *** [install-recursive] 错误 1
解决方法:
make clean 后重新执行make &&make install​








2016-05-25 12:48 举报
已邀请:

回复帖子,请先登录注册

退出全屏模式 全屏模式 回复
评分
可选评分理由: