标题

centos下httpd(apache)引入php

php重装不知怎么搞得发现原有的php文件没有解析了,经过nginx直接展示成了php的源码

  1. 重装了httpd
    # yum remove httpd
    # rm -rf /etc/httpd/
    # yum install httpd
    # vim /etc/httpd/conf/httpd.conf
    # httpd
    

    修改了ServerName localhost:80Listen 80

  2. 因重新编译php未找到正确的方法,一直未生成libphp5.so换了种方式
     # yum provides */libphp5.so
     Loaded plugins: fastestmirror
     Loading mirror speeds from cached hostfile
      `* base: mirrors.aliyun.com
      `* epel: mirrors.tongji.edu.cn
      `* extras: mirrors.aliyun.com
      `* remi-safe: mirrors.tuna.tsinghua.edu.cn
      `* updates: mirrors.aliyun.com
      `* webtatic: us-east.repo.webtatic.com
     epel/x86_64/filelists                                                                                                                    |  10 MB  00:00:00     
     extras/7/x86_64/filelists_db                                                                                                             | 588 kB  00:00:00     
     jenkins/filelists_db                                                                                                                     |  15 kB  00:00:00     
     mongodb/filelists                                                                                                                        |  10 kB  00:00:00     
     remi-safe/filelists_db                                                                                                                   | 1.0 MB  00:00:00     
     updates/7/x86_64/filelists_db                                                                                                            | 2.7 MB  00:00:00     
     php-5.4.16-45.el7.x86_64 : PHP scripting language for creating dynamic web sites
     Repo        : base
     Matched from:
     Filename    : /usr/lib64/httpd/modules/libphp5.so
    
  3. 最后在/etc/httpd/conf/httpd.confInclude conf.modules.d/*.conf后加入了LoadModule php5_module /usr/lib64/httpd/modules/libphp5.so重启后解决

参考

  1. yum install httpd后在modules里没找到libphp.so