fedora11 自带的httpd安装php

我的fedora11在安装的时候装了apache,作为www服务器,但是没注意php,可能没选上吧,或者没有,总之,在我的机器上打开httpd,然后php的文件显示的是源代码,html的正常。我判断是没装php。
下载php的tar.gz包
tar -xvf php-5.3.3.tar.gz
cd php5.3.3
./configure
make
make install
结果在shell里输入 php没问题,但是浏览器里php的文件还是显示源代码

查资料,说要修改httpd.conf添加在
LoadModule php5_module modules/libphp5.so
添加AddType application/x-httpd-php .php
添加后还是没用。

后来查到应该在php编译的时候 加上--with-apxs=/usr/local/bin/apxs --with-mysql
加上后说找不到apxs
locate apxs找不到
应该是apxs没装,上网查apxs是apache的一个扩展工具。fedora不是默认安装的.要安装httpd-devel

yum install httpd-devel
把apxs装上

重新编译php
./configure --with-apxs --with-mysql
结果中间mysql出了个错,也没管
后来还是没解决
找 module/libphp5.so没有

然后吧 --with-mysql去掉,编译,在module/下产生了libphp5.so  而且在httpd.conf上自动加上了那两行
现在启动httpd,又出错了,不过网上有明确的答案


重新起动APACHE:
# /usr/local/apache2/bin/apachectl start
如果重新起动APACHE出现:
Syntax error on line 232 of /usr/local/apache2/conf/httpd.conf: Cannot load /usr/local/apache2/modules/libphp5.so into server:
/usr/local/apache2/modules/libphp4.so: cannot restore segment prot after reloc: Permission denied
那就要按照下面的方法解决:

1.chcon -t texrel_shlib_t /usr/local/apache2/modules/*.so

2.编辑/etc/selinux/config,找到这段:
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - SELinux is fully disabled.
SELINUX=enforcing

把 SELINUX=enforcing 注释掉:#SELINUX=enforcing ,然后新加一行为:
SELINUX=disabled
保存,关闭。

编辑/etc/sysconfig/selinux,找到:
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - SELinux is fully disabled.
SELINUX=enforcing

如果SELINUX已经是 SELINUX=disabled,那么就不用改了,否则就把SELINUX=enforcing 注释掉,新加一行:
SELINUX=disabled
保存,退出。

尝试一下又出错了
httpd: Syntax error on line 203 of /etc/httpd/conf/httpd.conf: Cannot load /usr/lib/httpd/modules/libphp5.so into server: /usr/lib/httpd/modules/libphp5.so: undefined symbol: zend_parse_parameters
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值