简体   繁体   English

httpd_module名称是什么,以便Apache / Httpd可与PHP 5.5一起使用?

[英]What's the httpd_module name so that Apache/Httpd works with PHP 5.5?

I've been having some issues installing PHP 5.5 on a CentOS machine using Chef . 我在使用Chef在CentOS机器上安装PHP 5.5时遇到了一些问题。 I was finally able to install it, but when I access the index.php it just download a file with the content. 我终于能够安装它,但是当我访问index.php ,只需下载包含内容的文件。

I'm guessing it's because Apache (technically Httpd, as I'm with CentOS) doesn't have mod_php installed/configured. 我猜这是因为Apache(我在CentOS上是技术上是Httpd)没有安装/配置mod_php

I installed PHP using php cookbook with the following packages: 我使用具有以下软件包的php cookbook安装了PHP:

# ... code to add webtatic repository to yum

node.set['php']['packages'] = ['php55w', 'php55w-devel', 'php55w-cli', 'php55w-snmp', 'php55w-soap', 'php55w-xml', 'php55w-xmlrpc', 'php55w-process', 'php55w-mysqlnd', 'php55w-pecl-memcache', 'php55w-opcache', 'php55w-pdo', 'php55w-imap', 'php55w-mbstring']

If I'm right, the code above didn't install mod_php . 如果我是对的,则上面的代码未安装mod_php The following is my web chef recipe: 以下是我的网络厨师食谱:

httpd_service 'apps' do
    mpm 'prefork'
    action [:create, :start]
    listen_ports ['80', '443']
end

# ... code for virtual hosts

# Install the mod_php Apache module.
# httpd_module 'php' do
#    instance 'apps'
# end

I had the httpd_module 'php' directive uncommented when using PHP 5.4. 使用PHP 5.4时,我没有注释httpd_module 'php'指令。 What's the correct name for the http_module to work with PHP 5.5? http_module与PHP 5.5配合使用的正确名称是什么?

It looks like you've found one of the people who went the Debian route and set their packages up as php55- instead of php- . 看来您已经找到了走Debian路线并将其软件包设置为php55-而不是php- That makes things a pain if you want to go from 5.5 to any higher version, because you're having to uninstall those and install the new ones (ie php70- ). 如果您想从5.5升级到任何更高版本, php70- ,因为您必须卸载它们并安装新的版本(即php70- )。

Instead I recommend switching your recipe to the Remi repo and use the php- packages. 相反,我建议您将食谱切换到Remi仓库,并使用php-软件包。

All that having been said, php55w is your base PHP package. 话虽如此, php55w是您的基本PHP软件包。 I don't see a php55w-common package tho. 我没有看到php55w-common软件包。 Try adding that (or php-common ) and that should get it into Apache. 尝试添加它(或php-common ),它应该将其放入Apache。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM