分享web开发知识

注册/登录|最近发布|今日推荐

主页 IT知识网页技术软件开发前端开发代码编程运营维护技术分享教程案例
当前位置:首页 > 教程案例

Linux9.5 配置httpd支持php

发布时间:2023-09-06 01:44责任编辑:傅花花关键词:配置httpLinux

配置httpd支持php,apache调用了php的模块,使得httpd解析php

httpd主配置文件/usr/local/apache2.4/conf/httpd.conf

vim /usr/local/apache2.4/conf/httpd.conf //修改以下4个地方
ServerName 注释井号去掉

Require all denied    403的原因 ,改成granted。

可以通过命令/usr/local/apache2.4/bin/apachctl -t去检查配置文件是否正确,  -t 换成 graceful重新加载配置


AddType application/x-httpd-php .php    增加php解析语句,搜索AddType   在其后添加


DirectoryIndex index.html index.php   正价针对Php的索引,如果一个站点默认页为index.php,那么就得加上这个index.php的支持

[root@chy002 php]# vi /usr/local/apache2.4/htdocs/1.php<?phpphpinfo();?>

一定要禁用iptables,否则解析不到1.php


/usr/local/apache2.4/bin/apachectl -t //测试语法

/usr/local/apache2.4/bin/apachectl -graceful //重新加载配置文件
/usr/local/apache2.4/bin/apachectl start //启动服务
netstat -lntp
curl localhost
vim /usr/local/apache2.4/htodcs/test.php //增加如下内容
<?php
echo 123;
?>
curl localhost/test.php

Linux9.5 配置httpd支持php

原文地址:https://www.cnblogs.com/chyuanliu/p/8497043.html

知识推荐

我的编程学习网——分享web前端后端开发技术知识。 垃圾信息处理邮箱 tousu563@163.com 网站地图
icp备案号 闽ICP备2023006418号-8 不良信息举报平台 互联网安全管理备案 Copyright 2023 www.wodecom.cn All Rights Reserved