我收到这个消息:
configure: error: Invalid Apache directory - unable to find httpd.h under /usr/lib64/httpd/
执行以下命令之后:
./configure --with-apache=/usr/lib64/httpd/
我不知道我已经安装的Apache的顶级DIR在哪里。 我的CentOS 6.5服务器上已经安装了apache服务,使用yum install httpd
。
这是我的问题的最终解决scheme:
从存储库中安装httpd-devel包yum install httpd-devel
,其中包含了apache的头文件。
用apxs2configurationphp:./ ./configure --with-apxs
。
最后一步是在httpd.conf文件(或附带的.conf文件中)的VirtualHost中添加以下几行:
<FilesMatch \.php$> SetHandler application/x-httpd-php </FilesMatch>
如果您的apache已经被构build和configuration,您应该将PHP编译为共享模块而不是静态模块。
开销稍高,但您可以分别升级每个组件。
configuration示例:
$ ./configure --with-apxs=<path to apxs binary in apache/http bindir>
忘了一件事:你的Apache必须被编译mod_so启用使用apxs构build的dynamic模块
如果你想为apache编译东西 – 这一次,PHP – ,你需要有Apache的头来做到这一点。 它们有些像“apache-dev”或“apache2-devel”或“libapache2-devel”或类似的命名包。 这个包你必须安装。
这个开发包将包含apxs二进制文件,这些文件可能会被phpconfiguration脚本自动find。
EXTENSION:其次,仔细阅读php源代码的./configure --help
输出。 正如我所记得的,好像是--with-apache
,– --with-apache2
或--with-apxs
标志之间的区别。 你确定你不会意外地编译apache1吗?
扩展#2:也许你可以得到你的发行版本的源码php包,至less要弄清楚,这是如何(重新)编译。